component

package
v0.0.0-...-c858694 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GopherBotNotification

func GopherBotNotification(n notification.Notification) bool

GopherBotNotification reports whether notification n is known to be authored by GopherBot.

func RenderNotification

func RenderNotification(n notification.Notification) (htmlg.Component, bool)

RenderNotification renders notification n into an HTML component.

Types

type Notification

type Notification struct {
	notifications.Notification
}

Notification component for display purposes.

func (Notification) Render

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

type NotificationsByRepo

type NotificationsByRepo struct {
	Notifications []notification.Notification
}

NotificationsByRepo component displays notifications grouped by repos.

func (NotificationsByRepo) Render

func (a NotificationsByRepo) Render() []*html.Node

type RGB

type RGB struct {
	R, G, B uint8
}

TODO: Dedup.

RGB represents a 24-bit color without alpha channel.

func (RGB) HexString

func (c RGB) HexString() string

HexString returns a hexadecimal color string. For example, "#ff0000" for red.

type RepoNotifications

type RepoNotifications struct {
	Repo          notifications.RepoSpec
	Notifications []Notification
	// contains filtered or unexported fields
}

RepoNotifications component is a collection of notifications for the same repo.

func (RepoNotifications) Render

func (r RepoNotifications) Render() []*html.Node

type Stream

type Stream struct {
	Notifications []notification.Notification
	Error         string
	GopherBot     bool // Controls whether to show all bot comments.
}

Stream component for display purposes.

func (Stream) Render

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

type Time

type Time struct {
	Time time.Time
}

Time component that displays human friendly relative time (e.g., "2 hours ago", "yesterday"), but also contains a tooltip with the full absolute time (e.g., "Jan 2, 2006, 3:04 PM MST").

func (Time) Render

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

Jump to

Keyboard shortcuts

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