Skip to content

Commit a5da0dc

Browse files
committed
RevDepRow: Make the whole row clickable
1 parent d60cd75 commit a5da0dc

File tree

3 files changed

+52
-3
lines changed

3 files changed

+52
-3
lines changed

app/components/rev-dep-row.hbs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
1-
<div local-class="row" ...attributes>
1+
<div local-class="row {{if this.focused "focused"}}" ...attributes>
22
<div>
3-
<LinkTo @route="crate" @model={{@dependency.version.crateName}} data-test-crate-name>
3+
<LinkTo
4+
@route="crate"
5+
@model={{@dependency.version.crateName}}
6+
local-class="link"
7+
data-test-crate-name
8+
{{on "focusin" (fn this.setFocused true)}}
9+
{{on "focusout" (fn this.setFocused false)}}
10+
>
411
{{@dependency.version.crateName}}
512
</LinkTo>
613
requires {{@dependency.req}}

app/components/rev-dep-row.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { action } from '@ember/object';
2+
import Component from '@glimmer/component';
3+
import { tracked } from '@glimmer/tracking';
4+
5+
export default class VersionRow extends Component {
6+
@tracked focused = false;
7+
8+
@action setFocused(value) {
9+
this.focused = value;
10+
}
11+
}

app/components/rev-dep-row.module.css

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
.row {
2+
--hover-bg-color: hsl(217, 37%, 98%);
3+
--crate-color: var(--grey700);
24
--shadow: 0 1px 3px hsla(51, 90%, 42%, .35);
35

46
display: flex;
@@ -12,11 +14,40 @@
1214
box-shadow: var(--shadow);
1315
transition: all 300ms;
1416

17+
&:hover, &.focused {
18+
background-color: var(--hover-bg-color);
19+
transition: all 0ms;
20+
}
21+
22+
&.focused {
23+
box-shadow: 0 0 0 3px var(--yellow500), var(--shadow);
24+
}
25+
1526
@media only screen and (max-width: 550px) {
1627
display: block
1728
}
1829
}
1930

31+
.link {
32+
color: var(--crate-color);
33+
font-weight: 500;
34+
margin-right: 15px;
35+
outline: none;
36+
37+
&:hover {
38+
color: var(--crate-color);
39+
}
40+
41+
&::after {
42+
content: '';
43+
position: absolute;
44+
left: 0;
45+
top: 0;
46+
right: 0;
47+
bottom: 0;
48+
}
49+
}
50+
2051
.downloads {
2152
display: flex;
2253
align-items: center;
@@ -32,5 +63,5 @@
3263
}
3364

3465
.rev-dep-downloads {
35-
padding-left: 7px
66+
padding-left: 7px;
3667
}

0 commit comments

Comments
 (0)