From 57002ef7de13f46f4a1e873b4293f38dbdd635f6 Mon Sep 17 00:00:00 2001 From: creme332 <65414576+creme332@users.noreply.github.com> Date: Tue, 9 Jul 2024 21:41:46 +0400 Subject: [PATCH 1/3] add default picocss theme --- public/js_original/global-view.js | 1 + public/styles/theme.css | 327 ++++++++++++++++++++++++++++++ 2 files changed, 328 insertions(+) create mode 100644 public/styles/theme.css diff --git a/public/js_original/global-view.js b/public/js_original/global-view.js index b0258f07..61274b18 100644 --- a/public/js_original/global-view.js +++ b/public/js_original/global-view.js @@ -1,5 +1,6 @@ import "@picocss/pico/css/pico.min.css"; import "../styles/global.css"; +import "../styles/theme.css"; import themeSwitcher from "./theme-switcher"; themeSwitcher.init(); diff --git a/public/styles/theme.css b/public/styles/theme.css new file mode 100644 index 00000000..7af639e8 --- /dev/null +++ b/public/styles/theme.css @@ -0,0 +1,327 @@ +/** + * Custom modifications made to the default picocss theme + */ + +[data-theme=light], +:root:not([data-theme=dark]) { + --background-color: #fff; + --color: hsl(205, 20%, 32%); + --h1-color: hsl(205, 30%, 15%); + --h2-color: #24333e; + --h3-color: hsl(205, 25%, 23%); + --h4-color: #374956; + --h5-color: hsl(205, 20%, 32%); + --h6-color: #4d606d; + --muted-color: hsl(205, 10%, 50%); + --muted-border-color: hsl(205, 20%, 94%); + --primary: hsl(195, 85%, 41%); + --primary-hover: hsl(195, 90%, 32%); + --primary-focus: rgba(16, 149, 193, 0.125); + --primary-inverse: #fff; + --secondary: hsl(205, 15%, 41%); + --secondary-hover: hsl(205, 20%, 32%); + --secondary-focus: rgba(89, 107, 120, 0.125); + --secondary-inverse: #fff; + --contrast: hsl(205, 30%, 15%); + --contrast-hover: #000; + --contrast-focus: rgba(89, 107, 120, 0.125); + --contrast-inverse: #fff; + --mark-background-color: #fff2ca; + --mark-color: #543a26; + --ins-color: #388e3c; + --del-color: #c62828; + --blockquote-border-color: var(--muted-border-color); + --blockquote-footer-color: var(--muted-color); + --button-box-shadow: 0 0 0 rgba(0, 0, 0, 0); + --button-hover-box-shadow: 0 0 0 rgba(0, 0, 0, 0); + --form-element-background-color: transparent; + --form-element-border-color: hsl(205, 14%, 68%); + --form-element-color: var(--color); + --form-element-placeholder-color: var(--muted-color); + --form-element-active-background-color: transparent; + --form-element-active-border-color: var(--primary); + --form-element-focus-color: var(--primary-focus); + --form-element-disabled-background-color: hsl(205, 18%, 86%); + --form-element-disabled-border-color: hsl(205, 14%, 68%); + --form-element-disabled-opacity: 0.5; + --form-element-invalid-border-color: #c62828; + --form-element-invalid-active-border-color: #d32f2f; + --form-element-invalid-focus-color: rgba(211, 47, 47, 0.125); + --form-element-valid-border-color: #388e3c; + --form-element-valid-active-border-color: #43a047; + --form-element-valid-focus-color: rgba(67, 160, 71, 0.125); + --switch-background-color: hsl(205, 16%, 77%); + --switch-color: var(--primary-inverse); + --switch-checked-background-color: var(--primary); + --range-border-color: hsl(205, 18%, 86%); + --range-active-border-color: hsl(205, 16%, 77%); + --range-thumb-border-color: var(--background-color); + --range-thumb-color: var(--secondary); + --range-thumb-hover-color: var(--secondary-hover); + --range-thumb-active-color: var(--primary); + --table-border-color: var(--muted-border-color); + --table-row-stripped-background-color: #f6f8f9; + --code-background-color: hsl(205, 20%, 94%); + --code-color: var(--muted-color); + --code-kbd-background-color: var(--contrast); + --code-kbd-color: var(--contrast-inverse); + --code-tag-color: hsl(330, 40%, 50%); + --code-property-color: hsl(185, 40%, 40%); + --code-value-color: hsl(40, 20%, 50%); + --code-comment-color: hsl(205, 14%, 68%); + --accordion-border-color: var(--muted-border-color); + --accordion-close-summary-color: var(--color); + --accordion-open-summary-color: var(--muted-color); + --card-background-color: var(--background-color); + --card-border-color: var(--muted-border-color); + --card-box-shadow: 0.0145rem 0.029rem 0.174rem rgba(27, 40, 50, 0.01698), + 0.0335rem 0.067rem 0.402rem rgba(27, 40, 50, 0.024), + 0.0625rem 0.125rem 0.75rem rgba(27, 40, 50, 0.03), + 0.1125rem 0.225rem 1.35rem rgba(27, 40, 50, 0.036), + 0.2085rem 0.417rem 2.502rem rgba(27, 40, 50, 0.04302), + 0.5rem 1rem 6rem rgba(27, 40, 50, 0.06), + 0 0 0 0.0625rem rgba(27, 40, 50, 0.015); + --card-sectionning-background-color: #fbfbfc; + --dropdown-background-color: #fbfbfc; + --dropdown-border-color: #e1e6eb; + --dropdown-box-shadow: var(--card-box-shadow); + --dropdown-color: var(--color); + --dropdown-hover-background-color: hsl(205, 20%, 94%); + --modal-overlay-background-color: rgba(213, 220, 226, 0.7); + --progress-background-color: hsl(205, 18%, 86%); + --progress-color: var(--primary); + --loading-spinner-opacity: 0.5; + --tooltip-background-color: var(--contrast); + --tooltip-color: var(--contrast-inverse); + --icon-checkbox: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(255, 255, 255)' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E"); + --icon-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(65, 84, 98)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E"); + --icon-chevron-button: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(255, 255, 255)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E"); + --icon-chevron-button-inverse: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(255, 255, 255)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E"); + --icon-close: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(115, 130, 140)' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='18' y1='6' x2='6' y2='18'%3E%3C/line%3E%3Cline x1='6' y1='6' x2='18' y2='18'%3E%3C/line%3E%3C/svg%3E"); + --icon-date: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(65, 84, 98)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'%3E%3C/rect%3E%3Cline x1='16' y1='2' x2='16' y2='6'%3E%3C/line%3E%3Cline x1='8' y1='2' x2='8' y2='6'%3E%3C/line%3E%3Cline x1='3' y1='10' x2='21' y2='10'%3E%3C/line%3E%3C/svg%3E"); + --icon-invalid: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(198, 40, 40)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cline x1='12' y1='8' x2='12' y2='12'%3E%3C/line%3E%3Cline x1='12' y1='16' x2='12.01' y2='16'%3E%3C/line%3E%3C/svg%3E"); + --icon-minus: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(255, 255, 255)' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='5' y1='12' x2='19' y2='12'%3E%3C/line%3E%3C/svg%3E"); + --icon-search: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(65, 84, 98)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E"); + --icon-time: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(65, 84, 98)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cpolyline points='12 6 12 12 16 14'%3E%3C/polyline%3E%3C/svg%3E"); + --icon-valid: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(56, 142, 60)' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E"); + color-scheme: light; +} + +@media only screen and (prefers-color-scheme: dark) { + :root:not([data-theme]) { + --background-color: #11191f; + --color: hsl(205, 16%, 77%); + --h1-color: hsl(205, 20%, 94%); + --h2-color: #e1e6eb; + --h3-color: hsl(205, 18%, 86%); + --h4-color: #c8d1d8; + --h5-color: hsl(205, 16%, 77%); + --h6-color: #afbbc4; + --muted-color: hsl(205, 10%, 50%); + --muted-border-color: #1f2d38; + --primary: hsl(195, 85%, 41%); + --primary-hover: hsl(195, 80%, 50%); + --primary-focus: rgba(16, 149, 193, 0.25); + --primary-inverse: #fff; + --secondary: hsl(205, 15%, 41%); + --secondary-hover: hsl(205, 10%, 50%); + --secondary-focus: rgba(115, 130, 140, 0.25); + --secondary-inverse: #fff; + --contrast: hsl(205, 20%, 94%); + --contrast-hover: #fff; + --contrast-focus: rgba(115, 130, 140, 0.25); + --contrast-inverse: #000; + --mark-background-color: #d1c284; + --mark-color: #11191f; + --ins-color: #388e3c; + --del-color: #c62828; + --blockquote-border-color: var(--muted-border-color); + --blockquote-footer-color: var(--muted-color); + --button-box-shadow: 0 0 0 rgba(0, 0, 0, 0); + --button-hover-box-shadow: 0 0 0 rgba(0, 0, 0, 0); + --form-element-background-color: #11191f; + --form-element-border-color: #374956; + --form-element-color: var(--color); + --form-element-placeholder-color: var(--muted-color); + --form-element-active-background-color: var(--form-element-background-color); + --form-element-active-border-color: var(--primary); + --form-element-focus-color: var(--primary-focus); + --form-element-disabled-background-color: hsl(205, 25%, 23%); + --form-element-disabled-border-color: hsl(205, 20%, 32%); + --form-element-disabled-opacity: 0.5; + --form-element-invalid-border-color: #b71c1c; + --form-element-invalid-active-border-color: #c62828; + --form-element-invalid-focus-color: rgba(198, 40, 40, 0.25); + --form-element-valid-border-color: #2e7d32; + --form-element-valid-active-border-color: #388e3c; + --form-element-valid-focus-color: rgba(56, 142, 60, 0.25); + --switch-background-color: #374956; + --switch-color: var(--primary-inverse); + --switch-checked-background-color: var(--primary); + --range-border-color: #24333e; + --range-active-border-color: hsl(205, 25%, 23%); + --range-thumb-border-color: var(--background-color); + --range-thumb-color: var(--secondary); + --range-thumb-hover-color: var(--secondary-hover); + --range-thumb-active-color: var(--primary); + --table-border-color: var(--muted-border-color); + --table-row-stripped-background-color: rgba(115, 130, 140, 0.05); + --code-background-color: #18232c; + --code-color: var(--muted-color); + --code-kbd-background-color: var(--contrast); + --code-kbd-color: var(--contrast-inverse); + --code-tag-color: hsl(330, 30%, 50%); + --code-property-color: hsl(185, 30%, 50%); + --code-value-color: hsl(40, 10%, 50%); + --code-comment-color: #4d606d; + --accordion-border-color: var(--muted-border-color); + --accordion-active-summary-color: var(--primary); + --accordion-close-summary-color: var(--color); + --accordion-open-summary-color: var(--muted-color); + --card-background-color: #141e26; + --card-border-color: var(--card-background-color); + --card-box-shadow: 0.0145rem 0.029rem 0.174rem rgba(0, 0, 0, 0.01698), + 0.0335rem 0.067rem 0.402rem rgba(0, 0, 0, 0.024), + 0.0625rem 0.125rem 0.75rem rgba(0, 0, 0, 0.03), + 0.1125rem 0.225rem 1.35rem rgba(0, 0, 0, 0.036), + 0.2085rem 0.417rem 2.502rem rgba(0, 0, 0, 0.04302), + 0.5rem 1rem 6rem rgba(0, 0, 0, 0.06), + 0 0 0 0.0625rem rgba(0, 0, 0, 0.015); + --card-sectionning-background-color: #18232c; + --dropdown-background-color: hsl(205, 30%, 15%); + --dropdown-border-color: #24333e; + --dropdown-box-shadow: var(--card-box-shadow); + --dropdown-color: var(--color); + --dropdown-hover-background-color: rgba(36, 51, 62, 0.75); + --modal-overlay-background-color: rgba(36, 51, 62, 0.8); + --progress-background-color: #24333e; + --progress-color: var(--primary); + --loading-spinner-opacity: 0.5; + --tooltip-background-color: var(--contrast); + --tooltip-color: var(--contrast-inverse); + --icon-checkbox: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(255, 255, 255)' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E"); + --icon-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(162, 175, 185)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E"); + --icon-chevron-button: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(255, 255, 255)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E"); + --icon-chevron-button-inverse: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(0, 0, 0)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E"); + --icon-close: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(115, 130, 140)' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='18' y1='6' x2='6' y2='18'%3E%3C/line%3E%3Cline x1='6' y1='6' x2='18' y2='18'%3E%3C/line%3E%3C/svg%3E"); + --icon-date: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(162, 175, 185)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'%3E%3C/rect%3E%3Cline x1='16' y1='2' x2='16' y2='6'%3E%3C/line%3E%3Cline x1='8' y1='2' x2='8' y2='6'%3E%3C/line%3E%3Cline x1='3' y1='10' x2='21' y2='10'%3E%3C/line%3E%3C/svg%3E"); + --icon-invalid: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(183, 28, 28)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cline x1='12' y1='8' x2='12' y2='12'%3E%3C/line%3E%3Cline x1='12' y1='16' x2='12.01' y2='16'%3E%3C/line%3E%3C/svg%3E"); + --icon-minus: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(255, 255, 255)' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='5' y1='12' x2='19' y2='12'%3E%3C/line%3E%3C/svg%3E"); + --icon-search: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(162, 175, 185)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E"); + --icon-time: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(162, 175, 185)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cpolyline points='12 6 12 12 16 14'%3E%3C/polyline%3E%3C/svg%3E"); + --icon-valid: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(46, 125, 50)' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E"); + color-scheme: dark; + } +} + +[data-theme=dark] { + --background-color: #11191f; + --color: hsl(205, 16%, 77%); + --h1-color: hsl(205, 20%, 94%); + --h2-color: #e1e6eb; + --h3-color: hsl(205, 18%, 86%); + --h4-color: #c8d1d8; + --h5-color: hsl(205, 16%, 77%); + --h6-color: #afbbc4; + --muted-color: hsl(205, 10%, 50%); + --muted-border-color: #1f2d38; + --primary: hsl(195, 85%, 41%); + --primary-hover: hsl(195, 80%, 50%); + --primary-focus: rgba(16, 149, 193, 0.25); + --primary-inverse: #fff; + --secondary: hsl(205, 15%, 41%); + --secondary-hover: hsl(205, 10%, 50%); + --secondary-focus: rgba(115, 130, 140, 0.25); + --secondary-inverse: #fff; + --contrast: hsl(205, 20%, 94%); + --contrast-hover: #fff; + --contrast-focus: rgba(115, 130, 140, 0.25); + --contrast-inverse: #000; + --mark-background-color: #d1c284; + --mark-color: #11191f; + --ins-color: #388e3c; + --del-color: #c62828; + --blockquote-border-color: var(--muted-border-color); + --blockquote-footer-color: var(--muted-color); + --button-box-shadow: 0 0 0 rgba(0, 0, 0, 0); + --button-hover-box-shadow: 0 0 0 rgba(0, 0, 0, 0); + --form-element-background-color: #11191f; + --form-element-border-color: #374956; + --form-element-color: var(--color); + --form-element-placeholder-color: var(--muted-color); + --form-element-active-background-color: var(--form-element-background-color); + --form-element-active-border-color: var(--primary); + --form-element-focus-color: var(--primary-focus); + --form-element-disabled-background-color: hsl(205, 25%, 23%); + --form-element-disabled-border-color: hsl(205, 20%, 32%); + --form-element-disabled-opacity: 0.5; + --form-element-invalid-border-color: #b71c1c; + --form-element-invalid-active-border-color: #c62828; + --form-element-invalid-focus-color: rgba(198, 40, 40, 0.25); + --form-element-valid-border-color: #2e7d32; + --form-element-valid-active-border-color: #388e3c; + --form-element-valid-focus-color: rgba(56, 142, 60, 0.25); + --switch-background-color: #374956; + --switch-color: var(--primary-inverse); + --switch-checked-background-color: var(--primary); + --range-border-color: #24333e; + --range-active-border-color: hsl(205, 25%, 23%); + --range-thumb-border-color: var(--background-color); + --range-thumb-color: var(--secondary); + --range-thumb-hover-color: var(--secondary-hover); + --range-thumb-active-color: var(--primary); + --table-border-color: var(--muted-border-color); + --table-row-stripped-background-color: rgba(115, 130, 140, 0.05); + --code-background-color: #18232c; + --code-color: var(--muted-color); + --code-kbd-background-color: var(--contrast); + --code-kbd-color: var(--contrast-inverse); + --code-tag-color: hsl(330, 30%, 50%); + --code-property-color: hsl(185, 30%, 50%); + --code-value-color: hsl(40, 10%, 50%); + --code-comment-color: #4d606d; + --accordion-border-color: var(--muted-border-color); + --accordion-active-summary-color: var(--primary); + --accordion-close-summary-color: var(--color); + --accordion-open-summary-color: var(--muted-color); + --card-background-color: #141e26; + --card-border-color: var(--card-background-color); + --card-box-shadow: 0.0145rem 0.029rem 0.174rem rgba(0, 0, 0, 0.01698), + 0.0335rem 0.067rem 0.402rem rgba(0, 0, 0, 0.024), + 0.0625rem 0.125rem 0.75rem rgba(0, 0, 0, 0.03), + 0.1125rem 0.225rem 1.35rem rgba(0, 0, 0, 0.036), + 0.2085rem 0.417rem 2.502rem rgba(0, 0, 0, 0.04302), + 0.5rem 1rem 6rem rgba(0, 0, 0, 0.06), + 0 0 0 0.0625rem rgba(0, 0, 0, 0.015); + --card-sectionning-background-color: #18232c; + --dropdown-background-color: hsl(205, 30%, 15%); + --dropdown-border-color: #24333e; + --dropdown-box-shadow: var(--card-box-shadow); + --dropdown-color: var(--color); + --dropdown-hover-background-color: rgba(36, 51, 62, 0.75); + --modal-overlay-background-color: rgba(36, 51, 62, 0.8); + --progress-background-color: #24333e; + --progress-color: var(--primary); + --loading-spinner-opacity: 0.5; + --tooltip-background-color: var(--contrast); + --tooltip-color: var(--contrast-inverse); + --icon-checkbox: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(255, 255, 255)' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E"); + --icon-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(162, 175, 185)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E"); + --icon-chevron-button: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(255, 255, 255)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E"); + --icon-chevron-button-inverse: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(0, 0, 0)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E"); + --icon-close: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(115, 130, 140)' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='18' y1='6' x2='6' y2='18'%3E%3C/line%3E%3Cline x1='6' y1='6' x2='18' y2='18'%3E%3C/line%3E%3C/svg%3E"); + --icon-date: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(162, 175, 185)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'%3E%3C/rect%3E%3Cline x1='16' y1='2' x2='16' y2='6'%3E%3C/line%3E%3Cline x1='8' y1='2' x2='8' y2='6'%3E%3C/line%3E%3Cline x1='3' y1='10' x2='21' y2='10'%3E%3C/line%3E%3C/svg%3E"); + --icon-invalid: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(183, 28, 28)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cline x1='12' y1='8' x2='12' y2='12'%3E%3C/line%3E%3Cline x1='12' y1='16' x2='12.01' y2='16'%3E%3C/line%3E%3C/svg%3E"); + --icon-minus: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(255, 255, 255)' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='5' y1='12' x2='19' y2='12'%3E%3C/line%3E%3C/svg%3E"); + --icon-search: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(162, 175, 185)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E"); + --icon-time: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(162, 175, 185)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cpolyline points='12 6 12 12 16 14'%3E%3C/polyline%3E%3C/svg%3E"); + --icon-valid: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(46, 125, 50)' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E"); + color-scheme: dark; +} + +progress, +[type=checkbox], +[type=radio], +[type=range] { + accent-color: var(--primary); +} \ No newline at end of file From 10290a36f23e77674e27783d169111c1961d5eb0 Mon Sep 17 00:00:00 2001 From: creme332 <65414576+creme332@users.noreply.github.com> Date: Wed, 17 Jul 2024 16:24:11 +0400 Subject: [PATCH 2/3] add getCartSize() --- public/js_original/models/Cart.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/public/js_original/models/Cart.js b/public/js_original/models/Cart.js index 9a504dc1..14491230 100644 --- a/public/js_original/models/Cart.js +++ b/public/js_original/models/Cart.js @@ -1,7 +1,7 @@ /** * A function for managing the cart in localStorage. * @returns {{getItems: (function(): CartItem[]), removeItem: (function(CartItem): void), isEmpty: (function(): boolean), - * clear: (function(): void), addItem: (function(CartItem): void)}} + * clear: (function(): void), addItem: (function(CartItem): void)}, getCartSize: (function(): number)}} */ function Cart() { /** @@ -82,7 +82,18 @@ function Cart() { localStorage.setItem("cart", "[]"); } - return { addItem, isEmpty, getItems, removeItem, clear }; + /** + * + * @returns {number} Total number of items in cart + */ + function getCartSize() { + return getItems().reduce( + (accumulator, item) => accumulator + item.quantity, + 0, + ); + } + + return { addItem, isEmpty, getItems, removeItem, clear, getCartSize }; } export default Cart; From 2f2e3e8153f1ce6a2822412914c74aff44ad27ac Mon Sep 17 00:00:00 2001 From: creme332 <65414576+creme332@users.noreply.github.com> Date: Wed, 17 Jul 2024 16:26:42 +0400 Subject: [PATCH 3/3] update header style --- public/js_original/cart-view.js | 10 +++++++ public/js_original/global-view.js | 10 +++++++ public/js_original/product-view.js | 5 ++++ public/styles/global.css | 18 ++++++++++- src/core/Controller.php | 2 ++ src/views/Template.php | 48 ++++++++++++++---------------- 6 files changed, 66 insertions(+), 27 deletions(-) diff --git a/public/js_original/cart-view.js b/public/js_original/cart-view.js index 1b1eb18f..66ad5d77 100644 --- a/public/js_original/cart-view.js +++ b/public/js_original/cart-view.js @@ -46,6 +46,11 @@ function updateCart(e) { currentCartItem.quantity = newQuantity; currentCart.addItem(currentCartItem); } + + const itemCount = Cart().getCartSize(); + + // update cart item count in header + document.querySelector("#mini-cart-count").textContent = `(${itemCount})`; } async function checkout() { @@ -102,6 +107,11 @@ function initCartPage() { input.addEventListener("change", updateCart); input.addEventListener("keydown", preventKeyboardInput); }); + + const itemCount = Cart().getCartSize(); + + // update cart item count in header + document.querySelector("#mini-cart-count").textContent = `(${itemCount})`; } async function uploadCart() { diff --git a/public/js_original/global-view.js b/public/js_original/global-view.js index 61274b18..2ad45606 100644 --- a/public/js_original/global-view.js +++ b/public/js_original/global-view.js @@ -2,5 +2,15 @@ import "@picocss/pico/css/pico.min.css"; import "../styles/global.css"; import "../styles/theme.css"; import themeSwitcher from "./theme-switcher"; +import Aos from "aos/src/js/aos"; +import Splide from "@splidejs/splide"; +import Cart from "./models/Cart"; themeSwitcher.init(); + +document.addEventListener("DOMContentLoaded", function () { + const itemCount = Cart().getCartSize(); + + // update cart item count in header + document.querySelector("#mini-cart-count").textContent = `(${itemCount})`; +}); diff --git a/public/js_original/product-view.js b/public/js_original/product-view.js index b9415635..45b2e1e1 100644 --- a/public/js_original/product-view.js +++ b/public/js_original/product-view.js @@ -27,6 +27,11 @@ function handleAddToCart(e) { // open modal to display success successAddToCartModal.openModal(); + + const itemCount = Cart().getCartSize(); + + // update cart item count in header + document.querySelector("#mini-cart-count").textContent = `(${itemCount})`; } function createRatingChart() { diff --git a/public/styles/global.css b/public/styles/global.css index 90f311ac..910e5b1b 100644 --- a/public/styles/global.css +++ b/public/styles/global.css @@ -5,11 +5,27 @@ body > nav { background-color: var(--background-color); } -body > nav .icon { +nav a { + color: var(--contrast); +} + +/*logo in nav*/ +body > nav > ul:nth-child(1) .icon { height: 40px; width: 40px; } +/*other icons in nav*/ +body > nav > ul:nth-child(2) .icon { + height: 28px; + width: 28px; +} + +body > nav .icon { + height: 20px; + width: 20px; +} + /*style logo on left hand side of navbar*/ body > nav > ul li:nth-child(1) > a { display: flex; diff --git a/src/core/Controller.php b/src/core/Controller.php index f3e0a550..f2117a1f 100644 --- a/src/core/Controller.php +++ b/src/core/Controller.php @@ -107,6 +107,8 @@ public function view( $template_content = ob_get_contents(); ob_end_clean(); + $is_user_signed_in = $this->getSignedInClient() !== null; + // display global view template require_once __DIR__ . "/../views/Template.php"; } diff --git a/src/views/Template.php b/src/views/Template.php index 5b575354..87d34565 100644 --- a/src/views/Template.php +++ b/src/views/Template.php @@ -7,8 +7,8 @@ * @var string $template_content HTML of the main content of page * @var string $template_meta_description Meta description of page * @var string $template_tags Additional tags (script, link, ...) for page + * @var bool $is_user_signed_in Whether user is signed in or not */ - ?> @@ -31,13 +31,13 @@ <?= $template_title ?> - +