Fix primary button, add overlay, allow ReactNode msg
This commit is contained in:
parent
39f79bfbc6
commit
6541dff12e
1 changed files with 8 additions and 3 deletions
|
|
@ -3,12 +3,13 @@ import * as AlertDialog from '@radix-ui/react-alert-dialog'
|
||||||
|
|
||||||
import './index.scss'
|
import './index.scss'
|
||||||
import Button from '~components/Button'
|
import Button from '~components/Button'
|
||||||
|
import Overlay from '~components/Overlay'
|
||||||
|
|
||||||
// Props
|
// Props
|
||||||
interface Props {
|
interface Props {
|
||||||
open: boolean
|
open: boolean
|
||||||
title?: string
|
title?: string
|
||||||
message: string
|
message: string | React.ReactNode
|
||||||
primaryAction?: () => void
|
primaryAction?: () => void
|
||||||
primaryActionText?: string
|
primaryActionText?: string
|
||||||
cancelAction: () => void
|
cancelAction: () => void
|
||||||
|
|
@ -34,8 +35,11 @@ const Alert = (props: Props) => {
|
||||||
/>
|
/>
|
||||||
</AlertDialog.Cancel>
|
</AlertDialog.Cancel>
|
||||||
{props.primaryAction ? (
|
{props.primaryAction ? (
|
||||||
<AlertDialog.Action onClick={props.primaryAction}>
|
<AlertDialog.Action asChild>
|
||||||
{props.primaryActionText}
|
<Button
|
||||||
|
onClick={props.cancelAction}
|
||||||
|
text={props.primaryActionText}
|
||||||
|
/>
|
||||||
</AlertDialog.Action>
|
</AlertDialog.Action>
|
||||||
) : (
|
) : (
|
||||||
''
|
''
|
||||||
|
|
@ -43,6 +47,7 @@ const Alert = (props: Props) => {
|
||||||
</div>
|
</div>
|
||||||
</AlertDialog.Content>
|
</AlertDialog.Content>
|
||||||
</div>
|
</div>
|
||||||
|
<Overlay open={props.open} visible={true} />
|
||||||
</AlertDialog.Portal>
|
</AlertDialog.Portal>
|
||||||
</AlertDialog.Root>
|
</AlertDialog.Root>
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue