Skip to content

Commit ab5f9fb

Browse files
committed
Settings::ApiTokens: Improve list and form styling some more
1 parent 87e136a commit ab5f9fb

File tree

3 files changed

+96
-60
lines changed

3 files changed

+96
-60
lines changed

app/components/settings/api-tokens.hbs

Lines changed: 28 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -55,39 +55,21 @@
5555

5656
<ul role="list" local-class="token-list">
5757
{{#each this.sortedTokens as |token|}}
58-
<li>
59-
<div local-class="row" data-test-api-token={{or token.id true}}>
60-
<div local-class="name" data-test-name>
61-
{{token.name}}
62-
</div>
58+
<li local-class="row" data-test-api-token={{or token.id true}}>
59+
<h3 local-class="name" data-test-name>
60+
{{token.name}}
61+
</h3>
6362

64-
<div local-class="dates">
65-
<span title={{token.created_at}} local-class="created-at" data-test-created-at>
66-
Created {{date-format-distance-to-now token.created_at addSuffix=true}}
67-
</span>
68-
<span title={{token.last_used_at}} local-class="last-used-at" data-test-last-used-at>
69-
{{#if token.last_used_at}}
70-
Last used {{date-format-distance-to-now token.last_used_at addSuffix=true}}
71-
{{else}}
72-
Never used
73-
{{/if}}
74-
</span>
75-
</div>
63+
<div title={{token.last_used_at}} local-class="last-used-at" data-test-last-used-at>
64+
{{#if token.last_used_at}}
65+
Last used {{date-format-distance-to-now token.last_used_at addSuffix=true}}
66+
{{else}}
67+
Never used
68+
{{/if}}
69+
</div>
7670

77-
<div local-class="actions">
78-
<button
79-
type="button"
80-
local-class="revoke-button"
81-
disabled={{token.isSaving}}
82-
data-test-revoke-token-button
83-
{{on "click" (perform this.revokeTokenTask token)}}
84-
>
85-
Revoke
86-
</button>
87-
{{#if token.isSaving}}
88-
<LoadingSpinner local-class="spinner" data-test-saving-spinner />
89-
{{/if}}
90-
</div>
71+
<div title={{token.created_at}} local-class="created-at" data-test-created-at>
72+
Created {{date-format-distance-to-now token.created_at addSuffix=true}}
9173
</div>
9274

9375
{{#if token.token}}
@@ -99,6 +81,21 @@
9981
<pre class="terminal">cargo login {{token.token}}</pre>
10082
</div>
10183
{{/if}}
84+
85+
<div local-class="actions">
86+
<button
87+
type="button"
88+
local-class="revoke-button"
89+
disabled={{token.isSaving}}
90+
data-test-revoke-token-button
91+
{{on "click" (perform this.revokeTokenTask token)}}
92+
>
93+
Revoke
94+
</button>
95+
{{#if token.isSaving}}
96+
<LoadingSpinner local-class="spinner" data-test-saving-spinner />
97+
{{/if}}
98+
</div>
10299
</li>
103100
{{/each}}
104101
</ul>

app/components/settings/api-tokens.module.css

Lines changed: 67 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -22,56 +22,45 @@
2222
box-shadow: 0 2px 3px hsla(51, 50%, 44%, .35);
2323

2424
> * {
25-
padding: 10px 20px;
25+
padding: 16px;
2626
}
2727

2828
> * + * {
2929
border-top: 1px solid #f1f0ed;
3030
}
3131
}
3232

33-
.row {
34-
display: flex;
35-
align-items: center;
33+
.name {
34+
margin: 0 0 12px;
35+
font-weight: 500;
36+
}
37+
38+
.dates {
39+
}
40+
41+
.created-at,
42+
.last-used-at {
43+
composes: small from '../../styles/shared/typography.module.css';
44+
margin-top: 4px;
3645
}
3746

3847
.new-token-form {
39-
padding: 10px 20px;
40-
display: flex;
41-
align-items: center;
48+
padding: 16px;
4249
border-radius: 6px;
4350
background-color: white;
4451
box-shadow: 0 2px 3px hsla(51, 50%, 44%, .35);
4552
margin-bottom: 24px;
4653

4754
.input {
4855
padding: 8px;
49-
margin-right: 20px;
5056
width: 100%;
57+
border: 1px solid #ada796;
58+
border-radius: 4px;
5159
}
5260
}
5361

54-
.name {
55-
flex: 1;
56-
margin-right: 0.4em;
57-
font-weight: bold;
58-
}
59-
60-
.dates {
61-
flex: content;
62-
display: flex;
63-
flex-direction: column;
64-
align-items: flex-end;
65-
margin-right: 0.4em;
66-
}
67-
68-
.created-at,
69-
.last-used-at {
70-
composes: small from '../../styles/shared/typography.module.css';
71-
line-height: 1.15rem;
72-
}
73-
7462
.actions {
63+
margin-top: 12px;
7564
display: flex;
7665
align-items: center;
7766
}
@@ -82,12 +71,61 @@
8271

8372
.save-button {
8473
composes: yellow-button small from '../../styles/shared/buttons.module.css';
74+
flex-grow: 1;
75+
border-radius: 4px;
8576
}
8677

8778
.revoke-button {
8879
composes: tan-button small from '../../styles/shared/buttons.module.css';
80+
flex-grow: 1;
81+
border-radius: 4px;
8982
}
9083

9184
.new-token {
92-
margin-top: 20px;
85+
margin: 24px 0;
86+
87+
pre {
88+
border-radius: 4px;
89+
margin-bottom: 0;
90+
user-select: all;
91+
}
92+
}
93+
94+
@media (min-width: 640px) {
95+
.new-token-form {
96+
display: grid;
97+
grid-template-columns: 1fr auto;
98+
align-items: center;
99+
100+
.input {
101+
padding: 8px;
102+
margin-right: 16px;
103+
}
104+
105+
.actions {
106+
margin: 0 0 0 16px;
107+
}
108+
}
109+
110+
111+
.row {
112+
display: grid;
113+
grid-template:
114+
"name actions" auto
115+
"last-user actions" auto
116+
"created-at actions" auto
117+
"details details" auto
118+
/ 1fr auto;
119+
120+
.actions {
121+
grid-area: actions;
122+
align-self: start;
123+
margin: 0 0 0 16px;
124+
}
125+
126+
.new-token {
127+
grid-area: details;
128+
margin-bottom: 0;
129+
}
130+
}
93131
}

app/styles/shared/buttons.module.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
padding: 15px 40px;
2424
display: inline-flex;
2525
align-items: center;
26+
justify-content: center;
2627
color: var(--text-color);
2728
text-decoration: none;
2829
font-weight: bold;

0 commit comments

Comments
 (0)