Skip to content

Commit

Permalink
chore(misc modals): update props to omit children and remove extra bu…
Browse files Browse the repository at this point in the history
…tton
  • Loading branch information
seaerchin committed Oct 20, 2022
1 parent 7d6129d commit 8e881fb
Show file tree
Hide file tree
Showing 14 changed files with 24 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ const Template: Story<never> = () => {
return (
<>
<Button onClick={onOpen}>Open Modal</Button>
<ApprovedModal isOpen={isOpen} onClose={onClose}>
<Button colorScheme="danger">Click me</Button>
</ApprovedModal>
<ApprovedModal isOpen={isOpen} onClose={onClose} />
</>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ import { Button, ModalCloseButton } from "@opengovsg/design-system-react"

import { ToastImage } from "assets"

export const ApprovedModal = (props: ModalProps): JSX.Element => {
export const ApprovedModal = (
props: Omit<ModalProps, "children">
): JSX.Element => {
const { onClose } = props

return (
<Modal {...props}>
<ModalOverlay />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ const Template: Story<never> = () => {
return (
<>
<Button onClick={onOpen}>Open Modal</Button>
<CancelRequestModal isOpen={isOpen} onClose={onClose}>
<Button colorScheme="danger">Click me</Button>
</CancelRequestModal>
<CancelRequestModal isOpen={isOpen} onClose={onClose} />
</>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ import {
} from "@chakra-ui/react"
import { Button, ModalCloseButton } from "@opengovsg/design-system-react"

export const CancelRequestModal = (props: ModalProps): JSX.Element => {
export const CancelRequestModal = (
props: Omit<ModalProps, "children">
): JSX.Element => {
const { onClose } = props

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ const Template: Story<never> = () => {
return (
<>
<Button onClick={onOpen}>Open Modal</Button>
<EditingBlockedModal isOpen={isOpen} onClose={onClose}>
<Button colorScheme="danger">Click me</Button>
</EditingBlockedModal>
<EditingBlockedModal isOpen={isOpen} onClose={onClose} />
</>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ import {
} from "@chakra-ui/react"
import { Button, ModalCloseButton } from "@opengovsg/design-system-react"

export const EditingBlockedModal = (props: ModalProps): JSX.Element => {
export const EditingBlockedModal = (
props: Omit<ModalProps, "children">
): JSX.Element => {
const { onClose } = props

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ const Template: Story<TemplateProps> = ({
admins={admins}
isOpen={isOpen}
onClose={onClose}
>
<Button colorScheme="danger">Click me</Button>
</ManageReviewerModal>
/>
</>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import Select, { PropsValue, useStateManager } from "react-select"

import { User } from "types/reviewRequest"

export interface ManageReviewerModalProps extends ModalProps {
export interface ManageReviewerModalProps extends Omit<ModalProps, "children"> {
selectedAdmins: User[]
admins: User[]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ const Template: Story<never> = () => {
return (
<>
<Button onClick={onOpen}>Open Modal</Button>
<PendingApprovalModal isOpen={isOpen} onClose={onClose}>
<Button colorScheme="danger">Click me</Button>
</PendingApprovalModal>
<PendingApprovalModal isOpen={isOpen} onClose={onClose} />
</>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ import {
} from "@chakra-ui/react"
import { Button, ModalCloseButton } from "@opengovsg/design-system-react"

export const PendingApprovalModal = (props: ModalProps): JSX.Element => {
export const PendingApprovalModal = (
props: Omit<ModalProps, "children">
): JSX.Element => {
const { onClose } = props

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ const Template: Story<never> = () => {
return (
<>
<Button onClick={onOpen}>Open Modal</Button>
<PublishedModal isOpen={isOpen} onClose={onClose}>
<Button colorScheme="danger">Click me</Button>
</PublishedModal>
<PublishedModal isOpen={isOpen} onClose={onClose} />
</>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ import { Button, ModalCloseButton } from "@opengovsg/design-system-react"

import { RocketBlastOffImage } from "assets"

export const PublishedModal = (props: ModalProps): JSX.Element => {
export const PublishedModal = (
props: Omit<ModalProps, "children">
): JSX.Element => {
const { onClose } = props

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ const Template: Story<TemplateProps> = ({
reviewUrl={reviewUrl}
reviewTitle={reviewTitle}
siteName={siteName}
>
<Button colorScheme="danger">Click me</Button>
</SendRequestModal>
/>
</>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ View it on IsomerCMS: ${reviewUrl}`
)}&body=${body}`
}

export interface SendRequestModalProps extends ModalProps {
export interface SendRequestModalProps extends Omit<ModalProps, "children"> {
admins: User[]
reviewUrl: string
reviewTitle: string
Expand Down

0 comments on commit 8e881fb

Please sign in to comment.