Blocks

Gallery 1

standard
1 ColumnText Align CenterImage LightboxGallery Section
Gallery 1

Code

relume-gallery1.tsx
type ImageProps = {
  url?: string;
  src: string;
  alt?: string;
};

type Props = {
  heading: string;
  description: string;
  images: ImageProps[];
};

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

export const Gallery1 = (props: Gallery1Props) => {
  const { heading, description, images } = {
    ...Gallery1Defaults,
    ...props,
  };
  return (
    <section className="px-[5%] py-16 md:py-24 lg:py-28">
      <div className="container flex flex-col items-center text-center">
        <div className="mb-12 md:mb-18 lg:mb-20">
          <div className="mx-auto w-full max-w-lg">
            <h2 className="mb-5 text-h2 font-bold md:mb-6">{heading}</h2>
            <p className="text-medium">{description}</p>
          </div>
        </div>
        <div className="grid auto-cols-fr grid-cols-1 gap-8">
          {images.map((image, index) => (
            <a key={index} href={image.url} className="size-full">
              <div className="w-full overflow-hidden">
                <img
                  src={image.src}
                  alt={image.alt}
                  className="aspect-video size-full rounded-image object-cover"
                />
              </div>
            </a>
          ))}
        </div>
      </div>
    </section>
  );
};

export const Gallery1Defaults: Props = {
  heading: "Image Gallery",
  description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
  images: [
    {
      url: "#",
      src: "https://d22po4pjz3o32e.cloudfront.net/placeholder-image.svg",
      alt: "Relume placeholder image 1",
    },
  ],
};

npm i @radix-ui/react-checkbox @radix-ui/react-dialog @radix-ui/react-label @radix-ui/react-radio-group @radix-ui/react-select @radix-ui/react-slot class-variance-authority@0.7.1 clsx@^2.1.1 motion@^12.15.0 relume-icons@1.3.0 tailwind-merge@^2.2.2