fix(page): Add item scroll, fix display issues, refactor nav, and improve perf (#166)

* feat: add item scroll to active

* fix: reset enterkey and scroll to view

* fix: link item displayName

* refactor: remove keyboard page nav

* chore: fix scrolling, perf, keys, highlight active item etc

* chore: use new hook for create a page

* chore: disabled auto delete page
This commit is contained in:
Aslam
2024-09-19 21:12:05 +07:00
committed by GitHub
parent afaef5d3c5
commit c003711905
8 changed files with 142 additions and 209 deletions

View File

@@ -21,14 +21,10 @@ export const PageItem = React.forwardRef<HTMLAnchorElement, PageItemProps>(({ pa
<Link
ref={ref}
tabIndex={isActive ? 0 : -1}
className={cn(
"relative block cursor-default rounded-lg outline-none",
"h-12 items-center gap-x-2 py-2 max-lg:px-4 sm:px-6",
{
"bg-muted-foreground/10": isActive,
"hover:bg-muted/50": !isActive
}
)}
className={cn("relative block cursor-default outline-none", "min-h-12 py-2 max-lg:px-4 sm:px-6", {
"bg-muted-foreground/5": isActive,
"hover:bg-muted/50": !isActive
})}
href={`/pages/${page.id}`}
role="listitem"
>
@@ -38,14 +34,9 @@ export const PageItem = React.forwardRef<HTMLAnchorElement, PageItemProps>(({ pa
</Column.Wrapper>
{!isTablet && (
<>
{/* <Column.Wrapper style={columnStyles.content}>
<Column.Text className="text-[13px]">{page.slug}</Column.Text>
</Column.Wrapper> */}
<Column.Wrapper style={columnStyles.topic}>
{page.topic && <Badge variant="secondary">{page.topic.prettyName}</Badge>}
</Column.Wrapper>
</>
<Column.Wrapper style={columnStyles.topic}>
{page.topic && <Badge variant="secondary">{page.topic.prettyName}</Badge>}
</Column.Wrapper>
)}
<Column.Wrapper style={columnStyles.updated} className="flex justify-end">