Package iframe

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

Package iframe is the full package for rendering all compatible iframe.

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 = `amp-iframe{position:var(--iframe-position);border:var(--iframe-border);margin:var(--iframe-margin);z-index:var(--iframe-z-index);overflow:var(--iframe-overflow);width:var(--iframe-width);min-height:var(--iframe-min-height)}amp-iframe.hidden{--iframe-position:absolute;--iframe-margin:0;--iframe-z-index:var(--z-index-hidden);--iframe-min-height:0;height:0}`

	CSSCritical = `iframe{position:var(--iframe-position);border:var(--iframe-border);margin:var(--iframe-margin);z-index:var(--iframe-z-index);overflow:var(--iframe-overflow);width:var(--iframe-width);min-height:var(--iframe-min-height)}iframe.hidden{--iframe-position:absolute;--iframe-margin:0;--iframe-z-index:var(--z-index-hidden);--iframe-min-height:0;height:0}`

	CSSTablet = ``

	CSSDesktop = ``

	CSSWidescreen = ``

	CSSPrint        = ``

	CSSVariables    = ``

	CSSVariablesAMP = ``
)

Constants for managing the package as a whole.

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

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

	// ParametersComment are the list of comment headers
	// describing inputs.
	ParametersComment = `
{{- /* .URL         = the targeted iframe                               */ -}}
{{- /* .Sandbox     = the sandbox value for the iframe                  */ -}}
{{- /* .Width       = the width for the iframe                          */ -}}
{{- /* .Height      = the height for the iframe                         */ -}}
{{- /* .ID          = the id HTML attribute for the iframe              */ -}}
{{- /* .Class       = the class HTML attribute for the iframe           */ -}}
{{- /* .Content     = the content of the iframe                         */ -}}
{{- /* .Title       = the title for the iframe                          */ -}}
{{- /* .Layout      = the layout value (e.g. <amp-iframe>)              */ -}}

`
)

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

const (
	// HTML is the vanilla HTML output type.
	HTML = `
<iframe src="{{- .URL -}}" sandbox="{{- .Sandbox -}}"
{{- if .Width }} width="{{- .Width -}}"{{- end }}
{{- if .Height }} height="{{- .Height -}}"{{- end }}
{{- if .ID }} id="{{- .ID -}}"{{- end }}
{{- if .Class }} class="{{- .Class -}}"{{- end }}
{{- if .Title }} title="{{- .Title -}}"{{- end -}}
>
        {{ .Content -}}
</iframe>
`

	// AMPHTML is the Accelerated Mobile Pages HTML output type.
	AMPHTML = `
<amp-iframe src="{{- .URL -}}"
        sandbox="{{- .Sandbox -}}"
        width="{{- .Width -}}"
        height="{{- .Height -}}"
{{- if .Class }} class="{{- .Class -}}" {{- end }}
        layout="{{- .Layout -}}">
        {{ .Content -}}
</amp-iframe>
`
)

Data

type Data struct {
	URL     string
	SandBox string
	Width   string
	Height  string
	ID      string
	Class   string
	Content string
	Title   string
	Layout  string
}

Data is the data structure for rendering the component.