package components import "github.com/tigorlazuardi/redmage/models" import "fmt" import "time" type ImageCardOption uint func (o ImageCardOption) Has(opt ImageCardOption) bool { return o&opt != 0 } func (o ImageCardOption) SetCond(opt ImageCardOption, cond bool) ImageCardOption { if cond { return o | opt } return o } const ( HideNothing ImageCardOption = 0 HideTitle ImageCardOption = 1 << iota HideSubreddit HidePoster HideDevice ) templ ImageCard(data *models.Image, opts ImageCardOption) {
{ fmt.Sprintf("%d \u00d7 %d", data.ImageWidth, data.ImageHeight) } px
{ formatByteSize(data.ImageSize) }