fix: documentation type checking

This commit is contained in:
Valerio Ageno
2024-08-15 21:12:02 +02:00
parent a0a81b514c
commit edd8a02423
2 changed files with 34 additions and 31 deletions
@@ -38,14 +38,16 @@ export function BreadcrumbElement({
href,
label,
}: BreadcrumbElementProps): JSX.Element {
if (href) {
return (
<Button component={Link} href={href} variant="subtle" radius="xl" px={10}>
{label}
</Button>
)
}
return (
<Button
component={href ? Link : 'span'}
href={href}
variant={href ? 'subtle' : 'light'}
radius="xl"
px={href ? 10 : undefined}
>
<Button component="span" variant="light" radius="xl">
{label}
</Button>
)
@@ -18,28 +18,29 @@ export default function SidebarLink(
const { pathname } = useRouter()
const [isOpen, setIsOpen] = useState<boolean>(!!props.defaultOpened)
return (
<NavLink
component={props.href.startsWith('#') ? 'button' : Link}
active={pathname === props.href}
className={styles.link}
rightSection={
props.children && (
<IconChevronRight
size="1.2rem"
stroke={1.5}
className="mantine-rotate-rtl"
onClick={(e) => {
e.preventDefault()
e.stopPropagation()
setIsOpen((state) => !state)
}}
/>
)
}
opened={isOpen}
autoContrast
{...props}
/>
)
const internalProps = {
active: pathname === props.href,
className: styles.link,
rightSection: props.children && (
<IconChevronRight
size="1.2rem"
stroke={1.5}
className="mantine-rotate-rtl"
onClick={(e) => {
e.preventDefault()
e.stopPropagation()
setIsOpen((state) => !state)
}}
/>
),
opened: isOpen,
autoContrast: true,
...props,
}
if (props.href.startsWith('#')) {
return <NavLink component="button" {...internalProps} />
}
return <NavLink component={Link} {...internalProps} />
}