@mui/lab#Masonry TypeScript Examples
The following examples show how to use
@mui/lab#Masonry.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: StatDisplayComponent.tsx From genshin-optimizer with MIT License | 6 votes |
export default function StatDisplayComponent() {
const { data } = useContext(DataContext)
const sections = getDisplaySections(data)
return <Box sx={{ mr: -1, mb: -1 }}>
<Masonry columns={{ xs: 1, sm: 2, md: 3, xl: 4 }} spacing={1}>
{sections.map(([key, Nodes]) =>
<Section key={key} displayNs={Nodes} sectionKey={key} />)}
</Masonry >
</Box>
}
Example #2
Source File: OptimizationTargetSelector.tsx From genshin-optimizer with MIT License | 6 votes |
export default function OptimizationTargetSelector({ optimizationTarget, setTarget, disabled = false }: {
optimizationTarget?: string[], setTarget: (target: string[]) => void, disabled
}) {
const [open, setOpen] = useState(false)
const onOpen = useCallback(() => !disabled && setOpen(true), [setOpen, disabled])
const onClose = useCallback(() => setOpen(false), [setOpen])
const setTargetHandler = useCallback(
(target: string[]) => {
onClose()
setTarget(target)
},
[onClose, setTarget],
)
const { data } = useContext(DataContext)
const sections = getDisplaySections(data)
return <>
<WhiteButton onClick={onOpen} disabled={disabled} >
<TargetDisplayText optimizationTarget={optimizationTarget} />
</WhiteButton>
<ModalWrapper open={open} onClose={onClose}>
<CardDark >
<CardContent>
<Masonry columns={{ xs: 1, sm: 2, md: 3 }} spacing={1}>
{sections.map(([key, Nodes]) =>
<SelectorSection key={key} displayNs={Nodes} sectionKey={key} setTarget={setTargetHandler} />)}
</Masonry >
</CardContent>
</CardDark>
</ModalWrapper>
</>
}