Skip to content

Commit 77c43c5

Browse files
committed
Better top nav button styling
1 parent 82baa57 commit 77c43c5

File tree

2 files changed

+90
-105
lines changed

2 files changed

+90
-105
lines changed

vue3-dashboard/src/components/TheNav.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
<div class="banner-body">
55
<div class="selectors-container">
66
<div class="region-nav">
7-
<div class="hover-button">Choose region or facility...</div>
7+
<div class="hover-button nav-button-base">Choose region or facility...</div>
88
<div class="card nav-hover-content">
9-
<div class="hover-button hover-button-hover-state">
9+
<div class="nav-button-base hover-button hover-button-hover-state">
1010
{{ $t('nav.chooseRegion') }}
1111
</div>
1212
<form class="search-form">
@@ -115,7 +115,7 @@
115115
<select
116116
v-model="selectedMonth"
117117
@change="onMonthChange"
118-
class="month-select"
118+
class="month-select nav-button-base"
119119
>
120120
<option
121121
v-for="month in monthOptions"
@@ -150,10 +150,10 @@
150150
<div class="language-selector">
151151
<button
152152
@click="showLanguageMenu = !showLanguageMenu"
153-
class="language-select-button"
153+
class="nav-button-base language-select-button"
154154
type="button"
155155
>
156-
<span>{{ currentLanguageLabel }}</span>
156+
{{ currentLanguageLabel }}
157157
<svg
158158
class="language-select-arrow"
159159
:class="{ 'rotate-180': showLanguageMenu }"
@@ -185,7 +185,7 @@
185185
</div>
186186
</div>
187187
<a
188-
class="upload-button"
188+
class="nav-button-base"
189189
href="#"
190190
@click.prevent="navigateToUpload"
191191
>

vue3-dashboard/src/style.css

Lines changed: 84 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@
33
/* All styles scoped to .hearts360-dashboard to prevent conflicts when embedding */
44
.hearts360-dashboard {
55
--system-ui: system-ui, Roboto, Helvetica, Arial, sans-serif;
6-
6+
77
font-family: var(--system-ui) !important;
88
background: #f8f8f8;
99
min-height: 100vh;
1010
scroll-behavior: smooth;
1111

1212
/* Nested selectors - all scoped to .hearts360-dashboard */
13-
14-
a, select {
13+
14+
a,
15+
select {
1516
color: #0075eb;
1617
&:hover {
1718
color: #004f9f;
@@ -280,10 +281,6 @@
280281
display: flex;
281282
gap: 16px;
282283
}
283-
.navigation-title-image {
284-
margin: -2px 8px 0 8px;
285-
display: inline-block;
286-
}
287284
& .link-list {
288285
display: flex;
289286
justify-content: end;
@@ -296,17 +293,7 @@
296293
content: " ↗";
297294
}
298295
}
299-
& a {
300-
color: #fff;
301-
display: inline-block;
302-
padding: 4px 2px;
303-
}
304-
& span {
305-
display: inline-block;
306-
padding: 4px 2px;
307-
}
308296
}
309-
310297
.link-dashboards {
311298
font-size: 0.9rem;
312299
margin: 0 0 1rem 0;
@@ -968,6 +955,65 @@
968955
opacity: 1;
969956
}
970957

958+
/* Standard Nav Button Design System */
959+
/*
960+
* Base class for all navigation buttons - provides consistent styling
961+
* Usage: Add 'nav-button-base' class to any button/link, or use specific variants
962+
*
963+
* Design Tokens:
964+
* - Color: White text on semi-transparent white background
965+
* - Padding: 8px 20px (standard), customizable per variant
966+
* - Border radius: 4px
967+
* - Font: 0.9em, weight 600
968+
* - Hover: Slightly brighter background (0.3 opacity)
969+
* - Focus: White outline for accessibility
970+
*/
971+
.nav-button-base {
972+
/* Design tokens */
973+
--nav-btn-color: #fff;
974+
--nav-btn-bg: rgba(255, 255, 255, 0.2);
975+
--nav-btn-bg-hover: rgba(255, 255, 255, 0.3);
976+
--nav-btn-bg-active: rgba(255, 255, 255, 0.25);
977+
--nav-btn-border-radius: 4px;
978+
--nav-btn-padding-x: 20px;
979+
--nav-btn-padding-y: 8px;
980+
--nav-btn-font-size: 0.9em;
981+
--nav-btn-font-weight: 600;
982+
--nav-btn-outline: 2px solid rgba(255, 255, 255, 0.5);
983+
984+
/* Apply tokens */
985+
color: var(--nav-btn-color);
986+
background: var(--nav-btn-bg);
987+
border-radius: var(--nav-btn-border-radius);
988+
font-weight: var(--nav-btn-font-weight);
989+
font-size: var(--nav-btn-font-size);
990+
border: none;
991+
cursor: pointer;
992+
text-decoration: none;
993+
display: inline-block;
994+
transition: background-color 0.2s ease;
995+
text-align: center;
996+
padding: var(--nav-btn-padding-y) var(--nav-btn-padding-x);
997+
998+
@media screen and (min-width: 660px) {
999+
text-align: left;
1000+
}
1001+
1002+
&:hover {
1003+
background-color: var(--nav-btn-bg-hover);
1004+
color: #fff;
1005+
}
1006+
1007+
&:focus {
1008+
outline: var(--nav-btn-outline);
1009+
outline-offset: 2px;
1010+
}
1011+
1012+
&:active {
1013+
background-color: var(--nav-btn-bg-active);
1014+
}
1015+
}
1016+
9711017
/* Selectors Container */
9721018
.selectors-container {
9731019
display: flex;
@@ -991,17 +1037,13 @@
9911037
max-width: fit-content;
9921038
display: inline-block;
9931039
}
1040+
/* Region selector button - uses nav-button-base design */
9941041
.hover-button {
995-
color: #fff;
996-
background: rgba(255, 255, 255, 0.2);
997-
padding: 8px 20px;
998-
display: inline;
999-
border-radius: 4px;
1000-
font-weight: 600;
10011042
display: block;
1002-
text-align: center;
1043+
width: 100%;
1044+
10031045
@media screen and (min-width: 660px) {
1004-
text-align: left;
1046+
width: auto;
10051047
}
10061048
}
10071049
.hover-button-hover-state {
@@ -1134,43 +1176,26 @@
11341176
}
11351177
}
11361178

