{
  "$schema": "https://registry.buildy.tw/schema/registry-item.json",
  "dependencies": [],
  "description": "A product as a card: picture, optional badge, category, name, rating, summary, price (and the old price struck through when `compareAt` is higher) and an add button. Axes: layout (vertical, horizontal), media (image, none), ratio, rating (show, hide), action (button, none), densi",
  "devDependencies": [],
  "digest": "0.1.0",
  "files": [
    {
      "content": "// Code generated by packages/kit-compose/src/server-organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.\n// Source: packages/compose-gen/specs/organisms/product-card.json\n\npackage blocks\n\nimport (\n\t\"github.com/ui8kit/codegen/generated/templ/ui/box\"\n\t\"github.com/ui8kit/codegen/generated/templ/ui/button\"\n\t\"github.com/ui8kit/codegen/generated/templ/compose\"\n\t\"github.com/ui8kit/codegen/generated/templ/ui/link\"\n\t\"github.com/ui8kit/codegen/generated/templ/ui/text\"\n\tuiutils \"github.com/ui8kit/codegen/generated/templ/orgutils\"\n)\n\n// ProductCardProps are the props of ProductCard; the values are the JSON shapes of the TypeScript props.\ntype ProductCardProps struct {\n\tProduct any `json:\"product\"`\n\tLabels any `json:\"labels\"`\n\tBadges any `json:\"badges\"`\n\tLayout any `json:\"layout\"`\n\tMedia any `json:\"media\"`\n\tRatio any `json:\"ratio\"`\n\tRating any `json:\"rating\"`\n\tAction any `json:\"action\"`\n\tDensity any `json:\"density\"`\n}\n\n// A product as a card: picture, optional badge, category, name, rating, summary, price (and the old price struck through when `compareAt` is higher) and an add button. Axes: layout (vertical, horizontal), media (image, none), ratio, rating (show, hide), action (button, none), density.\ntempl ProductCard(p ProductCardProps) {\n\t{{ vProduct := p.Product }}\n\t{{ vLabels := p.Labels }}\n\t{{ vBadges := p.Badges }}\n\t{{ vLayout := uiutils.Def(p.Layout, \"vertical\") }}\n\t{{ vMedia := uiutils.Def(p.Media, \"image\") }}\n\t{{ vRatio := uiutils.Def(p.Ratio, \"4/3\") }}\n\t{{ vRating := uiutils.Def(p.Rating, \"show\") }}\n\t{{ vAction := uiutils.Def(p.Action, \"button\") }}\n\t{{ vDensity := uiutils.Def(p.Density, \"default\") }}\n\t@compose.Block(compose.BlockProps{BoxProps: box.BoxProps{Tag: \"article\", Class: uiutils.S(uiutils.Cnv(\"flex flex-col gap-8 bg-card p-6 text-card-foreground inset-ring inset-ring-border rounded\", \"h-full gap-4 overflow-hidden\", uiutils.Cond(uiutils.T(uiutils.Eq(vLayout, \"horizontal\")), \"flex flex-col sm:flex-row\", \"flex flex-col\"))), Attrs: uiutils.Attrs(\"data-slot\", \"card\", \"data-layout\", vLayout)}}) {\n\t\tif uiutils.Eq(vMedia, \"image\") {\n\t\t\t@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: uiutils.S(uiutils.Cnv(\"relative shrink-0\", uiutils.Cond(uiutils.T(uiutils.Eq(vLayout, \"horizontal\")), \"sm:w-48\", \"\")))}}) {\n\t\t\t\t@MediaFrame(MediaFrameProps{Alt: uiutils.Get(vProduct, \"name\"), Src: uiutils.Get(vProduct, \"image\"), Ratio: vRatio, Class: uiutils.Cnv(\"h-full\")})\n\t\t\t\tif uiutils.T(uiutils.Get(vProduct, \"badge\")) {\n\t\t\t\t\t@compose.Badge(compose.BadgeProps{Variant: \"default\", Size: \"default\", TextProps: text.TextProps{Class: \"absolute left-4 top-4\"}}) {\n\t\t\t\t\t\t{ uiutils.Text(uiutils.At(vBadges, uiutils.Get(vProduct, \"badge\"))) }\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t@compose.CardContent(compose.CardContentProps{BoxProps: box.BoxProps{Class: \"flex flex-1 flex-col gap-2\"}}) {\n\t\t\t@compose.Text(compose.TextProps{Size: \"xs\", TextProps: text.TextProps{Class: \"uppercase tracking-wide text-muted-foreground\"}}) {\n\t\t\t\t{ uiutils.Text(uiutils.Get(vProduct, \"category\")) }\n\t\t\t}\n\t\t\t@compose.Title(compose.TitleProps{As: \"3\", Size: \"base\", Weight: \"bold\", TextProps: text.TextProps{}}) {\n\t\t\t\tif uiutils.T(uiutils.Get(vProduct, \"href\")) {\n\t\t\t\t\t@compose.Link(compose.LinkProps{Variant: \"default\", LinkProps: link.LinkProps{Href: uiutils.URL(uiutils.Get(vProduct, \"href\"), false), Attrs: uiutils.Attrs(\"data-slot\", \"open\")}}) {\n\t\t\t\t\t\t{ uiutils.Text(uiutils.Get(vProduct, \"name\")) }\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t{ uiutils.Text(uiutils.Get(vProduct, \"name\")) }\n\t\t\t\t}\n\t\t\t}\n\t\t\tif uiutils.Eq(vRating, \"show\") {\n\t\t\t\t@compose.Group(compose.GroupProps{Gap: \"2\", BoxProps: box.BoxProps{}}) {\n\t\t\t\t\t@Rating(RatingProps{Value: uiutils.Get(vProduct, \"rating\"), Label: uiutils.Tpl(uiutils.Get(vLabels, \"ratingLabel\"), uiutils.Get(vProduct, \"rating\"))})\n\t\t\t\t\t@compose.Text(compose.TextProps{Size: \"xs\", TextProps: text.TextProps{Class: \"text-muted-foreground\"}}) {\n\t\t\t\t\t\t{ uiutils.Text(uiutils.Tpl(uiutils.Get(vLabels, \"reviews\"), uiutils.Get(vProduct, \"reviews\"))) }\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif uiutils.Eq(vDensity, \"default\") {\n\t\t\t\t@compose.Text(compose.TextProps{Size: \"sm\", TextProps: text.TextProps{Class: \"text-muted-foreground\"}}) {\n\t\t\t\t\t{ uiutils.Text(uiutils.Get(vProduct, \"summary\")) }\n\t\t\t\t}\n\t\t\t}\n\t\t\t@compose.Group(compose.GroupProps{Gap: \"4\", Justify: \"between\", BoxProps: box.BoxProps{Class: \"mt-auto pt-2\"}}) {\n\t\t\t\t@compose.Group(compose.GroupProps{Gap: \"2\", Align: \"baseline\", BoxProps: box.BoxProps{Class: \"flex-wrap\"}}) {\n\t\t\t\t\t@compose.Text(compose.TextProps{Size: \"xl\", Weight: \"bold\", TextProps: text.TextProps{}}) {\n\t\t\t\t\t\t{ uiutils.Text(uiutils.Money(uiutils.Get(vProduct, \"price\"), uiutils.Get(vProduct, \"currency\"))) }\n\t\t\t\t\t}\n\t\t\t\t\tif uiutils.T(uiutils.And(uiutils.Get(vProduct, \"compareAt\"), uiutils.Gt(uiutils.Get(vProduct, \"compareAt\"), uiutils.Get(vProduct, \"price\")))) {\n\t\t\t\t\t\t@compose.Text(compose.TextProps{Size: \"sm\", TextProps: text.TextProps{Tag: \"del\", Class: \"relative text-muted-foreground\", Attrs: uiutils.Attrs(\"data-slot\", \"compare-at\")}}) {\n\t\t\t\t\t\t\t@compose.Inline(compose.InlineProps{TextProps: text.TextProps{Class: \"sr-only\"}}) {\n\t\t\t\t\t\t\t\t{ uiutils.Text(uiutils.Get(vLabels, \"was\")) }\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t{ uiutils.Text(uiutils.Money(uiutils.Get(vProduct, \"compareAt\"), uiutils.Get(vProduct, \"currency\"))) }\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif uiutils.Eq(vAction, \"button\") {\n\t\t\t\t\t@compose.Button(compose.ButtonProps{Variant: uiutils.S(uiutils.Cond(uiutils.T(uiutils.Get(vProduct, \"inStock\")), \"default\", \"outline\")), Size: \"sm\", ButtonProps: button.ButtonProps{Disabled: uiutils.T(!uiutils.T(uiutils.Get(vProduct, \"inStock\")))}}) {\n\t\t\t\t\t\t{ uiutils.Text(uiutils.Cond(uiutils.T(uiutils.Get(vProduct, \"inStock\")), uiutils.Get(vLabels, \"add\"), uiutils.Get(vLabels, \"soldOut\"))) }\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n",
      "path": "blocks/product-card.templ",
      "target": "blocks/product-card.templ"
    }
  ],
  "meta": {
    "category": "general",
    "kind": "block",
    "tags": [
      "templ",
      "block"
    ]
  },
  "name": "product-card",
  "registryDependencies": [
    "badge",
    "block",
    "box",
    "button",
    "card-content",
    "group",
    "inline",
    "kit-box",
    "kit-button",
    "kit-link",
    "kit-text",
    "link",
    "media-frame",
    "rating",
    "text",
    "title",
    "utils"
  ],
  "runtime": "templ",
  "title": "Product Card",
  "type": "registry:block"
}
