components

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2025 License: UNKNOWN not legal advice Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SidebarLayout = "sidebar"
	FullLayout    = "full"
)

Layout

View Source
const RedirectViewType = "redirect-view"

Variables

This section is empty.

Functions

func RenderBreadcrumpComponent

func RenderBreadcrumpComponent(w io.Writer, data BreadcrumbData) error

Types

type ArticleData

type ArticleData struct {
	ComponentContent Component
	Classes          string
}
type BreadcrumbData struct {
	Parts []BreadcrumbPart
	Args  string
}
type BreadcrumbPart struct {
	Name string
	URL  string
}

type Component

type Component interface {
	Render(w io.Writer) error
}

func IndexLayout

func IndexLayout(data IndexData) Component

func NewReaderComponent

func NewReaderComponent(reader io.Reader) Component

func NewTemplateComponent

func NewTemplateComponent(name string, data any) Component

type DirData

type DirData struct {
	PkgPath     string
	Files       []string
	FileCounter int
}

type FooterData

type FooterData struct {
	Analytics  bool
	AssetsPath string
	Sections   []FooterSection
}

func EnrichFooterData

func EnrichFooterData(data FooterData) FooterData
type FooterLink struct {
	Label string
	URL   string
}

type FooterSection

type FooterSection struct {
	Title string
	Links []FooterLink
}

type HeadData

type HeadData struct {
	Title       string
	Description string
	Canonical   string
	Image       string
	URL         string
	ChromaPath  string
	AssetsPath  string
	Analytics   bool
	Remote      string
	ChainId     string
}

type HeaderData

type HeaderData struct {
	RealmPath  string
	RealmURL   weburl.GnoURL
	Breadcrumb BreadcrumbData
	Links      []HeaderLink
	ChainId    string
	Remote     string
}

func EnrichHeaderData

func EnrichHeaderData(data HeaderData) HeaderData
type HeaderLink struct {
	Label    string
	URL      string
	Icon     string
	IsActive bool
}
func StaticHeaderLinks(u weburl.GnoURL) []HeaderLink

type HelpData

type HelpData struct {
	// Selected function
	SelectedFunc string
	SelectedArgs map[string]string

	RealmName string
	Functions []vm.FunctionSignature
	ChainId   string
	Remote    string
	PkgPath   string
}

type HelpTocData

type HelpTocData struct {
	Icon  string
	Items []HelpTocItem
}

type HelpTocItem

type HelpTocItem struct {
	Link string
	Text string
}

type IndexData

type IndexData struct {
	HeadData
	HeaderData
	FooterData
	BodyView *View
}

type RealmData

type RealmData struct {
	ComponentContent Component
	TocItems         *RealmTOCData
}

type RealmTOCData

type RealmTOCData struct {
	Items []*markdown.TocItem
}

type RedirectData

type RedirectData struct {
	To            string
	WithAnalytics bool
}

type SourceData

type SourceData struct {
	PkgPath     string
	Files       []string
	FileName    string
	FileSize    string
	FileLines   int
	FileCounter int
	FileSource  Component
}

type SourceTocData

type SourceTocData struct {
	Icon  string
	Items []SourceTocItem
}

type SourceTocItem

type SourceTocItem struct {
	Link string
	Text string
}

type StatusData

type StatusData struct {
	Title      string
	Body       string
	ButtonURL  string
	ButtonText string
}

StatusData holds the dynamic fields for the "status" template

type TemplateComponent

type TemplateComponent struct {
	// contains filtered or unexported fields
}

func (*TemplateComponent) Render

func (c *TemplateComponent) Render(w io.Writer) error

type View

type View struct {
	Type ViewType
	Component
}

func DirectoryView

func DirectoryView(data DirData) *View

func HelpView

func HelpView(data HelpData) *View

func NewTemplateView

func NewTemplateView(typ ViewType, name string, data any) *View

func RealmView

func RealmView(data RealmData) *View

func RedirectView

func RedirectView(data RedirectData) *View

func SourceView

func SourceView(data SourceData) *View

func StatusErrorComponent

func StatusErrorComponent(message string) *View

StatusErrorComponent returns a view for error scenarios

func StatusNoRenderComponent

func StatusNoRenderComponent(pkgPath string) *View

StatusNoRenderComponent returns a view for non-error notifications

func (*View) Render

func (v *View) Render(w io.Writer) error

func (*View) String

func (v *View) String() string

type ViewType

type ViewType string
const DirectoryViewType ViewType = "dir-view"
const HelpViewType ViewType = "help-view"
const RealmViewType ViewType = "realm-view"
const SourceViewType ViewType = "source-view"
const StatusViewType ViewType = "status-view"

Jump to

Keyboard shortcuts

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