Package card

import "gitlab.com/zoralab/bissetii/pkg/components/internal/card"

Package card is for rendering the information in various card styling.

The HTML template codes are written in Go’s string format under the corresponding group. This allows one to embed the HTML codes instead of parsing it from file.

Constants

All Bissetii Compressed Compiled CSS

const (
	CSSAMP          = ``

	CSSCritical     = ``

	CSSTablet       = ``

	CSSDesktop      = ``

	CSSWidescreen   = ``

	CSSPrint        = ``

	CSSVariables    = ``

	CSSVariablesAMP = ``
)

Constants for managing the package as a whole.

const (
	// Name is the block name (`{{- define "this-name" -}}`).
	Name = "card"

	// AMPName is the AMP HTML block name.
	AMPName = internal.AMPPrefix + Name

	// ParametersComment are the list of comment headers
	// describing inputs.
	ParametersComment = `
{{- /* .Type              = Card type facilitated by Bissetii       */ -}}
{{- /* .Class             = Card class attribute                    */ -}}
{{- /* .Style             = Card style attribute                    */ -}}
{{- /* .ID                = Card id attribute                       */ -}}
{{- /* .Width             = Card width                              */ -}}
{{- /* .Height            = Card height                             */ -}}
{{- /* .Label             = Card name (used in aria-label)          */ -}}
{{- /* .Content           = Card content                            */ -}}
{{- /* .Thumbnail         = Card thumbnail image                    */ -}}
{{- /* .CTA               = Card List of call to action links       */ -}}
`
)

Dependencies are the dependent codes for building independent template.

This is useful for rendering portable template usage like Hugo partials where they do not share a common definition source.

const (
	// DepHTML is the vanilla HTML output type.
	DepHTML = ``

	// DepAMPHTML is the Accelerated Mobile Pages HTML output
	// type.
	DepAMPHTML = ``
)

Full HTML codes for rendering templates without needing to parse file.

const (
	// HTML is the vanilla HTML output type.
	HTML = `
<article class="Card {{ .Type -}}{{- if .Class }} {{ .Class -}}{{- end -}}"
{{- if .ID }}

	id="{{- .ID -}}"
{{- end }}
{{- if or .Width .Height }}

	style=" {{- if .Width -}}--card-width: {{ .Width -}};{{- end }}

		{{- if .Height }}--card-height: {{ .Height -}};{{- end }}

		{{- if .Style }} {{ .Style -}}{{- end -}}

	"
{{- end -}}
>

	{{- if .Thumbnail }}

	<div class="thumbnail">{{ .Thumbnail }}</div>

	{{- end }}

	{{- if .Content }}

	<div class="content">{{- .Content -}}</div>

	{{- end }}

	{{- if .CTA }}

	<div class="cta">{{- .CTA -}}</div>

	{{- end }}
</article>
`

	// AMPHTML is the Accelerated Mobile Pages HTML output type.
	AMPHTML = `
<article class="Card {{ .Type -}}{{- if .Class }} {{ .Class -}}{{- end -}}"
{{- if .ID }}

	id="{{- .ID -}}"
{{- end }}
{{- if or .Width .Height }}

	style="{{- if .Width -}}--card-width: {{ .Width -}};{{- end }}

		{{- if .Height }}--card-height: {{ .Height -}};{{- end }}

		{{- if .Style }} {{ .Style -}}{{- end -}}

	"
{{- end -}}
>

	{{- if .Thumbnail }}

	<div class="thumbnail">{{ .Thumbnail }}</div>

	{{- end }}

	{{- if .Content }}

	<div class="content">{{- .Content -}}</div>

	{{- end }}

	{{- if .CTA }}

	<div class="cta">{{- .CTA -}}</div>

	{{- end }}
</article>
`
)

Data

type Data struct {
	Type      string
	Class     string
	ID        string
	Width     string
	Height    string
	Content   string
	Thumbnail string
	CTA       string
}

Data is the data structure for rendering the component.