Skip to content

Commit

Permalink
fix: add isFullWidth for mobile viewport modal buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
hanstirtaputra committed Jul 20, 2022
1 parent 4f73b23 commit 53ee64d
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
useBreakpointValue,
} from '@chakra-ui/react'

import { useIsMobile } from '~hooks/useIsMobile'
import { WORKSPACE_TITLE_VALIDATION_RULES } from '~utils/workspaceValidation'
import Button from '~components/Button'
import FormErrorMessage from '~components/FormControl/FormErrorMessage'
Expand Down Expand Up @@ -45,6 +46,7 @@ export const CreateWorkspaceModal = ({
xs: 'mobile',
md: 'md',
})
const isMobile = useIsMobile()

// TODO (hans): Implement create workspace functionality
const handleCreateWorkspace = handleSubmit((data) => {
Expand Down Expand Up @@ -78,10 +80,17 @@ export const CreateWorkspaceModal = ({
flexDir={{ base: 'column-reverse', md: 'inherit' }}
justifyContent="flex-end"
>
<Button onClick={onClose} variant="clear" colorScheme="secondary">
<Button
onClick={onClose}
variant="clear"
colorScheme="secondary"
isFullWidth={isMobile}
>
Cancel
</Button>
<Button onClick={handleCreateWorkspace}>Create workspace</Button>
<Button onClick={handleCreateWorkspace} isFullWidth={isMobile}>
Create workspace
</Button>
</Stack>
</ModalFooter>
</ModalContent>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
} from '@chakra-ui/react'
import { isEmpty } from 'lodash'

import { useIsMobile } from '~hooks/useIsMobile'
import Button from '~components/Button'
import FormErrorMessage from '~components/FormControl/FormErrorMessage'
import Radio from '~components/Radio'
Expand Down Expand Up @@ -42,6 +43,7 @@ export const DeleteWorkspaceModal = ({
xs: 'mobile',
md: 'md',
})
const isMobile = useIsMobile()

// TODO (hans): Implement delete workspace functionality
const handleDeleteWorkspace = handleSubmit((data) => {
Expand Down Expand Up @@ -88,10 +90,19 @@ export const DeleteWorkspaceModal = ({
flexDir={{ base: 'column-reverse', md: 'inherit' }}
justifyContent="flex-end"
>
<Button onClick={onClose} variant="clear" colorScheme="secondary">
<Button
onClick={onClose}
variant="clear"
colorScheme="secondary"
isFullWidth={isMobile}
>
Cancel
</Button>
<Button onClick={handleDeleteWorkspace} colorScheme="danger">
<Button
onClick={handleDeleteWorkspace}
colorScheme="danger"
isFullWidth={isMobile}
>
Yes, delete workspace
</Button>
</Stack>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
useBreakpointValue,
} from '@chakra-ui/react'

import { useIsMobile } from '~hooks/useIsMobile'
import { WORKSPACE_TITLE_VALIDATION_RULES } from '~utils/workspaceValidation'
import Button from '~components/Button'
import FormErrorMessage from '~components/FormControl/FormErrorMessage'
Expand Down Expand Up @@ -45,6 +46,7 @@ export const RenameWorkspaceModal = ({
xs: 'mobile',
md: 'md',
})
const isMobile = useIsMobile()

// TODO (hans): Implement rename workspace functionality
const handleRenameWorkspace = handleSubmit((data) => {
Expand Down Expand Up @@ -78,10 +80,17 @@ export const RenameWorkspaceModal = ({
flexDir={{ base: 'column-reverse', md: 'inherit' }}
justifyContent="flex-end"
>
<Button onClick={onClose} variant="clear" colorScheme="secondary">
<Button
onClick={onClose}
variant="clear"
colorScheme="secondary"
isFullWidth={isMobile}
>
Cancel
</Button>
<Button onClick={handleRenameWorkspace}>Rename workspace</Button>
<Button onClick={handleRenameWorkspace} isFullWidth={isMobile}>
Rename workspace
</Button>
</Stack>
</ModalFooter>
</ModalContent>
Expand Down

0 comments on commit 53ee64d

Please sign in to comment.