Skip to content

Commit a7ba81f

Browse files
authored
component changes for pending task feature (#270)
1 parent b3c0084 commit a7ba81f

File tree

5 files changed

+238
-22
lines changed

5 files changed

+238
-22
lines changed

client/components/button-fill.vue

Lines changed: 92 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,24 @@
2020
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
// THE SOFTWARE.
2222
23+
const COLOR_TYPE_DEFAULT = 'primary';
24+
const COLOR_TYPES = ['primary', 'secondary', 'tertiary'];
25+
const SIZE_TYPE_DEFAULT = 'medium';
26+
const SIZE_TYPES = ['small', 'medium', 'large'];
27+
const TAG_TYPE_DEFAULT = 'button';
28+
const TAG_LINK_TYPES = ['a', 'router-link'];
29+
2330
export default {
2431
name: 'button-fill',
2532
props: {
33+
active: {
34+
type: Boolean,
35+
default: false,
36+
},
2637
color: {
2738
type: String,
28-
default: 'primary',
29-
validator: value => ['primary', 'secondary', 'tertiary'].includes(value),
39+
default: COLOR_TYPE_DEFAULT,
40+
validator: value => COLOR_TYPES.includes(value),
3041
},
3142
disabled: {
3243
type: Boolean,
@@ -40,15 +51,33 @@ export default {
4051
label: {
4152
type: String,
4253
},
54+
size: {
55+
type: String,
56+
default: SIZE_TYPE_DEFAULT,
57+
validator: value => SIZE_TYPES.includes(value),
58+
},
4359
tag: {
4460
type: String,
45-
default: 'button',
61+
default: TAG_TYPE_DEFAULT,
4662
},
4763
to: {
48-
type: Object,
64+
type: [String, Object],
65+
},
66+
uppercase: {
67+
type: Boolean,
68+
default: false,
4969
},
5070
},
5171
computed: {
72+
computedTag() {
73+
const { disabled, tag } = this;
74+
75+
if (disabled && TAG_LINK_TYPES.includes(tag)) {
76+
return 'button';
77+
}
78+
79+
return tag;
80+
},
5281
disabledLabelText() {
5382
return this.disabled ? this.disabledLabel : '';
5483
},
@@ -68,12 +97,15 @@ export default {
6897
:aria-disabled="disabled"
6998
class="button-fill"
7099
:class="{
71-
disabled: disabled,
100+
active,
72101
[color]: color,
102+
disabled,
103+
[size]: size,
104+
uppercase,
73105
}"
74106
:disabled="disabled"
75107
:href="href"
76-
:is="tag"
108+
:is="computedTag"
77109
:to="to"
78110
:title="disabledLabelText"
79111
@click="onClick"
@@ -85,32 +117,51 @@ export default {
85117
<style lang="stylus">
86118
.button-fill {
87119
border: none;
120+
color: #fff !important;
88121
cursor: pointer;
89122
display: inline-block;
90-
font-size: 14px;
91123
font-weight: 600;
92-
padding: 13px 21px;
93124
transition: all 400ms ease;
94-
color: #fff !important;
95125
white-space: nowrap;
96126
127+
&:focus {
128+
outline: none;
129+
}
130+
97131
&.disabled {
98132
opacity: 0.5;
99133
cursor: not-allowed;
100134
}
101135
136+
// color
102137
&.primary {
103138
background-color: #11939a;
104139
105-
&:hover {
140+
&.active {
141+
background-color: #0e767b;
142+
}
143+
144+
&:focus, &:hover {
145+
background-color: #10858b;
146+
}
147+
148+
&:active {
106149
background-color: #0e767b;
107150
}
108151
}
109152
110153
&.secondary {
111154
background-color: #ca3b27;
112155
113-
&:hover {
156+
&.active {
157+
background-color: #a22f1f;
158+
}
159+
160+
&:focus, &:hover {
161+
background-color: #b63523;
162+
}
163+
164+
&:active {
114165
background-color: #a22f1f;
115166
}
116167
}
@@ -119,9 +170,38 @@ export default {
119170
background-color: transparent;
120171
color: #11939a !important;
121172
122-
&:hover {
173+
&.active {
123174
color: #0e767b !important;
124175
}
176+
177+
&:focus, &:hover {
178+
color: #10858b !important;
179+
}
180+
181+
&:active {
182+
color: #0e767b !important;
183+
}
184+
}
185+
186+
// size
187+
&.small {
188+
font-size: 12px;
189+
padding: 6px 10px;
190+
}
191+
192+
&.medium {
193+
font-size: 14px;
194+
padding: 13px 21px;
195+
}
196+
197+
&.large {
198+
font-size: 26px;
199+
padding: 26px 42px;
200+
}
201+
202+
// uppercase
203+
&.uppercase {
204+
text-transform: uppercase;
125205
}
126206
}
127207
</style>

client/components/button-group.vue

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
<script>
2+
// Copyright (c) 2021 Uber Technologies Inc.
3+
//
4+
//
5+
// Permission is hereby granted, free of charge, to any person obtaining a copy
6+
// of this software and associated documentation files (the "Software"), to deal
7+
// in the Software without restriction, including without limitation the rights
8+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
// copies of the Software, and to permit persons to whom the Software is
10+
// furnished to do so, subject to the following conditions:
11+
//
12+
// The above copyright notice and this permission notice shall be included in
13+
// all copies or substantial portions of the Software.
14+
//
15+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
// THE SOFTWARE.
22+
23+
import ButtonFill from './button-fill';
24+
25+
export default {
26+
name: 'button-group',
27+
props: {
28+
items: {
29+
type: Array,
30+
default: () => [],
31+
},
32+
label: {
33+
type: String,
34+
},
35+
uppercase: {
36+
type: Boolean,
37+
default: false,
38+
},
39+
value: {
40+
type: String,
41+
default: '',
42+
},
43+
},
44+
components: {
45+
'button-fill': ButtonFill,
46+
},
47+
methods: {
48+
onClick(item) {
49+
if (this.value !== item) {
50+
this.$emit('change', item);
51+
}
52+
},
53+
},
54+
};
55+
</script>
56+
57+
<template>
58+
<div class="button-group">
59+
<span class="label" v-if="label">
60+
{{ label }}
61+
</span>
62+
<button-fill
63+
:active="item === value"
64+
:key="item"
65+
:label="item"
66+
:uppercase="uppercase"
67+
v-for="item in items"
68+
@click="() => onClick(item)"
69+
/>
70+
</div>
71+
</template>
72+
73+
<style lang="stylus">
74+
.button-group {
75+
display: inline-block;
76+
77+
.label {
78+
margin-right: 10px;
79+
}
80+
}
81+
</style>

client/components/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
export { default as BarLoader } from './bar-loader';
2323
export { default as ButtonFill } from './button-fill';
24+
export { default as ButtonGroup } from './button-group';
2425
export { default as ButtonIcon } from './button-icon';
2526
export { default as Copy } from './copy';
2627
export { default as DataViewer } from './data-viewer';

client/components/navigation-link.vue

Lines changed: 46 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,31 @@
2222
2323
export default {
2424
name: 'navigation-link',
25-
props: ['exact', 'icon', 'id', 'label', 'to'],
25+
props: {
26+
exact: {
27+
type: Boolean,
28+
default: false,
29+
},
30+
icon: {
31+
type: String,
32+
default: '',
33+
},
34+
id: {
35+
type: String,
36+
default: '',
37+
},
38+
label: {
39+
type: String,
40+
default: '',
41+
},
42+
notificationCount: {
43+
type: Number,
44+
default: 0,
45+
},
46+
to: {
47+
type: [String, Object],
48+
},
49+
},
2650
};
2751
</script>
2852

@@ -34,26 +58,43 @@ export default {
3458
:id="id"
3559
:to="to"
3660
>
37-
{{ label }}
61+
<span>{{ label }}</span>
62+
<span class="notification" v-if="notificationCount">{{
63+
notificationCount
64+
}}</span>
3865
</router-link>
3966
</template>
4067

4168
<style lang="stylus">
4269
a.navigation-link {
70+
border-bottom: 4px solid transparent;
4371
display: inline-block;
44-
padding: 11px 18px;
45-
transition: all 400ms ease;
4672
font-weight: 500;
73+
padding: 11px 18px;
4774
text-transform: uppercase;
48-
border-bottom: 4px solid transparent;
75+
transition: all 400ms ease;
4976
5077
&:before {
5178
font-family: 'uber-icons';
5279
margin-right: 5px;
5380
}
5481
82+
&:focus, &:hover {
83+
border-bottom-color: #0e767b;
84+
outline: none;
85+
}
86+
5587
&.router-link-active {
5688
border-bottom-color: #11939a;
5789
}
90+
91+
& > .notification {
92+
background-color: #11939a;
93+
border-radius: 7px;
94+
color: black;
95+
font-size: 12px;
96+
margin-left: 5px;
97+
padding: 0 6px;
98+
}
5899
}
59100
</style>

client/components/no-results.vue

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,28 @@
2222
2323
export default {
2424
name: 'no-results',
25-
props: ['results'],
25+
props: {
26+
isLoading: {
27+
type: Boolean,
28+
default: false,
29+
},
30+
message: {
31+
type: String,
32+
default: 'No Results',
33+
},
34+
results: {
35+
type: Array,
36+
},
37+
},
2638
};
2739
</script>
2840

2941
<template>
30-
<div class="no-results-container" v-if="results && !results.length">
31-
<div class="no-results">
32-
No Results
33-
</div>
42+
<div
43+
class="no-results-container"
44+
v-if="!isLoading && results && !results.length"
45+
>
46+
<div class="no-results">{{ message }}</div>
3447
</div>
3548
</template>
3649

0 commit comments

Comments
 (0)