diff --git a/lib/foundations/badge.tsx b/lib/foundations/badge.tsx new file mode 100644 index 000000000..9efd70f11 --- /dev/null +++ b/lib/foundations/badge.tsx @@ -0,0 +1,36 @@ +import { cva, type VariantProps } from "class-variance-authority" +import * as React from "react" + +import { cn } from "@/lib/utils" + +const badgeVariants = cva( + "inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2", + { + variants: { + variant: { + default: + "border-transparent bg-primary text-primary-foreground hover:bg-primary/80", + secondary: + "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80", + destructive: + "border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80", + outline: "text-foreground", + }, + }, + defaultVariants: { + variant: "default", + }, + } +) + +export interface BadgeProps + extends React.HTMLAttributes, + VariantProps {} + +function Badge({ className, variant, ...props }: BadgeProps) { + return ( +
+ ) +} + +export { Badge, badgeVariants } diff --git a/lib/styles.css b/lib/styles.css index ba37b6ec6..6402984c5 100644 --- a/lib/styles.css +++ b/lib/styles.css @@ -42,6 +42,10 @@ --ring: 172 42% 52%; --radius: 0.5rem; + + --layout: 357 100% 96%; + --layout-intermediate: 356 77% 75%; + --layout-foreground: 342 100% 42%; } .dark { @@ -81,6 +85,10 @@ --input: 230 5% 24%; --input-hover: 235 5% 39%; --ring: 173 62% 31%; + + --layout: 352 59% 15%; + --layout-intermediate: 351 56% 48%; + --layout-foreground: 352 100% 75%; } } diff --git a/src/experiments/application/new/employees.tsx b/src/experiments/application/new/employees.tsx index b24df7f12..7fcebbfae 100644 --- a/src/experiments/application/new/employees.tsx +++ b/src/experiments/application/new/employees.tsx @@ -1,5 +1,10 @@ import { useLayoutType } from "./layout-type" +import { cn } from "@/lib/utils" +import { useState } from "react" + +import { Badge } from "@/foundations/badge" + import { Avatar, AvatarFallback, AvatarImage } from "@/foundations/avatar" import { Table, @@ -78,7 +83,8 @@ export const Employees = [ ] export const PageEmployees: React.FC = () => { - const { setLayoutType } = useLayoutType() + const { setLayoutType, setEmployeeId } = useLayoutType() + const [activeEmployee, setActiveEmployee] = useState(-1) return (
@@ -95,8 +101,15 @@ export const PageEmployees: React.FC = () => { {Employees.map((employee, index) => ( setLayoutType!("Split")} + className={cn( + "hover:cursor-pointer", + activeEmployee === index ? "bg-accent" : "" + )} + onClick={() => { + setLayoutType!("Split") + setActiveEmployee(index) + setEmployeeId?.(index) + }} >
@@ -111,7 +124,9 @@ export const PageEmployees: React.FC = () => { {employee.lastName} {employee.job} - {employee.status} + + {employee.status} + ))} diff --git a/src/experiments/application/new/index.tsx b/src/experiments/application/new/index.tsx index b5cf7c04a..665870fba 100644 --- a/src/experiments/application/new/index.tsx +++ b/src/experiments/application/new/index.tsx @@ -8,6 +8,8 @@ import { Avatar, AvatarFallback, AvatarImage } from "@/foundations/avatar" import { Skeleton } from "@/foundations/skeleton" +import { Employees } from "./employees" + import { Tooltip, TooltipContent, @@ -31,8 +33,8 @@ const Navigation: React.FC<{ className={cn( "relative flex h-12 w-12 items-center justify-center rounded-2xl text-secondary-foreground transition-colors hover:cursor-pointer", activeItem.title === item.title - ? "bg-primary-intermediate/20 text-primary-foreground" - : "hover:bg-card/50" + ? "bg-layout-intermediate/20 text-layout-foreground" + : "hover:bg-layout-intermediate/10" )} key={item.title} onClick={() => { @@ -79,18 +81,21 @@ const Layout = () => { } const [layoutType, setLayoutType] = useState("Regular") + const [employeeId, setEmployeeId] = useState(0) if (!activeItem) return null return ( - +
@@ -106,7 +111,9 @@ const Layout = () => {
{hasSubItems(activeItem) && ( @@ -120,8 +127,8 @@ const Layout = () => { className={cn( "flex h-10 items-center rounded-xl px-4 py-2 text-secondary-foreground transition-colors hover:cursor-pointer", subItem === activeSubItem - ? "bg-primary-intermediate/20 text-primary-foreground" - : "hover:bg-primary-intermediate/10" + ? "bg-layout-intermediate/20 text-layout-foreground" + : "hover:bg-layout-intermediate/10" )} key={subItem.title} onClick={() => { @@ -137,7 +144,7 @@ const Layout = () => { )}
- Title + {activeSubItem?.title || activeItem?.title}
{activeSubItem?.component || activeItem?.component} @@ -155,21 +162,26 @@ const Layout = () => {
- - AM + + + {Employees[employeeId].avatarFallback} +

- Arthur McCoy + {Employees[employeeId].firstName}{" "} + {Employees[employeeId].lastName}

- Sales Development Representative + {Employees[employeeId].job}

- {Array.from({ length: 10 }, (_, index) => ( + {Array.from({ length: 30 }, (_, index) => ( > | null + employeeId: number + setEmployeeId: Dispatch> | null } export const LayoutTypeContext = createContext({ layoutType: "Regular", setLayoutType: null, + employeeId: 0, + setEmployeeId: null, }) export function useLayoutType(): LayoutTypeContextProps { diff --git a/tailwind.config.ts b/tailwind.config.ts index f2321c309..77615e546 100644 --- a/tailwind.config.ts +++ b/tailwind.config.ts @@ -65,6 +65,11 @@ export default { DEFAULT: "hsl(var(--card))", foreground: "hsl(var(--card-foreground))", }, + layout: { + DEFAULT: "hsl(var(--layout))", + foreground: "hsl(var(--layout-foreground))", + intermediate: "hsl(var(--layout-intermediate))", + }, }, borderRadius: { lg: "var(--radius)",