fix: adjust slide up modal aspect ratio

Signed-off-by: Innei <i@innei.in>
This commit is contained in:
Innei 2024-09-24 20:46:49 +08:00
parent 5933ceab63
commit 95d17f5732
No known key found for this signature in database
GPG Key ID: 0F62D33977F021F7
2 changed files with 15 additions and 2 deletions

View File

@ -12,7 +12,12 @@ export const PlainModal = ({ children }: PropsWithChildren) => children
export { PlainModal as NoopChildren }
export const SlideUpModal = (props: PropsWithChildren) => {
type ModalTemplateType = {
(props: PropsWithChildren<{ className?: string }>): JSX.Element
class: (className: string) => (props: PropsWithChildren<{ className?: string }>) => JSX.Element
}
export const SlideUpModal: ModalTemplateType = (props) => {
const winHeight = useState(() => window.innerHeight)[0]
const { dismiss } = useCurrentModal()
return (
@ -39,7 +44,8 @@ export const SlideUpModal = (props: PropsWithChildren) => {
}}
className={cn(
"relative flex flex-col items-center overflow-hidden rounded-xl border bg-theme-background p-8 pb-0",
"h-[80vh] w-[600px] max-w-full shadow lg:max-h-[calc(100vh-10rem)]",
"aspect-[7/9] w-[600px] max-w-full shadow lg:max-h-[calc(100vh-10rem)]",
props.className,
)}
>
{props.children}
@ -49,3 +55,9 @@ export const SlideUpModal = (props: PropsWithChildren) => {
</div>
)
}
SlideUpModal.class = (className: string) => {
return (props: ComponentType) => (
<SlideUpModal {...props} className={cn(props.className, className)} />
)
}

View File

@ -42,6 +42,7 @@ export const useAchievementModal = () => {
title: "Achievements",
content: AchievementModalContent,
CustomModalComponent: SlideUpModal,
overlay: true,
})
}, [present])
}