diff options
| author | Anhgelus Morhtuuzh <anhgelus.morhtuuzh@proton.me> | 2024-11-09 23:37:10 +0100 |
|---|---|---|
| committer | Anhgelus Morhtuuzh <anhgelus.morhtuuzh@proton.me> | 2024-11-09 23:37:10 +0100 |
| commit | 5b98185aa6149660be9fd278f48515690d19307a (patch) | |
| tree | 9f37fa2d373b5537bed95d1397c1f8b663f71368 /data.go | |
| parent | 0b90249205425abc6166d3b4fdffbf5990020355 (diff) | |
feat(link): custom links
Diffstat (limited to 'data.go')
| -rw-r--r-- | data.go | 16 |
1 files changed, 11 insertions, 5 deletions
@@ -2,7 +2,6 @@ package main import ( "html/template" - "log/slog" "strconv" ) @@ -11,6 +10,7 @@ type Data struct { Description string `json:"description"` Person *Person `json:"person"` BackgroundColor *BackgroundColor `json:"background_color"` + Links []*Link `json:"links"` } type Person struct { @@ -28,18 +28,24 @@ type BackgroundColor struct { } `json:"colors"` } +type Link struct { + Link string `json:"link"` + Content string `json:"content"` + Color string `json:"color"` +} + func (d *Data) GetBackground() template.CSS { bg := d.BackgroundColor css := "background: " + bg.Type + "-gradient(" - slog.Info(css) if bg.Type == "linear" { css += strconv.Itoa(int(bg.Angle)) + "deg," } - slog.Info(css) for _, c := range bg.Colors { css += c.Color + " " + strconv.Itoa(int(c.Position)) + "%," - slog.Info(css) } - slog.Info(css[:len(css)-1] + ");") return template.CSS(css[:len(css)-1] + ");") } + +func (l *Link) GetBackground() template.CSS { + return template.CSS("background: " + l.Color) +} |
