feat(style): harmonize button color

This commit is contained in:
Anhgelus Morhtuuzh 2024-11-14 14:58:05 +01:00
parent 83a7fc5cf8
commit fce56f5088
No known key found for this signature in database
GPG key ID: CAD341EFA92DDDE5
3 changed files with 8 additions and 36 deletions

16
data.go
View file

@ -50,12 +50,8 @@ type ButtonColor struct {
} }
type Link struct { type Link struct {
Link string `json:"link"` Link string `json:"link"`
Content string `json:"content"` Content string `json:"content"`
Color string `json:"color"`
TextColor string `json:"text_color"`
ColorHover string `json:"color_hover"`
TextColorHover string `json:"text_color_hover"`
} }
type Legal struct { type Legal struct {
@ -91,11 +87,3 @@ func (b *ButtonColor) GetTextColor() template.CSS {
func (b *ButtonColor) GetBackground() template.CSS { func (b *ButtonColor) GetBackground() template.CSS {
return template.CSS("--background: " + b.Background + ";--background-hover: " + b.BackgroundHover + ";") return template.CSS("--background: " + b.Background + ";--background-hover: " + b.BackgroundHover + ";")
} }
func (l *Link) GetLinkColor() template.CSS {
return template.CSS("--text-color: " + l.TextColor + ";--text-color-hover: " + l.TextColorHover + ";")
}
func (l *Link) GetBackground() template.CSS {
return template.CSS("--background: " + l.Color + ";--background-hover: " + l.ColorHover + ";")
}

View file

@ -115,33 +115,17 @@
"items": { "items": {
"type": "object", "type": "object",
"properties": { "properties": {
"color": {
"type": "string"
},
"color_hover": {
"type": "string"
},
"content": { "content": {
"type": "string" "type": "string"
}, },
"link": { "link": {
"type": "string" "type": "string"
},
"text_color": {
"type": "string"
},
"text_color_hover": {
"type": "string"
} }
}, },
"additionalProperties": false, "additionalProperties": false,
"required": [ "required": [
"link", "link",
"content", "content"
"color",
"text_color",
"color_hover",
"text_color_hover"
] ]
} }
}, },

View file

@ -12,14 +12,14 @@
<p class="description"> <p class="description">
{{ .Description }} {{ .Description }}
</p> </p>
<div class="links"> <div class="links" style="{{ .Color.Button.GetBackground }}{{ .Color.Button.GetTextColor }}">
{{ range $link := .Links }} {{ range $link := .Links }}
<div class="link" style="{{ .GetBackground }}"> <div class="link">
<a href="{{ .Link }}" style="{{ .GetLinkColor }}">{{ .Content }}</a> <a href="{{ .Link }}">{{ .Content }}</a>
</div> </div>
{{ end }} {{ end }}
<div class="link" style="{{ .Color.Button.GetBackground }}"> <div class="link">
<a href="/tags" style="{{ .Color.Button.GetTextColor }}">Tags</a> <a href="/tags">Tags</a>
</div> </div>
</div> </div>
</main> </main>