Blocks

Stacked List 4

Stacked Lists
Text Align LeftButtonsProgress Bar
Stacked List 4

Code

relume-stacked-list4.tsx
import { Button, type ButtonProps } from "@/components/ui/button";
import {
  DropdownMenu,
  DropdownMenuContent,
  DropdownMenuItem,
  DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
import { MoreHoriz } from "relume-icons";

type ListProps = {
  url: string;
  title: string;
  progress: number;
};

type Props = {
  heading: string;
  description: string;
  buttons: ButtonProps[];
  options: string[];
  lists: ListProps[];
};

export type StackedList4Props = React.ComponentPropsWithoutRef<"section"> & Partial<Props>;

export const StackedList4 = (props: StackedList4Props) => {
  const { heading, description, buttons, options, lists } = {
    ...StackedList4Defaults,
    ...props,
  };

  return (
    <section>
      <div className="pb-5 md:pb-6">
        <div className="grid grid-cols-1 items-end gap-4 md:grid-cols-[1fr_max-content] md:gap-6">
          <div className="max-w-lg">
            <h2 className="text-h5 font-bold">{heading}</h2>
            <p className="mt-2">{description}</p>
          </div>
          <div className="flex items-center justify-between gap-4">
            <div className="flex flex-wrap gap-4">
              {buttons.map((button, index) => (
                <Button key={index} {...button}>
                  {button.title}
                </Button>
              ))}
            </div>
            <DropdownMenu>
              <DropdownMenuTrigger>
                <MoreHoriz className="size-6 text-scheme-text" />
              </DropdownMenuTrigger>
              <DropdownMenuContent>
                {options.map((option, index) => (
                  <DropdownMenuItem key={index}>{option}</DropdownMenuItem>
                ))}
              </DropdownMenuContent>
            </DropdownMenu>
          </div>
        </div>
      </div>

      <div className="border-t border-scheme-border">
        {lists.map((list, index) => (
          <a
            key={index}
            href={list.url}
            className="flex max-w-full flex-col border-b border-scheme-border py-4"
          >
            <div className="flex w-full justify-between">
              <div className="font-semibold">{list.title}</div>
              <div>{list.progress}%</div>
            </div>
            <div className="relative mt-3 h-1 w-full rounded bg-scheme-foreground md:mt-4">
              <div
                className="absolute top-0 left-0 h-full rounded bg-neutral-darkest"
                style={{ width: `${list.progress}%` }}
              />
            </div>
          </a>
        ))}
      </div>
    </section>
  );
};

export const StackedList4Defaults: Props = {
  heading: "Project Progress",
  description:
    "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros.",
  buttons: [
    {
      title: "Button",
      variant: "secondary",
      size: "sm",
    },
    {
      title: "Button",
      size: "sm",
    },
  ],
  options: ["Option One", "Option Two", "Option Three"],
  lists: [
    {
      url: "#",
      title: "Project name",
      progress: 60,
    },
    {
      url: "#",
      title: "Project name",
      progress: 60,
    },
    {
      url: "#",
      title: "Project name",
      progress: 60,
    },
    {
      url: "#",
      title: "Project name",
      progress: 60,
    },
  ],
};

npm i @radix-ui/react-dropdown-menu @radix-ui/react-select @radix-ui/react-slot class-variance-authority@0.7.1 clsx@^2.1.1 relume-icons@1.3.0 tailwind-merge@^2.2.2