added controller display component for the controllers on a bin
This commit is contained in:
parent
e4fe48025e
commit
a9f5b9594b
3 changed files with 180 additions and 52 deletions
|
|
@ -48,7 +48,11 @@ interface Props {
|
|||
*
|
||||
* @default undefined
|
||||
*/
|
||||
toggledButtons?: number[]
|
||||
toggledButtons?: number[]
|
||||
/**
|
||||
* This can be used to set which button starts toggled by default, and from there it will be controlled internally, toggledButtons will override this
|
||||
*/
|
||||
defaultToggle?: number
|
||||
/**
|
||||
* Numerical value for the size of the text for buttons that dont use the icon
|
||||
*/
|
||||
|
|
@ -97,7 +101,7 @@ const useStyles = makeStyles((theme: Theme) => {
|
|||
})
|
||||
|
||||
export default function ButtonGroup(props: Props){
|
||||
const { buttons, toggle, toggledButtons, multiToggle, textSize, disableAll } = props
|
||||
const { buttons, toggle, toggledButtons, defaultToggle, multiToggle, textSize, disableAll } = props
|
||||
const classes = useStyles()
|
||||
const [currentToggle, setCurrentToggle] = useState<number[]>([])
|
||||
|
||||
|
|
@ -107,6 +111,8 @@ export default function ButtonGroup(props: Props){
|
|||
let toggled: number [] = [0]
|
||||
if(toggledButtons){
|
||||
toggled = toggledButtons
|
||||
} else if(defaultToggle){
|
||||
toggled = [defaultToggle]
|
||||
}
|
||||
setCurrentToggle(toggled)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue