feat(tag): style on hover
This commit is contained in:
parent
fce56f5088
commit
2621bc5978
6 changed files with 23 additions and 10 deletions
5
data.go
5
data.go
|
@ -31,6 +31,7 @@ type Color struct {
|
||||||
Background *BackgroundColor `json:"background"`
|
Background *BackgroundColor `json:"background"`
|
||||||
Button *ButtonColor `json:"buttons"`
|
Button *ButtonColor `json:"buttons"`
|
||||||
Text string `json:"text"`
|
Text string `json:"text"`
|
||||||
|
TagHover string `json:"tag_hover"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type BackgroundColor struct {
|
type BackgroundColor struct {
|
||||||
|
@ -87,3 +88,7 @@ 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 (t *Color) GetTagColor() template.CSS {
|
||||||
|
return template.CSS("--tag-hover: " + t.TagHover + ";")
|
||||||
|
}
|
||||||
|
|
2
index.ts
2
index.ts
|
@ -1,7 +1,7 @@
|
||||||
function setupEvents() {
|
function setupEvents() {
|
||||||
document.querySelectorAll<HTMLElement>(".tag")?.forEach(t => {
|
document.querySelectorAll<HTMLElement>(".tag")?.forEach(t => {
|
||||||
t.addEventListener("click", _ => {
|
t.addEventListener("click", _ => {
|
||||||
t.classList.toggle("active")
|
// t.classList.toggle("active")
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -72,13 +72,17 @@
|
||||||
},
|
},
|
||||||
"text": {
|
"text": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
},
|
||||||
|
"tag_hover": {
|
||||||
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
"required": [
|
"required": [
|
||||||
"background",
|
"background",
|
||||||
"buttons",
|
"buttons",
|
||||||
"text"
|
"text",
|
||||||
|
"tag_hover"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"description": {
|
"description": {
|
||||||
|
|
|
@ -73,6 +73,7 @@ main {
|
||||||
transition: .3s;
|
transition: .3s;
|
||||||
max-height: 75vh;
|
max-height: 75vh;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
|
scrollbar-width: thin;
|
||||||
& h1, h2, h3 {
|
& h1, h2, h3 {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,21 +16,18 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
& p {
|
& p {
|
||||||
display: none;
|
|
||||||
@media only screen and (max-width: vars.$bp-little) {
|
|
||||||
display: block;
|
display: block;
|
||||||
}
|
margin-top: 0.5rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.tag {
|
.tag {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
padding: 0.5rem;
|
||||||
|
border-radius: 16px;
|
||||||
@media only screen and (max-width: vars.$bp-little) {
|
@media only screen and (max-width: vars.$bp-little) {
|
||||||
cursor: auto;
|
cursor: auto;
|
||||||
}
|
}
|
||||||
& h4:hover {
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
&.active {
|
&.active {
|
||||||
& h4 {
|
& h4 {
|
||||||
margin-bottom: 0.5rem;
|
margin-bottom: 0.5rem;
|
||||||
|
@ -39,4 +36,10 @@
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
&:hover {
|
||||||
|
background: var(--tag-hover);
|
||||||
|
& h4 {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{{define "body"}}
|
{{define "body"}}
|
||||||
<main style="{{ .GetBackground }}">
|
<main style="{{ .GetBackground }}">
|
||||||
<h2>Tags</h2>
|
<h2>Tags</h2>
|
||||||
<div class="tags">
|
<div class="tags" style="{{ .Color.GetTagColor }}">
|
||||||
{{ range $tag := .Person.Tags }}
|
{{ range $tag := .Person.Tags }}
|
||||||
<div class="tag">
|
<div class="tag">
|
||||||
<h4>{{ .Name }}</h4>
|
<h4>{{ .Name }}</h4>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue