-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: WorkspacePage top menu not showing in md breakpoint
- Loading branch information
1 parent
8763092
commit d0a3733
Showing
2 changed files
with
48 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 36 additions & 39 deletions
75
frontend/src/features/workspace/components/WorkspaceSideMenu/WorkspaceMenuHeader.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,55 @@ | ||
import { BiMenuAltLeft, BiPlus } from 'react-icons/bi' | ||
import { Flex, FlexProps, Text } from '@chakra-ui/react' | ||
|
||
import { useIsMobile } from '~hooks/useIsMobile' | ||
import IconButton from '~components/IconButton' | ||
|
||
interface WorkspaceMenuHeaderProps extends FlexProps { | ||
shouldShowAddWorkspaceButton?: boolean | ||
onMenuClick?: () => void | ||
shouldShowAddWorkspaceButton?: boolean | ||
shouldShowMenuIcon?: boolean | ||
} | ||
|
||
export const WorkspaceMenuHeader = ({ | ||
shouldShowAddWorkspaceButton = true, | ||
shouldShowAddWorkspaceButton = false, | ||
shouldShowMenuIcon = false, | ||
onMenuClick, | ||
...props | ||
}: WorkspaceMenuHeaderProps): JSX.Element => { | ||
const isMobile = useIsMobile() | ||
|
||
return ( | ||
<Flex | ||
justifyContent={{ base: 'inherit', md: 'space-between' }} | ||
px={{ base: '1.5rem', md: '2rem' }} | ||
mt={{ base: 0, md: '1rem' }} | ||
{...props} | ||
alignItems="center" | ||
> | ||
<Flex alignItems="center"> | ||
{isMobile && ( | ||
<IconButton | ||
icon={<BiMenuAltLeft />} | ||
onClick={() => onMenuClick && onMenuClick()} | ||
aria-label="open workspace drawer" | ||
variant="clear" | ||
colorScheme="primary" | ||
color="secondary.500" | ||
/> | ||
)} | ||
<Text textStyle="h4" color="secondary.700"> | ||
Workspaces | ||
</Text> | ||
</Flex> | ||
|
||
{shouldShowAddWorkspaceButton && ( | ||
}: WorkspaceMenuHeaderProps): JSX.Element => ( | ||
<Flex | ||
justifyContent={{ base: 'inherit', md: 'space-between' }} | ||
px={{ base: '1.5rem', md: '2rem' }} | ||
mt={{ base: 0, lg: '1rem' }} | ||
{...props} | ||
alignItems="center" | ||
> | ||
<Flex alignItems="center"> | ||
{shouldShowMenuIcon && ( | ||
<IconButton | ||
size="lg" | ||
aria-label="Create new workspace" | ||
icon={<BiMenuAltLeft />} | ||
onClick={() => onMenuClick && onMenuClick()} | ||
aria-label="open workspace drawer" | ||
variant="clear" | ||
colorScheme="primary" | ||
color="secondary.500" | ||
// TODO (hans): Implement add workspace modal view | ||
onClick={() => null} | ||
icon={<BiPlus />} | ||
justifySelf="flex-end" | ||
/> | ||
)} | ||
<Text textStyle="h4" color="secondary.700"> | ||
Workspaces | ||
</Text> | ||
</Flex> | ||
) | ||
} | ||
|
||
{shouldShowAddWorkspaceButton && ( | ||
<IconButton | ||
size="lg" | ||
aria-label="Create new workspace" | ||
variant="clear" | ||
colorScheme="primary" | ||
color="secondary.500" | ||
// TODO (hans): Implement add workspace modal view | ||
onClick={() => null} | ||
icon={<BiPlus />} | ||
justifySelf="flex-end" | ||
/> | ||
)} | ||
</Flex> | ||
) |