list component
This commit is contained in:
parent
d9b359da8d
commit
04af9ef6ef
50
src/shared/ui/List/LinkItem.tsx
Normal file
50
src/shared/ui/List/LinkItem.tsx
Normal file
|
|
@ -0,0 +1,50 @@
|
||||||
|
import { cn } from "@/shared/lib";
|
||||||
|
|
||||||
|
import Button from "@mui/material/Button";
|
||||||
|
import { Link } from "@tanstack/react-router";
|
||||||
|
|
||||||
|
interface LinkItemProps extends React.HTMLAttributes<HTMLLIElement> {
|
||||||
|
children?: React.ReactNode;
|
||||||
|
className?: string;
|
||||||
|
to: string;
|
||||||
|
isSelected?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function LinkItem({
|
||||||
|
children,
|
||||||
|
className,
|
||||||
|
to,
|
||||||
|
isSelected = false,
|
||||||
|
...props
|
||||||
|
}: LinkItemProps) {
|
||||||
|
return (
|
||||||
|
<li className={cn("", className)} {...props}>
|
||||||
|
<Link to={to}>
|
||||||
|
<Button
|
||||||
|
variant={isSelected ? "contained" : "text"}
|
||||||
|
sx={{
|
||||||
|
width: "100%",
|
||||||
|
justifyContent: "start",
|
||||||
|
textTransform: "none",
|
||||||
|
fontWeight: "semibold",
|
||||||
|
color: isSelected ? "white" : "#9B99B0",
|
||||||
|
borderRadius: "6px",
|
||||||
|
boxShadow: "none",
|
||||||
|
paddingInline: "16px",
|
||||||
|
":hover": {
|
||||||
|
boxShadow: "none",
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
className={cn(
|
||||||
|
"bg-neutral mr-2 h-2 w-2 rounded-full",
|
||||||
|
isSelected && "bg-white",
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
<span>{children}</span>
|
||||||
|
</Button>
|
||||||
|
</Link>
|
||||||
|
</li>
|
||||||
|
);
|
||||||
|
}
|
||||||
9
src/shared/ui/List/Root.tsx
Normal file
9
src/shared/ui/List/Root.tsx
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
import { cn } from "@/shared/lib";
|
||||||
|
|
||||||
|
interface RootProps extends React.HTMLAttributes<HTMLUListElement> {
|
||||||
|
className?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function Root({ className, ...props }: RootProps) {
|
||||||
|
return <ul className={cn("", className)} {...props} />;
|
||||||
|
}
|
||||||
4
src/shared/ui/List/index.ts
Normal file
4
src/shared/ui/List/index.ts
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
import Root from "./Root";
|
||||||
|
import LinkItem from "./LinkItem";
|
||||||
|
|
||||||
|
export default { Root, LinkItem };
|
||||||
Loading…
Reference in New Issue
Block a user