fix: scroll mask

Signed-off-by: Innei <i@innei.in>
This commit is contained in:
Innei
2024-07-23 23:24:22 +08:00
parent 62aae0d244
commit 1a7c8dbc5b
3 changed files with 14 additions and 6 deletions
@@ -69,14 +69,17 @@ export const Viewport = React.forwardRef<
const [canScroll, setCanScroll] = React.useState(false)
React.useLayoutEffect(() => {
const $el = ref.current
const $child = $el?.firstElementChild
if (!$el) return
if (!$child) return
const handler = () => {
const canScroll = $el.scrollHeight > $el.clientHeight
setCanScroll(canScroll)
}
const observer = new ResizeObserver(handler)
handler()
observer.observe($el)
observer.observe($child)
return () => observer.disconnect()
}, [])
@@ -6,7 +6,7 @@ export const tableHeadVariants = cva(
variants: {
size: {
default: "h-12 px-4",
sm: "h-6 px-3 font-normal text-zinc-800",
sm: "h-6 px-3 font-normal text-zinc-800 dark:text-zinc-500",
},
},
defaultVariants: {
@@ -60,16 +60,21 @@ const Content = () => {
<Close />
<ScrollArea.ScrollArea
rootClassName="h-full grow flex-1 shrink-0 overflow-auto pl-8 pr-7 pb-8"
viewportClassName="pr-1"
viewportClassName="pr-1 min-h-full [&>div]:min-h-full"
>
<Component />
<p className="mt-12 flex items-center justify-center gap-1 text-xs opacity-80">
<div className="h-12" />
<p className="absolute inset-x-0 bottom-8 flex items-center justify-center gap-1 text-xs opacity-80">
<i className="i-mgc-heart-cute-fi" />
{" "}
{/* 喜欢我们的产品?在 GitHub 给添加星标 并 分享您宝贵的建议 ! */}
Love our product?
{" "}
<a href={`${repository.url}`} className="text-theme-accent" target="_blank">
<a
href={`${repository.url}`}
className="text-theme-accent"
target="_blank"
>
Give us a star on GitHub
</a>
!