Skip to content

Commit aba72ce

Browse files
committed
docs: update theme
1 parent afe6282 commit aba72ce

File tree

4 files changed

+24
-16
lines changed

4 files changed

+24
-16
lines changed

docs/layouts/shortcodes/example.html

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
<div class="docs-example-snippet docs-code-snippet">
2323
{{- if eq $show_preview true -}}
24-
<div{{ with $id }} id="{{ . }}"{{ end }} class="docs-example{{ with $class }} {{ . }}{{ end }}">
24+
<div{{ with $id }} id="{{ . }}"{{ end }} class="docs-example m-0 border-0{{ with $class }} {{ . }}{{ end }}">
2525
{{- $input -}}
2626
</div>
2727
{{- end -}}
@@ -31,9 +31,6 @@
3131
<div class="d-flex align-items-center highlight-toolbar ps-3 pe-2 py-1 border-0 border-top border-bottom">
3232
<small class="font-monospace text-body-secondary text-uppercase">{{- $lang -}}</small>
3333
<div class="d-flex ms-auto">
34-
{{- /*<button type="button" class="btn-edit text-nowrap"{{ with $stackblitz_add_js }} data-sb-js-snippet="{{ $stackblitz_add_js }}"{{ end }} title="Try it on StackBlitz">
35-
<svg class="bi" aria-hidden="true"><use xlink:href="#lightning-charge-fill"/></svg>
36-
</button>*/ -}}
3734
<button type="button" class="btn-clipboard mt-0 me-0" title="Copy to clipboard">
3835
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="16" height="16">
3936
<polygon fill="var(--ci-primary-color, currentColor)" points="408 432 376 432 376 464 112 464 112 136 144 136 144 104 80 104 80 496 408 496 408 432" class="ci-primary"/>

docs/layouts/shortcodes/js-docs.html

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,19 @@
2626
{{- $match = replace $match $capture_start "" -}}
2727
{{- $match = replace $match $capture_end "" -}}
2828

29-
<div class="docs-example-snippet docs-code-snippet">
30-
<div class="docs-clipboard">
31-
<button type="button" class="btn-clipboard" title="Copy to clipboard">
32-
<svg class="bi" aria-hidden="true"><use xlink:href="#clipboard"></use></svg>
33-
</button>
29+
<div class="docs-example-snippet docs-code-snippet docs-file-ref">
30+
<div class="d-flex align-items-center highlight-toolbar ps-3 pe-2 py-1 border-bottom">
31+
<div class="font-monospace link-secondary link-underline-secondary link-underline-opacity-0 link-underline-opacity-100-hover small">
32+
{{- $file -}}
33+
</div>
34+
<div class="d-flex ms-auto">
35+
<button type="button" class="btn-clipboard mt-0 me-0" title="Copy to clipboard">
36+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="16" height="16">
37+
<polygon fill="var(--ci-primary-color, currentColor)" points="408 432 376 432 376 464 112 464 112 136 144 136 144 104 80 104 80 496 408 496 408 432" class="ci-primary"/>
38+
<path fill="var(--ci-primary-color, currentColor)" d="M176,16V400H496V153.373L358.627,16ZM464,368H208V48H312V200H464Zm0-200H344V48h1.372L464,166.627Z" class="ci-primary"/>
39+
</svg>
40+
</button>
41+
</div>
3442
</div>
3543
{{- $unindent := 0 -}}
3644
{{- $found := false -}}

docs/layouts/shortcodes/scss-docs.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@
3939
{{- $match = replace $match " !default" "" -}}
4040
{{- end -}}
4141

42-
<div class="docs-example-snippet docs-code-snippet docs-scss-docs">
42+
<div class="docs-example-snippet docs-code-snippet docs-file-ref">
4343
<div class="d-flex align-items-center highlight-toolbar ps-3 pe-2 py-1 border-bottom">
44-
<a class="font-monospace link-secondary link-underline-secondary link-underline-opacity-0 link-underline-opacity-100-hover small" href="{{ .Site.Params.repo }}/blob/v{{ .Site.Params.current_version }}/{{ $file | replaceRE `\\` "/" }}">
44+
<div class="font-monospace link-secondary link-underline-secondary link-underline-opacity-0 link-underline-opacity-100-hover small">
4545
{{- $file -}}
46-
</a>
46+
</div>
4747
<div class="d-flex ms-auto">
4848
<button type="button" class="btn-clipboard mt-0 me-0" title="Copy to clipboard">
4949
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="16" height="16">

docs/static/assets/js/color-modes.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,19 @@
99

1010
const THEME = 'coreui-docs-theme'
1111

12-
const storedTheme = localStorage.getItem(THEME)
12+
const getStoredTheme = () => localStorage.getItem(THEME)
13+
const setStoredTheme = theme => localStorage.setItem(THEME, theme)
1314

1415
const getPreferredTheme = () => {
16+
const storedTheme = getStoredTheme()
1517
if (storedTheme) {
1618
return storedTheme
1719
}
1820

1921
return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'
2022
}
2123

22-
const setTheme = function (theme) {
24+
const setTheme = theme => {
2325
if (theme === 'auto' && window.matchMedia('(prefers-color-scheme: dark)').matches) {
2426
document.documentElement.setAttribute('data-coreui-theme', 'dark')
2527
} else {
@@ -43,7 +45,8 @@
4345
}
4446

4547
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => {
46-
if (storedTheme !== 'light' || storedTheme !== 'dark') {
48+
const storedTheme = getStoredTheme()
49+
if (storedTheme !== 'light' && storedTheme !== 'dark') {
4750
setTheme(getPreferredTheme())
4851
}
4952
})
@@ -55,7 +58,7 @@
5558
.forEach(toggle => {
5659
toggle.addEventListener('click', () => {
5760
const theme = toggle.getAttribute('data-coreui-theme-value')
58-
localStorage.setItem(THEME, theme)
61+
setStoredTheme(theme)
5962
setTheme(theme)
6063
showActiveTheme(theme)
6164
})

0 commit comments

Comments
 (0)