Image Frame D

Two pictures layout.

Preview

Cool imageCool image
Cool imageCool image

Code

import React from "react"; import styles from "./image-frame-d.module.css"; type Props = { className?: string; alt: string; imgMainSrc: string; imgBackSrc?: string; horizontalAlign?: "start" | "center" | "end"; rounded?: "none" | "small" | "medium" | "large"; }; export default function ImageFrameD({ className, alt, imgMainSrc, imgBackSrc, horizontalAlign, rounded = "small", }: Props) { return ( <div className={[ className, styles["wrapper"], styles[`ha-${horizontalAlign}`], ].join(" ")} > <figure className={styles["image-wrapper"]}> {/* If you use Next.js, replace 'img' with 'Image' element */} <img className={[styles["image-back"], styles[`r-${rounded}`]].join(" ")} src={imgBackSrc} alt={alt} width={360} height={360} /> <img className={[styles["image-main"], styles[`r-${rounded}`]].join(" ")} src={imgMainSrc} alt={alt} width={360} height={360} /> </figure> </div> ); }

Design

Figma design file:

Documentation

Properties

Props of the component:

  • className (string): Specifies the CSS class of the component.
  • alt (string): Specifies the text that will be used as the alt attribute of the image.
  • imgMainSrc (string): Specifies the URL of the main image.
  • imgBackSrc (string): Specifies the URL of the image at the bottom.
  • horizontalAlign ("start" | "center" | "end"): Specifies the horizontal alignment of the content.
  • rounded ("none" | "small" | "medium" | "large"): Specifies the border radius of the images.