Skip to content

Commit ed1c854

Browse files
luizdepraJianLoong
andauthored
And notice shortcodes (luizdepra#537)
* Added information panel shortcodes (luizdepra#437) * Added information panel shortcodes * Fixed dark mixin * Moved mixin location to correct location Co-authored-by: Luiz F. A. de Prá <[email protected]> * Fix SCSS styling * Update generated files * Fix notice HTML * Fix Makefile * Rename JS file * Adsd emoji support for lang selectors * Fix notices and other things * Fix JS on template * Update example content * Update images * Update generated files * Fix netlify preview * Fix netlify preview build * Fix netlify theme path Co-authored-by: Jian Liew <[email protected]>
1 parent 32ffc53 commit ed1c854

File tree

72 files changed

+8661
-2164
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+8661
-2164
lines changed

.gitignore

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
**/themes/
2-
demo/
3-
.hugo/*
4-
!.hugo/version
2+
exampleSite/public/
3+
exampleSite/resources/

Makefile

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,12 @@
11
HUGO_BIN=hugo
22

3-
.PHONY: prepare release build demo clean
3+
.PHONY: build demo release
44

5-
build: prepare
6-
$(HUGO_BIN) --source demo
5+
build:
6+
$(HUGO_BIN) --themesDir=../.. --source=exampleSite
77

8-
demo: prepare
9-
$(HUGO_BIN) server --buildDrafts --source demo
8+
demo:
9+
$(HUGO_BIN) server -D --themesDir=../.. --source=exampleSite
1010

1111
release: build
12-
rm -rf ./resources && cp -r ./demo/resources ./resources
13-
14-
prepare: clean
15-
mkdir -p demo/themes/hugo-coder
16-
rsync -av exampleSite/ demo
17-
rsync -av --exclude='demo' --exclude='exampleSite' --exclude='.git' . demo/themes/hugo-coder
18-
19-
clean:
20-
rm -rf demo
12+
rm -rf ./resources && cp -r ./exampleSite/resources ./resources

assets/js/coder.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
const body = document.body;
2+
const darkModeToggle = document.getElementById('dark-mode-toggle');
3+
const darkModeMediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
4+
5+
// Check if user preference is set, if not check value of body class for light or dark else it means that colorscheme = auto
6+
if (localStorage.getItem("colorscheme")) {
7+
setTheme(localStorage.getItem("colorscheme"));
8+
} else if (body.classList.contains('colorscheme-light') || body.classList.contains('colorscheme-dark')) {
9+
setTheme(body.classList.contains("colorscheme-dark") ? "dark" : "light");
10+
} else {
11+
setTheme(darkModeMediaQuery.matches ? "dark" : "light");
12+
}
13+
14+
darkModeToggle.addEventListener('click', () => {
15+
setTheme(body.classList.contains("colorscheme-dark") ? "light" : "dark");
16+
});
17+
18+
darkModeMediaQuery.addListener((event) => {
19+
setTheme(event.matches ? "dark" : "light");
20+
});
21+
22+
document.addEventListener("DOMContentLoaded", function () {
23+
let node = document.querySelector('.preload-transitions');
24+
node.classList.remove('preload-transitions');
25+
});
26+
27+
function setTheme(theme) {
28+
body.classList.remove('colorscheme-auto');
29+
inverse = theme === 'dark' ? 'light' : 'dark';
30+
localStorage.setItem('colorscheme', theme);
31+
body.classList.remove('colorscheme-' + inverse);
32+
body.classList.add('colorscheme-' + theme);
33+
}

assets/js/dark-mode.js

Lines changed: 0 additions & 28 deletions
This file was deleted.

assets/scss/_base.scss

Lines changed: 63 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
*,
22
*:after,
33
*:before {
4-
box-sizing: inherit;
4+
box-sizing: inherit;
55
}
66

77
html {
8-
box-sizing: border-box;
9-
font-size: 62.5%;
8+
box-sizing: border-box;
9+
font-size: 62.5%;
1010
}
1111

1212
body {
1313
color: $fg-color;
1414
background-color: $bg-color;
15-
font-family: $font-family;
16-
font-size: 1.8em;
17-
font-weight: 400;
15+
font-family: $font-family;
16+
font-size: 1.8em;
17+
font-weight: 400;
1818
line-height: 1.8em;
19-
@media only screen and (max-width : 768px) {
19+
20+
@media only screen and (max-width: 768px) {
2021
font-size: 1.6em;
2122
line-height: 1.6em;
2223
}
@@ -26,15 +27,16 @@ a {
2627
font-weight: 500;
2728
color: $link-color;
2829
text-decoration: none;
29-
transition: all .25s ease-in;
30+
transition: all 0.25s ease-in;
31+
3032
&:focus,
3133
&:hover {
3234
text-decoration: underline;
3335
}
3436
}
3537

3638
p {
37-
margin: 2.0rem 0 2.0rem 0;
39+
margin: 2rem 0 2rem 0;
3840
}
3941

4042
h1,
@@ -70,58 +72,70 @@ h6 {
7072
h1 {
7173
font-size: 3.2rem;
7274
line-height: 3.6rem;
73-
@media only screen and (max-width : 768px) {
74-
font-size: 3.0rem;
75+
76+
@media only screen and (max-width: 768px) {
77+
font-size: 3rem;
7578
line-height: 3.4rem;
7679
}
7780
}
81+
7882
h2 {
7983
font-size: 2.8rem;
8084
line-height: 3.2rem;
81-
@media only screen and (max-width : 768px) {
85+
86+
@media only screen and (max-width: 768px) {
8287
font-size: 2.6rem;
83-
line-height: 3.0rem;
88+
line-height: 3rem;
8489
}
8590
}
91+
8692
h3 {
8793
font-size: 2.4rem;
8894
line-height: 2.8rem;
89-
@media only screen and (max-width : 768px) {
95+
96+
@media only screen and (max-width: 768px) {
9097
font-size: 2.2rem;
9198
line-height: 2.6rem;
9299
}
93100
}
101+
94102
h4 {
95103
font-size: 2.2rem;
96104
line-height: 2.6rem;
97-
@media only screen and (max-width : 768px) {
98-
font-size: 2.0rem;
105+
106+
@media only screen and (max-width: 768px) {
107+
font-size: 2rem;
99108
line-height: 2.4rem;
100109
}
101110
}
111+
102112
h5 {
103-
font-size: 2.0rem;
113+
font-size: 2rem;
104114
line-height: 2.4rem;
105-
@media only screen and (max-width : 768px) {
115+
116+
@media only screen and (max-width: 768px) {
106117
font-size: 1.8rem;
107118
line-height: 2.2rem;
108119
}
109120
}
121+
110122
h6 {
111123
font-size: 1.8rem;
112124
line-height: 2.2rem;
113-
@media only screen and (max-width : 768px) {
125+
126+
@media only screen and (max-width: 768px) {
114127
font-size: 1.6rem;
115-
line-height: 2.0rem;
128+
line-height: 2rem;
116129
}
117130
}
118131

119-
b, strong {
132+
b,
133+
strong {
120134
font-weight: 700;
121135
}
122136

123-
.highlight > div,
124-
.highlight > pre {
137+
.highlight>div,
138+
.highlight>pre {
125139
margin: 0 0 2rem;
126140
padding: 1rem;
127141
border-radius: 1rem;
@@ -135,6 +149,7 @@ pre {
135149
line-height: 2.6rem;
136150
overflow-x: auto;
137151
margin: 0;
152+
138153
code {
139154
display: inline-block;
140155
background-color: inherit;
@@ -152,31 +167,39 @@ code {
152167

153168
blockquote {
154169
border-left: 2px solid $alt-bg-color;
155-
padding-left: 2.0rem;
170+
padding-left: 2rem;
156171
line-height: 2.2rem;
157172
font-weight: 400;
158173
font-style: italic;
159174
}
160175

161-
th, td {
176+
th,
177+
td {
162178
padding: 1.6rem;
163179
}
180+
164181
table {
165182
border-collapse: collapse;
166183
}
167-
table td, table th {
184+
185+
table td,
186+
table th {
168187
border: 2px solid $alt-fg-color;
169188
}
189+
170190
table tr:first-child th {
171191
border-top: 0;
172192
}
193+
173194
table tr:last-child td {
174195
border-bottom: 0;
175196
}
197+
176198
table tr td:first-child,
177199
table tr th:first-child {
178200
border-left: 0;
179201
}
202+
180203
table tr td:last-child,
181204
table tr th:last-child {
182205
border-right: 0;
@@ -190,6 +213,16 @@ figure {
190213
text-align: center;
191214
}
192215

216+
.preload-transitions * {
217+
$null-transition: none !important;
218+
219+
-webkit-transition: $null-transition;
220+
-moz-transition: $null-transition;
221+
-ms-transition: $null-transition;
222+
-o-transition: $null-transition;
223+
transition: $null-transition;
224+
}
225+
193226
.wrapper {
194227
display: flex;
195228
flex-direction: column;
@@ -200,10 +233,10 @@ figure {
200233

201234
.container {
202235
margin: 0 auto;
203-
max-width: 90.0rem;
236+
max-width: 90rem;
204237
width: 100%;
205-
padding-left: 2.0rem;
206-
padding-right: 2.0rem;
238+
padding-left: 2rem;
239+
padding-right: 2rem;
207240
}
208241

209242
.fab {
@@ -233,6 +266,6 @@ figure {
233266
img.emoji {
234267
height: 1em;
235268
width: 1em;
236-
margin: 0 .05em 0 .1em;
269+
margin: 0 0.05em 0 0.1em;
237270
vertical-align: -0.1em;
238271
}

assets/scss/_base_dark.scss

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
@mixin base_dark {
2-
32
color: $fg-color-dark;
43
background-color: $bg-color-dark;
54

@@ -50,18 +49,18 @@
5049
border-left: 2px solid $alt-bg-color-dark;
5150
}
5251

53-
table td, table th {
52+
table td,
53+
table th {
5454
border: 2px solid $alt-fg-color-dark;
5555
}
56-
5756
}
5857

5958
body.colorscheme-dark {
60-
@include base_dark()
59+
@include base_dark();
6160
}
6261

6362
body.colorscheme-auto {
6463
@media (prefers-color-scheme: dark) {
65-
@include base_dark()
64+
@include base_dark();
6665
}
6766
}

assets/scss/_base_rtl.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ body.rtl {
1616
table tr th:first-child {
1717
border-right: 0;
1818
}
19+
1920
table tr td:last-child,
2021
table tr th:last-child {
2122
border-left: 0;

0 commit comments

Comments
 (0)