Skip to content

Commit

Permalink
fix: adjust slide up modal aspect ratio
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <i@innei.in>
  • Loading branch information
Innei committed Sep 24, 2024
1 parent 5933cea commit 95d17f5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
16 changes: 14 additions & 2 deletions apps/renderer/src/components/ui/modal/stacked/custom-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand All @@ -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}
Expand All @@ -49,3 +55,9 @@ export const SlideUpModal = (props: PropsWithChildren) => {
</div>
)
}

SlideUpModal.class = (className: string) => {
return (props: ComponentType) => (
<SlideUpModal {...props} className={cn(props.className, className)} />
)
}
1 change: 1 addition & 0 deletions apps/renderer/src/modules/achievement/hooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export const useAchievementModal = () => {
title: "Achievements",
content: AchievementModalContent,
CustomModalComponent: SlideUpModal,
overlay: true,
})
}, [present])
}
Expand Down

0 comments on commit 95d17f5

Please sign in to comment.