layout

package
v1.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 6, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

templ: version: v0.3.1020

templ: version: v0.3.1020

Index

Constants

This section is empty.

Variables

View Source
var AssetVer string

AssetVer is set at startup from a content hash of the embedded static files. Appended to asset URLs so browsers cache-bust on deploy.

Functions

func CellColor

func CellColor(likelihood, consequence int, t RiskThresholds) string

CellColor returns a Tailwind bg class using the given thresholds.

func CellLevel

func CellLevel(likelihood, consequence int, t RiskThresholds) string

CellLevel returns red/yellow/green for a score with given thresholds.

func Layout

func Layout(title string, subtitle string, activePage string, user middleware.SessionUser, content templ.Component) templ.Component

func NS5814CellColor

func NS5814CellColor(likelihood, consequence int) string

NS5814CellColor is a backwards-compat wrapper using default thresholds.

func NS5814Level

func NS5814Level(likelihood, consequence int) string

NS5814Level is a backwards-compat wrapper using default thresholds.

func RiskMatrix

func RiskMatrix(cells []RiskMatrixCell) templ.Component

RiskMatrix renders a 5×5 NS 5814 risk heat map. cells must have exactly 25 elements ordered row-major (consequence desc, likelihood asc).

func UserInitials

func UserInitials(name string) string

Types

type NavGroup struct {
	Section string
	Items   []NavItem
}
type NavItem struct {
	Key   string
	Icon  string
	Label string
	Href  string
}

type RiskMatrixCell

type RiskMatrixCell struct {
	ColorClass string // Tailwind background color class
	Count      int    // Number of risks in this cell (0 = empty)
}

RiskMatrixCell represents a single cell in the NS 5814 5×5 risk heat map.

func BuildRiskMatrixCells

func BuildRiskMatrixCells(counts map[[2]int]int) []RiskMatrixCell

BuildRiskMatrixCells builds 25 cells with default thresholds.

func BuildRiskMatrixCellsT

func BuildRiskMatrixCellsT(counts map[[2]int]int, t RiskThresholds) []RiskMatrixCell

BuildRiskMatrixCellsT builds 25 cells with configurable thresholds.

type RiskThresholds

type RiskThresholds struct {
	LowMax  int // default 5
	HighMin int // default 12
}

RiskThresholds holds configurable level boundaries. Scores ≤ LowMax are green, scores ≥ HighMin are red, between is yellow.

func DefaultThresholds

func DefaultThresholds() RiskThresholds

DefaultThresholds returns NS 5814 defaults.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL