Package note

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

Package note is the full package for rendering all compatible note banners.

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 = `.note{background-color:var(--background-color-note);padding:var(--padding-note);margin:var(--margin-note);border-radius:var(--border-radius-note);border-top:var(--border-top-note)}.note .icon{display:var(--display-note-icon);max-width:var(--max-width-note-icon);max-height:var(--max-height-note-icon);vertical-align:var(--vertical-align-note-icon)}.note .title{display:var(--display-note-title);font-weight:var(--font-weight-note-title);vertical-align:var(--vertical-align-note-title);color:var(--color-note-title);margin:var(--margin-note-title)}.note .content{display:var(--display-note-content);text-align:var(--text-align-note-content)}.note.success{--background-color-note:var(--color-green-100);--border-top-note:0.4rem solid var(--color-green-700);--color-note-title:var(--color-green-700)}.note.warning{--background-color-note:var(--color-yellow-100);--border-top-note:0.4rem solid var(--color-yellow-700);--color-note-title:var(--color-yellow-700)}.note.error{--background-color-note:var(--color-red-100);--border-top-note:0.4rem solid var(--color-red-700);--color-note-title:var(--color-red-700)}`

	CSSCritical = `.note{background-color:var(--background-color-note);padding:var(--padding-note);margin:var(--margin-note);border-radius:var(--border-radius-note);border-top:var(--border-top-note)}.note .icon{display:var(--display-note-icon);max-width:var(--max-width-note-icon);max-height:var(--max-height-note-icon);vertical-align:var(--vertical-align-note-icon)}.note .title{display:var(--display-note-title);font-weight:var(--font-weight-note-title);vertical-align:var(--vertical-align-note-title);color:var(--color-note-title);margin:var(--margin-note-title)}.note .content{display:var(--display-note-content);text-align:var(--text-align-note-content)}.note.success{--background-color-note:var(--color-green-100);--border-top-note:0.4rem solid var(--color-green-700);--color-note-title:var(--color-green-700)}.note.warning{--background-color-note:var(--color-yellow-100);--border-top-note:0.4rem solid var(--color-yellow-700);--color-note-title:var(--color-yellow-700)}.note.error{--background-color-note:var(--color-red-100);--border-top-note:0.4rem solid var(--color-red-700);--color-note-title:var(--color-red-700)}`

	CSSTablet     = ``

	CSSDesktop    = ``

	CSSWidescreen = ``

	CSSPrint      = ``
)

Constants for managing the package as a whole.

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

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

	// ParametersComment are the list of comment headers
	// describing inputs.
	ParametersComment = `
{{- /* .Type           - the icon type:                                 */ -}}
{{- /*                       1. 'warning'                               */ -}}
{{- /*                       2. 'error'                                 */ -}}
{{- /*                       3. 'success'                               */ -}}
{{- /*                       3. 'info'                                  */ -}}
{{- /* .Title          - the note title                                 */ -}}
{{- /* .Content        - the HTML content of the note component         */ -}}

`
)

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 = `
<aside class="note {{- if .Type }} {{ .Type -}}{{- end -}}">
{{- if eq .Type "error" }}

	` + errorIcon + `
{{- else if eq .Type "warning" }}

	` + warningIcon + `
{{- else if eq .Type "success" }}

	` + successIcon + `
{{- else }}

	` + infoIcon + `
{{- end }}
{{- if .Title }}

	<p class="title">{{- .Title -}}</p>
{{- end }}

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

	// AMPHTML is the Accelerated Mobile Pages HTML output type.
	AMPHTML = `
<aside class="note {{- if .Type }} {{ .Type -}}{{- end -}}">
{{- if eq .Type "error" }}

	` + errorIcon + `
{{- else if eq .Type "warning" }}

	` + warningIcon + `
{{- else if eq .Type "success" }}

	` + successIcon + `
{{- else }}

	` + infoIcon + `
{{- end }}
{{- if .Title }}

	<p class="title">{{- .Title -}}</p>
{{- end }}

	<div class="content">{{ .Content }}</div>
</aside>
`
)

Data

type Data struct {
	Type    string
	Title   string
	Content string
}

Data is the data structure for rendering the component.