Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SWC-7186: SRC EntityPageTitleBar updates on mobile #1503

Merged
merged 7 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ export default function EntityPageTitleBar(props: EntityPageTitleBarProps) {
backgroundColor: 'grey.100',
}}
>
<Stack direction={'row'}>
<Stack
sx={{
flexDirection: { xs: 'column', sm: 'row' },
}}
>
<Stack
direction={'row'}
alignItems={'center'}
Expand Down
64 changes: 59 additions & 5 deletions packages/synapse-react-client/src/components/menu/ComplexMenu.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Box } from '@mui/material'
import { Box, Button, Typography, useMediaQuery, useTheme } from '@mui/material'
import { DropdownMenu, DropdownMenuProps } from './DropdownMenu'
import { IconSvgButton, IconSvgButtonProps } from '../IconSvgButton'
import IconSvg from '../IconSvg'

export type ComplexMenuProps = {
/*
Expand All @@ -22,14 +23,67 @@ export type ComplexMenuProps = {
*/
export function ComplexMenu(props: ComplexMenuProps) {
const { iconButtons = [], dropdownMenus = [] } = props
const theme = useTheme()
const isSmallScreen = useMediaQuery(theme.breakpoints.down('sm'))

return (
<Box sx={{ display: 'flex', alignItems: 'center', gap: '10px' }}>
{iconButtons.map(iconButton => {
return <IconSvgButton key={iconButton.tooltipText} {...iconButton} />
<Box
sx={theme => ({
display: 'flex',
alignItems: 'center',
gap: '10px',
[theme.breakpoints.down('sm')]: {
flexDirection: 'column',
paddingTop: '10px',
},
})}
>
{iconButtons.map(iconButton =>
isSmallScreen && iconButton.tooltipText ? (
<Box
sx={{
width: '100%',
textAlign: 'center',
}}
>
<Button
variant="text"
startIcon={
<IconSvg
key={iconButton.tooltipText}
icon={iconButton.icon}
wrap={false}
fontSize={'inherit'}
/>
}
onClick={iconButton.onClick}
sx={{
padding: '6px 12px',
minWidth: 'unset',
}}
>
<Typography variant="buttonLink">
{iconButton.tooltipText}
</Typography>
</Button>
</Box>
) : (
<IconSvgButton key={iconButton.tooltipText} {...iconButton} />
),
)}
{dropdownMenus.map((menuProps, index) => {
return <DropdownMenu key={index} {...menuProps} />
return (
<Box
sx={theme => ({
[theme.breakpoints.down('sm')]: {
width: '100%',
'.MuiButton-root': { width: '100%' },
},
})}
>
<DropdownMenu key={index} {...menuProps} />
</Box>
)
})}
</Box>
)
Expand Down
Loading