feat: show page
This commit is contained in:
1 parent
abe1c795a1
commit
183c7231a1
26 files changed
+210
-176
No files matched your search
@@ -8,13 +8,13 @@ interface Props {
|
||||
}
|
||||
|
||||
const ButtonsGroup: FC<Props> = ({ children, className }) => (
|
||||
<div className={cn('flex bg-input gap-[1px] rounded-md md:flex-grow-0 flex-grow group', className)}>
|
||||
<div className={cn('flex bg-input gap-[1px] rounded-md group', className)}>
|
||||
{Children.map(children, (child) => {
|
||||
if (!isValidElement(child)) return null;
|
||||
|
||||
return cloneElement(child as ReactElement<{ className?: string }>, {
|
||||
className: cn(
|
||||
'h-8 gap-1 flex-grow md:px-3 px-2 [&:not(:first-child):not(:last-child)]:border-x-0 rounded-none first:border-r-0 first:rounded-l-md last:border-l-0 last:rounded-r-md',
|
||||
'h-8 gap-1 flex-grow px-3 [&:not(:first-child):not(:last-child)]:border-x-0 rounded-none first:border-r-0 first:rounded-l-md last:border-l-0 last:rounded-r-md',
|
||||
child.props.className
|
||||
)
|
||||
});
|
||||
|
||||
@@ -17,7 +17,7 @@ const Cursor: FC<CursorProps> = ({ width, left, opacity, onTransitionEnd }) => (
|
||||
export type NavProps<T extends Tab> = {
|
||||
tabs: T[];
|
||||
className?: string;
|
||||
active: T;
|
||||
active?: T;
|
||||
onChange?: (tab: T) => void;
|
||||
children?: (tab: T) => ReactNode;
|
||||
};
|
||||
@@ -39,7 +39,7 @@ function Nav<T extends Tab>({ tabs, active, className, children, onChange }: Nav
|
||||
{tabs.map((tab) => {
|
||||
const { title } = tab;
|
||||
|
||||
const isActive = title === active.title;
|
||||
const isActive = title === active?.title;
|
||||
|
||||
return (
|
||||
<li
|
||||
@@ -48,7 +48,7 @@ function Nav<T extends Tab>({ tabs, active, className, children, onChange }: Nav
|
||||
onClick={() => onChange?.(tab)}
|
||||
className={cn('z-10 px-2.5 py-0.5 font-normal text-[15px] leading-[20px] cursor-pointer', {
|
||||
'cursor-default text-secondary': isActive,
|
||||
'mix-blend-difference text-white': !transitionEnded
|
||||
'mix-blend-difference text-white': active && !transitionEnded
|
||||
})}
|
||||
>
|
||||
{children?.(tab) || <div>{title}</div>}
|
||||
|
||||
Reference in new issue
Block a user