Package shieldsbadge

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

Package shieldbadge is the full package for rendering all compatible shield badges.

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 = `dl.shields-badge{display:inline-flex;flex-wrap:nowrap;width:fit-content;--dt-margin:0;--dd-margin:0;border:var(--shieldsbadge-border);border-radius:var(--shieldsbadge-border-radius);margin:var(--shieldsbadge-margin);--dl-padding:var(--shieldsbadge-padding)}dl.shields-badge dt{flex-basis:auto;min-width:var(--shieldsbadge-dt-min-width);padding:var(--shieldsbadge-dt-padding);font-size:var(--shieldsbadge-dt-font-size);font-weight:var(--shieldsbadge-dt-font-weight);color:var(--shieldsbadge-dt-color);background:var(--shieldsbadge-dt-background)}dl.shields-badge dd{flex-basis:auto;white-space:var(--shieldsbadge-dd-white-space);padding:var(--shieldsbadge-dd-padding);font-size:var(--shieldsbadge-dd-font-size);font-weight:var(--shieldsbadge-dd-font-weight);color:var(--shieldsbadge-dd-color);background:var(--shieldsbadge-dd-background)}dl.shields-badge dd:before{content:none}`

	CSSCritical = `dl.shields-badge{display:inline-flex;flex-wrap:nowrap;width:fit-content;--dt-margin:0;--dd-margin:0;border:var(--shieldsbadge-border);border-radius:var(--shieldsbadge-border-radius);margin:var(--shieldsbadge-margin);--dl-padding:var(--shieldsbadge-padding)}dl.shields-badge dt{flex-basis:auto;min-width:var(--shieldsbadge-dt-min-width);padding:var(--shieldsbadge-dt-padding);font-size:var(--shieldsbadge-dt-font-size);font-weight:var(--shieldsbadge-dt-font-weight);color:var(--shieldsbadge-dt-color);background:var(--shieldsbadge-dt-background)}dl.shields-badge dd{flex-basis:auto;white-space:var(--shieldsbadge-dd-white-space);padding:var(--shieldsbadge-dd-padding);font-size:var(--shieldsbadge-dd-font-size);font-weight:var(--shieldsbadge-dd-font-weight);color:var(--shieldsbadge-dd-color);background:var(--shieldsbadge-dd-background)}dl.shields-badge dd:before{content:none}`

	CSSTablet = ``

	CSSDesktop = ``

	CSSWidescreen = ``

	CSSPrint = `dl.shields-badge,dl.shields-badge dd,dl.shields-badge dt{break-inside:avoid}`

	CSSVariables    = ``

	CSSVariablesAMP = ``
)

Constants for managing the package as a whole.

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

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

	// ParametersComment are the list of comment headers
	// describing inputs.
	ParametersComment = `
{{- /* .Label                         = badge label                     */ -}}
{{- /* .Content                       = badge value content             */ -}}
{{- /* .Text.Color                    = hex value for text color        */ -}}
{{- /* .Color                         = hex value for background color  */ -}}
`
)

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 = `
<dl class="shields-badge" {{- if (or .Color .Text.Color) }} style="

	{{- if .Color }}--shieldsbadge-dd-background: {{ .Color -}};{{- end -}}

	{{- if .Text.Color }}--shieldsbadge-dd-color: {{ .Text.Color -}};{{- end -}}
"{{- end -}}>

	<dt>{{- .Label -}}</dt>

	<dd>{{ .Content -}}</dd>
</dl>
`

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

Data

type Data struct {
	Label   string
	Content string
	Text    *TextFormat
	Color   string
}

Data is the data structure for rendering the component.

TextFormat

type TextFormat struct {
	Color string
}

TextFormat is the value’s text formatting data for Data structure.