component

package
v0.0.0-...-7324d88 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2023 License: MIT Imports: 6 Imported by: 1

Documentation

Overview

Package component contains individual components that can render themselves as HTML.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContactInfo

type ContactInfo struct {
	GitHub htmlg.Component
	Email  htmlg.Component
}

ContactInfo is a component for displaying the persons's contact information on top of a resume.

func (ContactInfo) Render

func (c ContactInfo) Render() []*html.Node

type Date

type Date struct {
	Year  int        // Year. E.g., 2009.
	Month time.Month // Month is 1 - 12. 0 means unspecified.
}

Date represents an imprecise date.

Example
{
	d := Date{Year: 2015, Month: time.June}
	render(d)
}
{
	d := Date{Year: 2008}
	render(d)
}
{
	d := Present{}
	render(d)
}
Output:

2015/06
2008
Present

func (Date) Date

func (d Date) Date() (year int, month time.Month)

func (Date) Render

func (d Date) Render() []*html.Node

type DateComponent

type DateComponent interface {
	Date() (year int, month time.Month)
	htmlg.Component
}

type DateRange

type DateRange struct {
	From, To DateComponent
}

DateRange represents a span of time between two dates.

Example
dr := DateRange{
	From: Date{Year: 2010, Month: time.February}, To: Date{Year: 2012, Month: time.June},
}
render(dr)
Output:

<span title="2 years, 4 months">2010/02–2012/06</span>
Example (YearsMonths)
fmt.Println(yearsMonths(Date{Year: 2010, Month: time.February}, Date{Year: 2010, Month: time.February}))
fmt.Println(yearsMonths(Date{Year: 2010, Month: time.February}, Date{Year: 2010, Month: time.August}))
fmt.Println(yearsMonths(Date{Year: 2010, Month: time.February}, Date{Year: 2011, Month: time.February}))
fmt.Println(yearsMonths(Date{Year: 2010, Month: time.February}, Date{Year: 2012, Month: time.June}))
Output:

0 months
6 months
1 years
2 years, 4 months

func (DateRange) Render

func (dr DateRange) Render() []*html.Node

type Fade

type Fade string

Fade is like Text, except the font color is faded out to a light gray shade.

func (Fade) Render

func (t Fade) Render() []*html.Node

type Item

type Item struct {
	Title    htmlg.Component
	Subtitle htmlg.Component // Optional.
	Dates    htmlg.Component // Optional.
	Lines    []htmlg.Component

	// WIP controls whether the item is considered a work-in-progress,
	// and is therefore omitted during production use.
	WIP bool
}

Item is a single item within a resume section. For example, a particular workplace or school.

func (Item) Render

func (i Item) Render() []*html.Node

type Name

type Name struct {
	Name string
}

Name is a component for displaying the person's name on top of a resume.

func (Name) Render

func (n Name) Render() []*html.Node

type Organization

type Organization struct {
	Name     string
	Location string
}

Organization is a component for displaying an entity with a name and a location.

func (Organization) Render

func (o Organization) Render() []*html.Node

type Present

type Present struct {
	// Now should be set to the current local time.
	// Tests may use a fixed time to get reproducible output.
	Now time.Time
}

Present represents the present date.

func (Present) Date

func (p Present) Date() (year int, month time.Month)

func (Present) Render

func (p Present) Render() []*html.Node

type Section

type Section struct {
	Title string
	Items []Item
}

Section is a section of a resume. For example, "Experience" or "Education".

func (Section) Render

func (s Section) Render() []*html.Node

Jump to

Keyboard shortcuts

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