Picture
gymnopedies/pictureFreeComponent
Picture — gymnopédies blog reading primitive.
Install it
npx shadcn@latest add https://gymnopedies.shoota.work/r/picture.jsonSource
1import * as React from "react"23import { cn } from "@/lib/utils"45type PictureProps = React.HTMLAttributes<HTMLElement> & {6 children?: React.ReactNode7}89function PictureRoot({ className, children, ...props }: PictureProps) {10 return (11 <figure12 className={cn(13 "relative overflow-hidden rounded-md bg-muted [&_img]:rounded-md",14 className15 )}16 {...props}17 >18 {children}19 </figure>20 )21}2223type PictureImageProps = React.ImgHTMLAttributes<HTMLImageElement> & {24 objectPosition?: React.CSSProperties["objectPosition"]25 transition?: boolean26}2728function PictureImage({29 className,30 objectPosition,31 transition = false,32 style,33 ...props34}: PictureImageProps) {35 return (36 <img37 {...props}38 style={{ objectPosition, ...style }}39 className={cn(40 "block w-full object-cover opacity-60 grayscale transition-opacity duration-700",41 transition &&42 "hover:opacity-100 hover:grayscale-[60%] hover:duration-1000 focus:opacity-100 focus:grayscale-[60%] focus:duration-1000",43 className44 )}45 />46 )47}4849type PictureCaptionProps = React.HTMLAttributes<HTMLElement>5051function PictureCaption({52 className,53 children,54 ...props55}: PictureCaptionProps) {56 return (57 <figcaption58 className={cn(59 "absolute bottom-0 right-0 h-6 px-1.5 text-xs font-bold leading-6 text-accent bg-[rgba(4,37,43,0.6)]",60 className61 )}62 {...props}63 >64 {children}65 </figcaption>66 )67}6869export const Picture = Object.assign(PictureRoot, {70 Image: PictureImage,71 Caption: PictureCaption,72})7374export { PictureImage, PictureCaption }75export type { PictureProps, PictureImageProps, PictureCaptionProps }
What it pulls in
Other registry items
Files it writes
More from gymnopedies
All 49 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | gymnopedies | Components | Free | 2 deps | |
| Alertalert | gymnopedies | Components | Free | 1 dep | |
| Alert Dialogalert-dialog | gymnopedies | Components | Free | 1 dep | |
| Articlearticle | gymnopedies | Components | Free | no deps | |
| Aspect Ratioaspect-ratio | gymnopedies | Components | Free | no deps | |
| Avataravatar | gymnopedies | Components | Free | 1 dep | |
| Badgebadge | gymnopedies | Components | Free | 2 deps | |
| Breadcrumbbreadcrumb | gymnopedies | Components | Free | 2 deps |
