update nav category component

This commit is contained in:
Ajay Bura 2024-04-05 14:34:47 +05:30
parent bd0b38b37a
commit 255f00cfda
3 changed files with 18 additions and 15 deletions

View file

@ -1,9 +1,11 @@
import React, { ReactNode } from 'react'; import React, { ReactNode } from 'react';
import { as } from 'folds';
import classNames from 'classnames';
import * as css from './styles.css'; import * as css from './styles.css';
type NavCategoryProps = { type NavCategoryProps = {
children: ReactNode; children: ReactNode;
}; };
export function NavCategory({ children }: NavCategoryProps) { export const NavCategory = as<'div', NavCategoryProps>(({ className, ...props }, ref) => (
return <div className={css.NavCategory}>{children}</div>; <div className={classNames(css.NavCategory, className)} {...props} ref={ref} />
} ));

View file

@ -1,14 +1,19 @@
import React, { ReactNode } from 'react'; import React, { ReactNode } from 'react';
import { Header } from 'folds'; import classNames from 'classnames';
import { Header, as } from 'folds';
import * as css from './styles.css'; import * as css from './styles.css';
export type NavCategoryHeaderProps = { export type NavCategoryHeaderProps = {
children: ReactNode; children: ReactNode;
}; };
export function NavCategoryHeader({ children }: NavCategoryHeaderProps) { export const NavCategoryHeader = as<'div', NavCategoryHeaderProps>(
return ( ({ className, ...props }, ref) => (
<Header className={css.NavCategoryHeader} variant="Background" size="300"> <Header
{children} className={classNames(css.NavCategoryHeader, className)}
</Header> variant="Background"
); size="300"
} {...props}
ref={ref}
/>
)
);

View file

@ -11,10 +11,6 @@ export const NavCategory = style([
export const NavCategoryHeader = style({ export const NavCategoryHeader = style({
paddingLeft: config.space.S200, paddingLeft: config.space.S200,
position: 'sticky',
top: 0,
zIndex: 1,
gap: config.space.S100, gap: config.space.S100,
}); });