Package align

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

Package align is for making certain content aligned to a direction.

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

Constants for managing the package as a whole.

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

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

	// ParametersComment are the list of comment headers
	// describing inputs.
	ParametersComment = `
{{- /* .Align           = content horizontal alignment             */ -}}
{{- /* .VAlign          = content vertical alignment               */ -}}
{{- /* .Content         = align content in HTML format             */ -}}
{{- /* .ID              = align id attribute (optional)            */ -}}
{{- /* .Class           = align class attribute (optional)         */ -}}
{{- /* .Style           = align style attribute (optional)         */ -}}
`
)

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 = `
<div {{ if .ID -}}id="{{- .ID -}}" {{ end -}}

	class="align {{- if eq .Align "left" }} left

		{{- else if eq .Align "center" }} center

		{{- else if eq .Align "right" }} right

		{{- else }} justify

		{{- end -}}

		{{- if eq .VAlign "top" }} top

		{{- else if eq .VAlign "middle" }} middle

		{{- else if eq .VAlign "bottom" }} bottom

		{{- else if eq .VAlign "stretch" }} stretch

		{{- else }} baseline

		{{- end -}}

		{{- if .Class }} {{ .Class -}}{{- end -}}"

	{{- if .Style }} style="{{- .Style -}}"{{- end -}}
>

	{{- .Content -}}
</div>
`

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

All Bissetii Compressed Compiled CSS

const (
	CSSAMP = `.align{display:flex;width:100%;margin:0;padding:0}.align.left{justify-content:start}.align.center{justify-content:center}.align.right{justify-content:end}.align.justify{justify-content:space-between}.align.top{align-items:flex-start}.align.middle{align-items:center}.align.bottom{align-items:flex-end}.align.stretch{align-items:stretch}.align.baseline{align-items:baseline}`

	CSSCritical = `.align{display:flex;width:100%;margin:0;padding:0}.align.left{justify-content:start}.align.center{justify-content:center}.align.right{justify-content:end}.align.justify{justify-content:space-between}.align.top{align-items:flex-start}.align.middle{align-items:center}.align.bottom{align-items:flex-end}.align.stretch{align-items:stretch}.align.baseline{align-items:baseline}`

	CSSTablet = ``

	CSSDesktop = ``

	CSSWidescreen = ``

	CSSPrint = ``

	CSSVariables = `SASSPLACEHOLDER{--list-position:relative}`

	CSSVariablesAMP = `SASSPLACEHOLDER{--list-position:relative}`
)

Data

type Data struct {
	ID      string
	Class   string
	Style   string
	Content string
}

Data is the data structure for rendering the component.