mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-04-23 07:34:07 -05:00
50 lines
996 B
TypeScript
50 lines
996 B
TypeScript
import clsx from "clsx";
|
|
import type * as React from "react";
|
|
|
|
// shares styles with SubNav.tsx
|
|
|
|
export function Tabs({
|
|
children,
|
|
className,
|
|
compact = false,
|
|
}: {
|
|
children: React.ReactNode;
|
|
className?: string;
|
|
compact?: boolean;
|
|
}) {
|
|
return (
|
|
<div className={clsx("sub-nav__container", className, { compact })}>
|
|
{children}
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export function Tab({
|
|
children,
|
|
className,
|
|
active,
|
|
onClick,
|
|
testId,
|
|
}: {
|
|
children: React.ReactNode;
|
|
className?: string;
|
|
active: boolean;
|
|
onClick: () => void;
|
|
testId?: string;
|
|
}) {
|
|
// TODO: improve semantic html here, maybe could use tab component from Headless UI?
|
|
return (
|
|
<div
|
|
className={clsx("sub-nav__link__container", { active })}
|
|
onClick={onClick}
|
|
tabIndex={0}
|
|
role="button"
|
|
aria-pressed="false"
|
|
data-testid={testId}
|
|
>
|
|
<div className={clsx("sub-nav__link", className)}>{children}</div>
|
|
<div className="sub-nav__border-guy" />
|
|
</div>
|
|
);
|
|
}
|