modal positioning
This commit is contained in:
parent
7729bdd2dc
commit
43660387fa
|
@ -194,7 +194,7 @@ function OpenAnswer(props: {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Col className={'border-base-200 bg-base-200 flex-1 rounded-md px-2'}>
|
<Col className={'border-base-200 bg-base-200 flex-1 rounded-md px-2'}>
|
||||||
<Modal open={open} setOpen={setOpen}>
|
<Modal open={open} setOpen={setOpen} position="center">
|
||||||
<AnswerBetPanel
|
<AnswerBetPanel
|
||||||
answer={answer}
|
answer={answer}
|
||||||
contract={contract}
|
contract={contract}
|
||||||
|
|
|
@ -60,7 +60,7 @@ export default function BetButton(props: {
|
||||||
)}
|
)}
|
||||||
</Col>
|
</Col>
|
||||||
|
|
||||||
<Modal open={open} setOpen={setOpen}>
|
<Modal open={open} setOpen={setOpen} position="center">
|
||||||
<SimpleBetPanel
|
<SimpleBetPanel
|
||||||
className={betPanelClassName}
|
className={betPanelClassName}
|
||||||
contract={contract}
|
contract={contract}
|
||||||
|
|
|
@ -8,9 +8,10 @@ export function Modal(props: {
|
||||||
open: boolean
|
open: boolean
|
||||||
setOpen: (open: boolean) => void
|
setOpen: (open: boolean) => void
|
||||||
size?: 'sm' | 'md' | 'lg' | 'xl'
|
size?: 'sm' | 'md' | 'lg' | 'xl'
|
||||||
|
position?: 'center' | 'top' | 'bottom'
|
||||||
className?: string
|
className?: string
|
||||||
}) {
|
}) {
|
||||||
const { children, open, setOpen, size = 'md', className } = props
|
const { children, position, open, setOpen, size = 'md', className } = props
|
||||||
|
|
||||||
const sizeClass = {
|
const sizeClass = {
|
||||||
sm: 'max-w-sm',
|
sm: 'max-w-sm',
|
||||||
|
@ -19,6 +20,12 @@ export function Modal(props: {
|
||||||
xl: 'max-w-5xl',
|
xl: 'max-w-5xl',
|
||||||
}[size]
|
}[size]
|
||||||
|
|
||||||
|
const positionClass = {
|
||||||
|
center: 'items-center',
|
||||||
|
top: 'items-start',
|
||||||
|
bottom: 'items-end',
|
||||||
|
}[position ?? 'bottom']
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Transition.Root show={open} as={Fragment}>
|
<Transition.Root show={open} as={Fragment}>
|
||||||
<Dialog
|
<Dialog
|
||||||
|
@ -26,7 +33,12 @@ export function Modal(props: {
|
||||||
className="fixed inset-0 z-50 overflow-y-auto"
|
className="fixed inset-0 z-50 overflow-y-auto"
|
||||||
onClose={setOpen}
|
onClose={setOpen}
|
||||||
>
|
>
|
||||||
<div className="flex min-h-screen items-end justify-center px-4 pt-4 pb-20 text-center sm:p-0">
|
<div
|
||||||
|
className={clsx(
|
||||||
|
'flex min-h-screen justify-center px-4 pt-4 pb-20 text-center sm:p-0',
|
||||||
|
positionClass
|
||||||
|
)}
|
||||||
|
>
|
||||||
<Transition.Child
|
<Transition.Child
|
||||||
as={Fragment}
|
as={Fragment}
|
||||||
enter="ease-out duration-300"
|
enter="ease-out duration-300"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user