1179+
/* Month selector - uses nav-button-base design with dropdown arrow */
11371180
.month-select {
1138-
color: #fff;
1139-
background: rgba(255, 255, 255, 0.2);
1140-
padding: 8px 20px;
1141-
border-radius: 4px;
1142-
font-weight: 600;
1143-
border: none;
1144-
display: block;
1145-
width: 100%;
1146-
text-align: center;
1147-
cursor: pointer;
1148-
font-size: 0.9em;
1149-
@media screen and (min-width: 660px) {
1150-
text-align: left;
1151-
width: auto;
1152-
}
1181+
--nav-btn-padding-x: 40px; /* Extra padding for dropdown arrow */
1182+
padding-right: 40px;
1183+
padding-left: 20px;
1184+
11531185
appearance: none;
11541186
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="white"><path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd" /></svg>');
11551187
background-repeat: no-repeat;
11561188
background-position: right 8px center;
11571189
background-size: 16px;
1158-
padding-right: 40px;
11591190

1191+
@media screen and (min-width: 660px) {
1192+
width: auto;
1193+
}
1194+
11601195
option {
11611196
background: #fff;
11621197
color: #333;
11631198
}
1164-
1165-
&:hover {
1166-
background-color: rgba(255, 255, 255, 0.3);
1167-
color: #fff;
1168-
}
1169-
1170-
&:focus {
1171-
outline: 2px solid rgba(255, 255, 255, 0.5);
1172-
outline-offset: 2px;
1173-
}
11741199
}
11751200

11761201
.hidden {
@@ -1187,34 +1212,17 @@
11871212
}
11881213
}
11891214

1215+
/* Language selector button - uses nav-button-base design with flex layout */
11901216
.language-select-button {
1191-
color: #fff;
1192-
background: rgba(255, 255, 255, 0.2);
1193-
padding: 8px 20px;
1194-
border-radius: 4px;
1195-
font-weight: 600;
1196-
border: none;
11971217
display: flex;
11981218
align-items: center;
11991219
justify-content: center;
12001220
gap: 0.5rem;
12011221
width: 100%;
1202-
text-align: center;
1203-
cursor: pointer;
1204-
font-size: 0.9em;
1222+
12051223
@media screen and (min-width: 660px) {
1206-
text-align: left;
12071224
width: auto;
12081225
}
1209-
1210-
&:hover {
1211-
background-color: rgba(255, 255, 255, 0.3);
1212-
}
1213-
1214-
&:focus {
1215-
outline: 2px solid rgba(255, 255, 255, 0.5);
1216-
outline-offset: 2px;
1217-
}
12181226
}
12191227

12201228
.language-select-arrow {
@@ -1247,51 +1255,28 @@
12471255
font-size: 0.875rem;
12481256
color: #333;
12491257
transition: background-color 0.2s ease;
1250-
1258+
12511259
&:first-child {
12521260
border-radius: 4px 4px 0 0;
12531261
}
1254-
1262+
12551263
&:last-child {
12561264
border-radius: 0 0 4px 4px;
12571265
}
1258-
1266+
12591267
&:hover {
12601268
background-color: #f3f4f6;
12611269
}
1262-
1270+
12631271
&.language-menu-item-active {
12641272
background-color: #eff6ff;
12651273
font-weight: 600;
12661274
}
12671275
}
12681276

1269-
/* Upload Button */
1270-
.upload-button {
1271-
color: #fff;
1272-
background: rgba(255, 255, 255, 0.2);
1273-
padding: 8px 20px;
1274-
border-radius: 4px;
1275-
font-weight: 600;
1277+
/* Upload Button - uses nav-button-base standard design */
1278+
.upload-button & a:hover {
12761279
text-decoration: none;
1277-
display: block;
1278-
width: 100%;
1279-
text-align: center;
1280-
font-size: 0.9em;
1281-
cursor: pointer;
1282-
@media screen and (min-width: 660px) {
1283-
text-align: left;
1284-
width: auto;
1285-
}
1286-
1287-
&:hover {
1288-
background-color: rgba(255, 255, 255, 0.3);
1289-
}
1290-
1291-
&:focus {
1292-
outline: 2px solid rgba(255, 255, 255, 0.5);
1293-
outline-offset: 2px;
1294-
}
12951280
}
12961281

12971282
.search-results {

0 commit comments

Comments
 (0)