Hero
gymnopedies/heroFreeComponent
Hero — gymnopédies blog reading primitive.
Install it
npx shadcn@latest add https://gymnopedies.shoota.work/r/hero.jsonSource
1import * as React from "react"23import { cn } from "@/lib/utils"45export type HeroSize = "sm" | "md" | "lg"67type HeroSizeConfig = {8 container: string9 title: string10}1112const sizeConfig: Record<HeroSize, HeroSizeConfig> = {13 sm: {14 container: "w-[60vw] max-w-[800px]",15 title: "text-[clamp(4px,4vw,4.5rem)]",16 },17 md: {18 container: "w-[75vw] max-w-[1000px]",19 title: "text-[clamp(4px,5vw,4.5rem)]",20 },21 lg: {22 container: "w-[90vw] max-w-[1200px]",23 title: "text-[clamp(4px,6vw,4.5rem)]",24 },25}2627export type HeroProps = {28 cover: string29 coverTop?: number30 size?: HeroSize31 imgProps: React.ImgHTMLAttributes<HTMLImageElement>32 className?: string33}3435export function Hero({36 cover,37 coverTop = 50,38 size = "md",39 imgProps,40 className,41}: HeroProps) {42 const { container, title } = sizeConfig[size]43 const { className: imgClassName, ...restImgProps } = imgProps4445 return (46 <div className={cn("flex w-full items-center justify-center", className)}>47 <div48 className={cn(49 "relative flex items-center justify-center",50 container51 )}52 >53 <div className="w-full">54 <img55 {...restImgProps}56 className={cn(57 "block w-full object-cover object-center opacity-60 grayscale animate-lighting",58 imgClassName59 )}60 />61 </div>62 <h163 className={cn(64 "absolute left-1/2 inline-block w-full -translate-x-1/2 -translate-y-1/2 text-center bg-[rgba(4,37,43,0.45)]",65 title66 )}67 style={{ top: `${coverTop}%` }}68 >69 {cover}70 </h1>71 </div>72 </div>73 )74}
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 |
