Package navcatalog

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

Package navcatalog is for rendering catalog style navigation list.

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 = `.nav-catalog{padding:var(--nav-catalog-padding);--margin-list: 0;--padding-left-list: 0}.nav-catalog .Card{margin-left:auto;margin-right:auto}`

	CSSCritical = `.nav-catalog{padding:var(--nav-catalog-padding);--margin-list: 0;--padding-left-list: 0}.nav-catalog .Card{margin-left:auto;margin-right:auto}`

	CSSTablet     = ``

	CSSDesktop    = ``

	CSSWidescreen = ``

	CSSPrint      = ``
)

Constants for managing the package as a whole.

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

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

	// ParametersComment are the list of comment headers
	// describing inputs.
	ParametersComment = `
{{- /* .Class                 = Catalog class attribute                */ -}}
{{- /* .ID                    = Catalog id attribute                   */ -}}
{{- /* .Label                 = Catalog name used in aria-label        */ -}}
{{- /* .Deck                  = Catalog .Card deck (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 = `
{{- define "` + anchor.Name + `" -}}` + anchor.HTML + `{{- end -}}
{{- define "` + image.Name + `" -}}` + image.HTML + `{{- end -}}
{{- define "` + card.Name + `" -}}` + card.HTML + `{{- end -}}
`

	// DepAMPHTML is the Accelerated Mobile Pages HTML output
	// type.
	DepAMPHTML = `
{{- define "` + anchor.AMPName + `" -}}` + anchor.AMPHTML + `{{- end -}}
{{- define "` + image.AMPName + `" -}}` + image.AMPHTML + `{{- end -}}
{{- define "` + card.AMPName + `" -}}` + card.AMPHTML + `{{- end -}}
`
)

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

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

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

	aria-label="{{- .Label -}}"
{{- end -}}
><ol class="row">

	{{- range $card := .Deck }}

	<li class="column">{{- template "` + card.Name + `" $card -}}</li>

	{{- end }}
</ol></nav>
`

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

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

	aria-label="{{- .Label -}}"
{{- end -}}
><ol class="grid">

	{{- range $card := .Deck }}

	<li>{{- template "` + card.AMPName + `" $card -}}</li>

	{{- end }}
</ol></nav>
`
)

Data

type Data card.Data

Data is the data structure for rendering the component.