// templui component card - version: main installed by templui v0.71.0 package card import ( "git.jmbit.de/jmb/scanfile/server/web/templui/components/aspectratio" "git.jmbit.de/jmb/scanfile/server/web/templui/utils" ) type MediaPosition string type MediaWidth string const ( MediaPositionTop MediaPosition = "top" MediaPositionBottom MediaPosition = "bottom" MediaPositionLeft MediaPosition = "left" MediaPositionRight MediaPosition = "right" ) const ( MediaWidthAuto MediaWidth = "auto" MediaWidthFull MediaWidth = "full" MediaWidthHalf MediaWidth = "half" MediaWidthThird MediaWidth = "third" MediaWidthQuarter MediaWidth = "quarter" MediaWidthTwoThirds MediaWidth = "two-thirds" MediaWidthThreeQuarters MediaWidth = "three-quarters" ) type Props struct { ID string Class string Attributes templ.Attributes } type HeaderProps struct { ID string Class string Attributes templ.Attributes } type TitleProps struct { ID string Class string Attributes templ.Attributes } type DescriptionProps struct { ID string Class string Attributes templ.Attributes } type ContentProps struct { ID string Class string Attributes templ.Attributes } type FooterProps struct { ID string Class string Attributes templ.Attributes } type HorizontalProps struct { ID string Class string Attributes templ.Attributes } type MediaProps struct { ID string Class string Attributes templ.Attributes Src string Alt string Position MediaPosition Width MediaWidth AspectRatio aspectratio.Ratio } templ Card(props ...Props) { {{ var p Props }} if len(props) > 0 { {{ p = props[0] }} }
{ children... }
} templ Header(props ...HeaderProps) { {{ var p HeaderProps }} if len(props) > 0 { {{ p = props[0] }} }
{ children... }
} templ Title(props ...TitleProps) { {{ var p TitleProps }} if len(props) > 0 { {{ p = props[0] }} }

{ children... }

} templ Description(props ...DescriptionProps) { {{ var p DescriptionProps }} if len(props) > 0 { {{ p = props[0] }} }

{ children... }

} templ Content(props ...ContentProps) { {{ var p ContentProps }} if len(props) > 0 { {{ p = props[0] }} }
{ children... }
} templ Footer(props ...FooterProps) { {{ var p FooterProps }} if len(props) > 0 { {{ p = props[0] }} }
{ children... }
} templ Horizontal(props ...HorizontalProps) { {{ var p HorizontalProps }} if len(props) > 0 { {{ p = props[0] }} }
{ children... }
} templ Media(props ...MediaProps) { {{ var p MediaProps }} if len(props) > 0 { {{ p = props[0] }} }
@aspectratio.AspectRatio(aspectratio.Props{ ID: p.ID + "-aspect", Ratio: p.AspectRatio, Class: "h-full w-full", }) { { }
} func mediaPositionClasses(position MediaPosition, width MediaWidth) string { var positionClass string switch position { case MediaPositionTop: return "w-full rounded-t-lg" case MediaPositionBottom: return "w-full rounded-b-lg" case MediaPositionLeft: positionClass = "shrink-0 rounded-l-lg" case MediaPositionRight: positionClass = "shrink-0 rounded-r-lg" default: positionClass = "" } if position == MediaPositionLeft || position == MediaPositionRight { return positionClass + " " + widthClass(width) } return positionClass } func widthClass(width MediaWidth) string { switch width { case MediaWidthFull: return "w-full" case MediaWidthHalf: return "w-1/2" case MediaWidthThird: return "w-1/3" case MediaWidthQuarter: return "w-1/4" case MediaWidthTwoThirds: return "w-2/3" case MediaWidthThreeQuarters: return "w-3/4" default: return "w-1/3" } }