Skip to content

Commit 0329537

Browse files
committed
feat: AppLoadingBar; add tw config
1 parent daecd82 commit 0329537

File tree

9 files changed

+317
-77
lines changed

9 files changed

+317
-77
lines changed

app.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
import tokens from './tokens.config'
2+
13
export default defineAppConfig({
4+
tokens,
25
alpine: {
36
title: 'Alpine',
47
description: 'The minimalist blog theme',

assets/main.css

Lines changed: 64 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,69 @@
1-
body {
1+
2+
/* Use colors from tailwind.config.ts orange */
3+
:root {
4+
/* --color-primary-50: #FFF7F2;
5+
--color-primary-100: #FFEFE5;
6+
--color-primary-200: #FFE5D7;
7+
--color-primary-300: #FDAC7E;
8+
--color-primary-400: #FC8E51;
9+
--color-primary-500: #FA630E;
10+
--color-primary-600: #7E3004;
11+
--color-primary-700: #3F1802;
12+
--color-primary-800: #2D1102;
13+
--color-primary-900: #1A0A01;
14+
--color-secondary-50: #F8F5FF;
15+
--color-secondary-100: #F1ECFF;
16+
--color-secondary-200: #E5DCFF;
17+
--color-secondary-300: #A589F9;
18+
--color-secondary-400: #8961FD;
19+
--color-secondary-500: #6B39FA;
20+
--color-secondary-600: #370DAD;
21+
--color-secondary-700: #200273;
22+
--color-secondary-800: #14014A;
23+
--color-secondary-900: #080020; */
24+
25+
--color-black: 14 13 13;
26+
27+
--color-primary-50: 242 250 255;
28+
--color-primary-100: 226 244 255;
29+
--color-primary-200: 208 238 255;
30+
--color-primary-300: 161 221 255;
31+
--color-primary-400: 100 199 255;
32+
--color-primary-500: 26 173 255;
33+
--color-primary-600: 1 101 158;
34+
--color-primary-700: 1 56 88;
35+
--color-primary-800: 0 34 53;
36+
--color-primary-900: 0 19 29;
37+
--color-secondary-50: 248 245 255;
38+
--color-secondary-100: 241 236 255;
39+
--color-secondary-200: 229 220 255;
40+
--color-secondary-300: 165 137 249;
41+
--color-secondary-400: 137 97 253;
42+
--color-secondary-500: 107 57 250;
43+
--color-secondary-600: 55 13 173;
44+
--color-secondary-700: 32 2 115;
45+
--color-secondary-800: 20 1 74;
46+
--color-secondary-900: 8 0 32;
47+
48+
--color-gray-50: 251 251 251;
49+
--color-gray-100: 243 243 242;
50+
--color-gray-200: 236 235 232;
51+
--color-gray-300: 219 217 211;
52+
--color-gray-400: 173 169 164;
53+
--color-gray-500: 151 148 143;
54+
--color-gray-600: 61 59 56;
55+
--color-gray-700: 41 39 36;
56+
--color-gray-800: 28 27 25;
57+
--color-gray-900: 18 17 16;
58+
59+
--color-shadow: var(--color-gray-400);
60+
}
61+
62+
63+
/* body {
264
background-color: $dt('alpine.body.backgroundColor');
365
color: $dt('alpine.body.color');
4-
}
66+
} */
567

668
/* Color scheme images helper classes */
769
.light-img {

components/AppLayout.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ useContentHead(alpine as any)
2020
<template>
2121
<div>
2222
<!-- <Container class="app-layout"> -->
23-
<!-- <AppLoadingBar /> -->
23+
<AppLoadingBar />
2424
<!-- <AppHeader v-if="alpine.header" /> -->
2525
<slot />
2626
<!-- <AppFooter v-if="alpine.footer" /> -->
Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
<script setup>
2-
import { useNuxtApp, onBeforeUnmount, reactive } from '#imports'
1+
<script setup lang="ts">
2+
import appConfig from '#build/app.config'
3+
4+
const { tokens } = appConfig
35
46
const props = defineProps({
57
throttle: {
@@ -10,10 +12,6 @@ const props = defineProps({
1012
type: Number,
1113
default: 2000
1214
},
13-
height: {
14-
type: Number,
15-
default: 3
16-
}
1715
})
1816
1917
const nuxtApp = useNuxtApp()
@@ -81,30 +79,19 @@ onBeforeUnmount(() => clear)
8179

8280
<template>
8381
<div
84-
class="nuxt-progress"
85-
:class="{
86-
'nuxt-progress-failed': !data.canSucceed,
87-
}"
82+
class="nuxt-progress fixed top-0 start-0 end-0 w-0 opacity-100 z-[9999]"
83+
:class="['nuxt-progress-failed' && !data.canSucceed, tokens.loadingBar.height, tokens.loadingBar.backgroundImage]"
8884
:style="{
8985
width: `${data.percent}%`,
90-
left: data.left,
91-
height: `${props.height}px`,
86+
insetInlineStart: data.left,
9287
opacity: data.show ? 1 : 0,
9388
backgroundSize: `${(100 / data.percent) * 100}% auto`,
9489
}"
9590
/>
9691
</template>
9792

98-
<style>
93+
<style scoped>
9994
.nuxt-progress {
100-
position: fixed;
101-
top: 0px;
102-
left: 0px;
103-
right: 0px;
104-
width: 0%;
105-
opacity: 1;
10695
transition: width 0.1s, height 0.4s, opacity 0.4s;
107-
background: repeating-linear-gradient(to right, #00dc82 0%, #34cdfe 50%, #0047e1 100%);
108-
z-index: 999999;
10996
}
11097
</style>

nuxt.config.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,17 @@ export default defineNuxtConfig({
4141
pages: true,
4242
modules: [
4343
envModules.studio,
44+
'@nuxtjs/color-mode',
45+
'@nuxtjs/tailwindcss',
4446
'@nuxt/content',
4547
updateModule as any
4648
],
47-
// components: [
48-
// { path: resolve('./components'), global: true },
49+
components: [
50+
{ path: resolve('./components'), global: true },
51+
{ path: resolve('./components/app'), global: true },
4952
// { path: resolve('./components/content'), global: true },
5053
// { path: resolve('./components/data-entry'), global: true }
51-
// ],
54+
],
5255
css: [
5356
resolve('./assets/main.css'),
5457
],

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
"dependencies": {
2929
"@nuxt/content": "^2.7.0",
3030
"@nuxthq/studio": "^0.13.3",
31+
"@nuxtjs/color-mode": "^3.3.0",
32+
"@nuxtjs/tailwindcss": "^6.8.0",
3133
"@vueuse/core": "^10.2.1",
3234
"ufo": "^1.1.2"
3335
},

pinceau.tokens.config.ts

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import theme from '@nuxt-themes/tokens/config'
2+
import { defineTheme } from 'pinceau'
3+
4+
export default defineTheme({
5+
alpine: {
6+
$schema: {
7+
title: 'All the configurable tokens from Alpine.',
8+
tags: [
9+
'@studio-icon carbon:blog'
10+
]
11+
},
12+
body: {
13+
backgroundColor: {
14+
initial: '{color.white}',
15+
dark: '{color.black}'
16+
},
17+
color: {
18+
initial: '{color.gray.800}',
19+
dark: '{color.gray.200}'
20+
}
21+
},
22+
backdrop: {
23+
backgroundColor: {
24+
initial: '#f4f4f5b3', // TODO: rgba({color.gray.100}, 0.7)
25+
dark: '#18181bb3' // TODO: rgba({color.gray.900}, 0.7)
26+
}
27+
},
28+
readableLine: '68ch'
29+
},
30+
elements: {
31+
container: {
32+
maxWidth: '64rem',
33+
padding: {
34+
mobile: '{space.6}',
35+
xs: '{space.8}',
36+
sm: '{space.12}',
37+
md: '{space.16}'
38+
}
39+
}
40+
},
41+
color: {
42+
white: '#FFFFFF',
43+
// @ts-ignore
44+
primary: theme.color.lightblue
45+
},
46+
prose: {
47+
p: {
48+
fontSize: '18px'
49+
},
50+
}
51+
})

0 commit comments

Comments
 (0)