forked from MichaelCurrin/badge-generator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.vue
301 lines (255 loc) · 5.55 KB
/
App.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
<template>
<div>
<header class="container-lg">
<a id="logo" :href="baseUrl">Badge Generator</a>
<div id="nav">
<!-- Build menu based on configured app routes. -->
<!-- Keep router-link on one line for underlining -->
<span v-for="(item, index) in routes" :key="item.path">
<span>{{ index !== 0 ? " | " : "" }}</span>
<router-link :to="item.path">{{ item.name }}</router-link>
</span>
<span class="toggle">
<ThemeToggle />
</span>
</div>
</header>
<router-view />
</div>
</template>
<script lang="ts">
import { defineComponent } from "vue";
import "highlight.js/styles/github-gist.css";
import ThemeToggle from "@/components/ThemeToggle.vue";
import { routes } from "@/router/index";
export default defineComponent({
name: "App",
components: {
ThemeToggle,
},
data() {
return {
routes,
baseUrl: process.env.BASE_URL,
};
},
});
</script>
<style>
:root {
--green: #42b983;
--green-dark: #3aa776;
--grey: #2c3e50;
--element-size: 2.5rem;
color: var(--text-primary-color);
background-color: var(--background-color-primary);
}
:root.light-theme {
--background-color-primary: #ffffff;
--background-color-secondary: #eeeeee;
--accent-color: var(--grey);
--text-primary-color: #222;
}
:root.dark-theme {
--background-color-primary: #1e1e1e;
--background-color-secondary: #3f3f3f;
--accent-color: #e4e4e4;
--text-primary-color: #f3f3f3;
}
/**
* Standard Vue base.
*
* Based on the Vue quickstart app's styles.
*/
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
padding-top: 10px;
}
#nav {
padding-top: 10px;
}
/* Clean-up menu to remove default of underline and then add it back on hover. */
#nav a {
font-weight: bold;
color: var(--green);
text-decoration: none;
}
#nav a:hover {
text-decoration: underline;
color: var(--green-dark);
}
#nav a.router-link-exact-active {
text-decoration: underline;
color: var(--accent-color);
}
.toggle {
display: inline-block;
margin-left: 5px;
}
a {
font-weight: bold;
color: var(--green-dark);
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
/**
* GitHub Pages styles base.
*
* Based on markdown site built on GitHub Pages without Jekyll.
*/
/* Center app. */
.container-lg {
max-width: 1012px;
margin-right: auto;
margin-left: auto;
}
pre {
padding: 12px;
overflow: auto;
line-height: 1.45;
border-radius: 3px;
margin-top: 0;
margin-bottom: 0;
/* This is allows the text to wrap and prevents it from stretching out and causing the flexbox to
reflow when not desired. Using nowrap to go off the screen unfortunately flatten it all to one
line and reflows flexbox. */
white-space: break-spaces;
}
pre code {
display: inline;
max-width: auto;
padding: 0;
margin: 0;
overflow: visible;
line-height: inherit;
word-wrap: normal;
background-color: transparent;
border: 0;
}
code,
kbd,
pre {
font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier,
monospace;
font-size: 0.9em;
background-color: #f6f8fa;
}
kbd {
display: inline-block;
padding: 3px 5px;
font-size: 11px;
line-height: 10px;
color: #444d56;
vertical-align: middle;
background-color: #fafbfc;
border: solid 1px #c6cbd1;
border-bottom-color: #959da5;
border-radius: 3px;
box-shadow: inset 0 -1px 0 #959da5;
}
/* Most of these don't seem to make a visible difference, but, `cursor` here is
the most useful. */
[hidden][hidden] {
display: none !important;
}
details summary {
cursor: pointer;
}
details:not([open]) > *:not(summary) {
display: none !important;
}
summary {
display: list-item;
}
.btn {
cursor: pointer;
}
/**
* Custom - header.
*/
#logo {
font-weight: bold;
font-size: 3em;
text-decoration: none;
color: var(--accent-color);
}
#logo:hover {
text-decoration: underline;
}
#nav {
float: right;
}
.hero {
text-align: center;
}
/**
* Flexbox
*
* Based on GH pages, Bootstrap and the GH Readme Generator. There is a better
* way to do this using
* @media instead of min-width values (the min-width goes off-screen on a really
* small resolution when tested on desktop but this could be unrealistic).
*
* Setting row width as 100% was my own setup to avoid having the col-12 element
* look to narrow on mobile at min-width 200px, unless I set a min-width like
* 300px Setting row width also means min-width can be left off and the col-12
* will still look good instead of very squashed to the left.
*
* In another app I looked at, there was 100% width on the container rather than
* the row, but that did not help here.
*/
.row {
display: -ms-flexbox;
display: flex;
flex-wrap: wrap;
width: 100%;
}
.col-6 {
flex: 1;
padding: 8px;
min-width: 200px;
}
.col-12 {
width: 100%;
min-width: 200px;
}
/**
* Custom - forms.
*/
input {
/* Prevent user-agent stylesheet from making this too small, such as in
Chrome. */
font-size: initial;
}
input:disabled {
cursor: not-allowed;
}
.required {
color: red;
}
.btn {
color: white;
font-size: 21px;
background: linear-gradient(to bottom, var(--green), var(--green-dark));
padding: 10px 20px 10px 20px;
}
.btn:hover {
background: linear-gradient(to top, var(--green), var(--green-dark));
}
.note,
.disabled-text {
color: #666;
}
/**
* Custom - output.
*/
/* Prevent highlight.js CSS from adding white background to `code` when `pre` already has grey
background. */
code {
background: none !important;
}
</style>