Skip to content

Commit b923478

Browse files
author
Adam Argyle
committed
style updates and selected state
1 parent 27e215e commit b923478

3 files changed

Lines changed: 22 additions & 4 deletions

File tree

app/css/index.css

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ nav {
6464
font-size: 2.5rem;
6565
font-weight: lighter;
6666
text-decoration: underline;
67+
text-decoration-color: var(--white);
6768
}
6869

6970
@media (max-width: 720px) {
@@ -78,7 +79,7 @@ nav {
7879
& > select {
7980
font-size: 1.5rem;
8081
border: none;
81-
background: white;
82+
background: var(--white);
8283
}
8384
}
8485

@@ -140,6 +141,14 @@ dl {
140141
block-size: .75em;
141142
inline-size: .75em;
142143
}
144+
145+
&[selected] > a {
146+
text-decoration-color: deeppink;
147+
}
148+
149+
&:not([selected]) > a {
150+
text-decoration: none;
151+
}
143152
}
144153
}
145154

app/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ <h3>Circles</h3>
8383
<dl>
8484
<dt>Entrances</dt>
8585
<dd><a href="#">in:circle:top-right</a></dd>
86-
<dd><a href="#" autofocus>in:circle:top-left</a></dd>
86+
<dd selected><a href="#" autofocus>in:circle:top-left</a></dd>
8787
<dd><a href="#">in:circle:bottom-right</a></dd>
8888
<dd><a href="#">in:circle:bottom-left</a></dd>
8989

app/js/index.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@ import $ from 'blingblingjs'
22

33
const $demo = $('section')
44

5+
const [selected] = $('dd').filter(d =>
6+
d.textContent === 'in:circle:top-left')
7+
58
const state = {
6-
transition: 'in:circle:top-left'
9+
transition: 'in:circle:top-left',
10+
selected,
711
}
812

913
const update = transition => {
@@ -28,7 +32,12 @@ $demo.on('click', e => {
2832
})
2933

3034
$('dd').on('click', e => {
31-
let transition = e.target.textContent
35+
let transition = e.currentTarget.textContent
36+
37+
state.selected.removeAttribute('selected')
38+
e.currentTarget.setAttribute('selected', true)
39+
state.selected = e.currentTarget
40+
3241
update(transition)
3342
})
3443

0 commit comments

Comments
 (0)