Package list

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

Package list is for rendering information in an itemized listing.

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 = `ol,ul{position:var(--list-position);padding-left:var(--list-padding-left);margin:var(--list-margin);list-style-type:var(--list-style-type);list-style-position:var(--list-style-position);list-style-image:var(--list-style-image)}ul{--list-style-type:disc}ol{--list-style-type:decimal}`

	CSSCritical = `ol,ul{position:var(--list-position);padding-left:var(--list-padding-left);margin:var(--list-margin);list-style-type:var(--list-style-type);list-style-position:var(--list-style-position);list-style-image:var(--list-style-image)}ul{--list-style-type:disc}ol{--list-style-type:decimal}`

	CSSTablet = ``

	CSSDesktop = ``

	CSSWidescreen = ``

	CSSPrint = `li{break-inside:var(--li-print-break-inside)}`

	CSSVariables    = ``

	CSSVariablesAMP = ``
)

Constants for managing the package as a whole.

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

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

	// ParametersComment are the list of comment headers
	// describing inputs.
	ParametersComment = `
{{- /* .IsOrdered         = List should be ordered (true/false)     */ -}}
{{- /* .ID                = List id attribute (optional)            */ -}}
{{- /* .Class             = List class attribute (optional)         */ -}}
{{- /* .Label             = List aria-label attribute (optional)    */ -}}
{{- /* .Contents          = List of HTML contents (slice)           */ -}}
`
)

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 = `
{{- if .IsOrdered }}
<ol {{- if .ID }}

	id="{{- .ID -}}"
{{- end }}
{{- if .Class }}

	class="{{- .Class -}}"
{{- end }}
{{- if .Label }}

	aria-label="{{- .Label -}}"
{{- end -}}
>

{{- else }}
<ul {{- if .ID }}

	id="{{- .ID -}}"
{{- end }}
{{- if .Class }}

	class="{{- .Class -}}"
{{- end }}
{{- if .Label }}

	aria-label="{{- .Label -}}"
{{- end -}}
>

{{- end }}



{{- range $content := .Contents }}

	<li>{{- $content -}}</li>
{{- end }}



{{- if .IsOrdered }}
</ol>
{{- else }}
</ul>
{{- end }}
`

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

Data

type Data struct {
	ID        string
	Class     string
	Label     string
	Contents  []string
	IsOrdered bool
}

Data is the data structure for rendering the component.