File tree Expand file tree Collapse file tree 5 files changed +162
-11
lines changed Expand file tree Collapse file tree 5 files changed +162
-11
lines changed Original file line number Diff line number Diff line change 2
2
* Vuejs & TailwindCSS Portfolio Main Styling CSS File
3
3
* Powered by: @NangialaiStoman
4
4
*/
5
+
6
+ .theme-light {
7
+ --bg-background-primary : white;
8
+ --bg-background-secondary : # f7fafc ;
9
+ --bg-background-tertiary : # e2e8f0 ;
10
+
11
+ --bg-background-form : white;
12
+
13
+ --text-copy-primary : # 2d3748 ;
14
+ --text-copy-secondary : # 4a5568 ;
15
+
16
+ --border-border-color-primary : white;
17
+ }
18
+
19
+ .theme-light .search-highlighted {
20
+ background : # f0fff4 ;
21
+ }
22
+
23
+ .theme-light .search-hover : hover {
24
+ background : # f0fff4 ;
25
+ }
26
+
27
+ .theme-dark .markdown-body {
28
+ color : # 24292e ;
29
+ }
30
+
31
+ .theme-dark .search-highlighted {
32
+ background : # 2d3748 ;
33
+ }
34
+
35
+ .theme-dark .search-hover : hover {
36
+ background : # 2d3748 ;
37
+ }
38
+
39
+ .theme-dark {
40
+ --bg-background-primary : # 0d2438 ;
41
+ --bg-background-secondary : # 102c44 ;
42
+ --bg-background-tertiary : # 1e3951 ;
43
+
44
+ --bg-background-form : # 1a202c ;
45
+
46
+ --text-copy-primary : # cbd5e0 ;
47
+ --text-copy-secondary : # e2e8f0 ;
48
+
49
+ --border-border-color-primary : # 1a202c ;
50
+ }
51
+
52
+ .theme-dark .markdown-body {
53
+ color : # cbd5e0 ;
54
+ }
55
+
56
+ .theme-dark nav .active {
57
+ @apply border-white border-b;
58
+ }
59
+
60
+ .content-wrapper {
61
+ transition : background-color 0.25s ;
62
+ }
Original file line number Diff line number Diff line change
1
+ <template >
2
+ <a
3
+ href =" #"
4
+ class =" text-copy-primary hover:text-gray-600"
5
+ @click.prevent =" toggleTheme"
6
+ data-cypress =" switchTheme"
7
+ >
8
+ <svg
9
+ v-if =" theme === 'theme-light'"
10
+ xmlns =" http://www.w3.org/2000/svg"
11
+ width =" 24"
12
+ height =" 24"
13
+ fill =" none"
14
+ stroke =" currentColor"
15
+ stroke-width =" 2"
16
+ stroke-linecap =" round"
17
+ stroke-linejoin =" round"
18
+ class =" feather feather-moon"
19
+ >
20
+ <path d =" M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" />
21
+ </svg >
22
+ <svg
23
+ v-else
24
+ xmlns =" http://www.w3.org/2000/svg"
25
+ width =" 24"
26
+ height =" 24"
27
+ fill =" none"
28
+ stroke =" currentColor"
29
+ stroke-width =" 2"
30
+ stroke-linecap =" round"
31
+ stroke-linejoin =" round"
32
+ class =" feather feather-sun"
33
+ >
34
+ <circle cx =" 12" cy =" 12" r =" 5" />
35
+ <path
36
+ d =" M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42"
37
+ />
38
+ </svg >
39
+ </a >
40
+ </template >
41
+
42
+ <script >
43
+ export default {
44
+ props: {
45
+ theme: {
46
+ type: String ,
47
+ required: true ,
48
+ },
49
+ },
50
+ methods: {
51
+ toggleTheme () {
52
+ const newTheme =
53
+ this .theme === ' theme-light' ? ' theme-dark' : ' theme-light' ;
54
+ localStorage .setItem (' theme' , newTheme);
55
+ this .$emit (' themeChanged' , newTheme);
56
+ },
57
+ },
58
+ };
59
+ </script >
Original file line number Diff line number Diff line change 1
1
<template >
2
- <nav id =" nav" class =" container mx-auto bg-white" >
2
+ <nav id =" nav" class =" container mx-auto bg-white" :class = " theme " >
3
3
<div class =" md:flex items-center justify-between my-6" >
4
4
<div class =" flex justify-between items-center" >
5
5
<div class =" text-2xl font-bold text-gray-800 md:text-3xl" >
52
52
Hire Me
53
53
</button >
54
54
</div >
55
- <div
56
- class =" sm:ml-7 bg-gray-50 p-2 rounded-lg shadow-sm cursor-pointer"
57
- >
58
- <a href =" #"
59
- ><i
60
- data-feather =" moon"
61
- class =" text-gray-500 hover:text-gray-400"
62
- ></i
63
- ></a >
55
+ <div >
56
+ <theme-switcher
57
+ :theme =" theme"
58
+ @themeChanged =" updateTheme"
59
+ />
64
60
</div >
65
61
</div >
66
62
</div >
69
65
70
66
<script >
71
67
import feather from ' feather-icons' ;
68
+ import ThemeSwitcher from ' ../ThemeSwitcher.vue' ;
69
+
72
70
export default {
71
+ components: {
72
+ ThemeSwitcher,
73
+ },
74
+ data () {
75
+ return {
76
+ isOpen: false ,
77
+ theme: ' ' ,
78
+ };
79
+ },
80
+ toggle () {
81
+ this .isOpen = ! this .isOpen ;
82
+ },
83
+ updateTheme (theme ) {
84
+ this .theme = theme;
85
+ },
73
86
mounted () {
74
87
feather .replace ();
88
+ this .theme = localStorage .getItem (' theme' ) || ' theme-light' ;
75
89
},
76
90
updated () {
77
91
feather .replace ();
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import { createApp } from 'vue';
2
2
import App from './App.vue' ;
3
3
import router from './router' ;
4
4
import './assets/css/tailwind.css' ;
5
+ import './assets/css/app.css' ;
5
6
6
7
const feather = require ( 'feather-icons' ) ;
7
8
feather . replace ( ) ;
Original file line number Diff line number Diff line change @@ -14,7 +14,26 @@ module.exports = {
14
14
} ,
15
15
} ,
16
16
variants : {
17
- extend : { } ,
17
+ extend : {
18
+ colors : {
19
+ background : {
20
+ primary : 'var(--bg-background-primary)' ,
21
+ secondary : 'var(--bg-background-secondary)' ,
22
+ tertiary : 'var(--bg-background-tertiary)' ,
23
+
24
+ form : 'var(--bg-background-form)' ,
25
+ } ,
26
+
27
+ copy : {
28
+ primary : 'var(--text-copy-primary)' ,
29
+ secondary : 'var(--text-copy-hover)' ,
30
+ } ,
31
+
32
+ 'border-color' : {
33
+ primary : 'var(--border-border-color-primary)' ,
34
+ } ,
35
+ } ,
36
+ } ,
18
37
} ,
19
38
plugins : [
20
39
require ( '@tailwindcss/forms' ) ( {
You can’t perform that action at this time.
0 commit comments