feat(static): update and optimizate
This commit is contained in:
11
static/package-lock.json
generated
11
static/package-lock.json
generated
@@ -1,17 +1,18 @@
|
||||
{
|
||||
"name": "gallery-static",
|
||||
"name": "gallery",
|
||||
"version": "0.2.1",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "gallery-static",
|
||||
"name": "gallery",
|
||||
"version": "0.2.1",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@popperjs/core": "^2.11.8",
|
||||
"bootstrap": "^5.3.8",
|
||||
"bootstrap-icons": "^1.13.1",
|
||||
"flag-icons": "^7.5.0",
|
||||
"sass": "^1.99.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
@@ -699,6 +700,12 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/flag-icons": {
|
||||
"version": "7.5.0",
|
||||
"resolved": "https://registry.npmjs.org/flag-icons/-/flag-icons-7.5.0.tgz",
|
||||
"integrity": "sha512-kd+MNXviFIg5hijH766tt+3x76ele1AXlo4zDdCxIvqWZhKt4T83bOtxUOOMlTx/EcFdUMH5yvQgYlFh1EqqFg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/fsevents": {
|
||||
"version": "2.3.3",
|
||||
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
"@popperjs/core": "^2.11.8",
|
||||
"bootstrap": "^5.3.8",
|
||||
"bootstrap-icons": "^1.13.1",
|
||||
"flag-icons": "^7.5.0",
|
||||
"sass": "^1.99.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -7,7 +7,7 @@ class AppLinkElement extends HTMLElement {
|
||||
<a href="${this.getAttribute("href")}"
|
||||
class="d-flex align-items-center text-body text-decoration-none">
|
||||
<span class="fs-4">
|
||||
<i class="bi bi-${this.getAttribute("icon")}"></i>
|
||||
<span class="bi bi-${this.getAttribute("icon")} me-1"></span>
|
||||
<span>${this.textContent}</span>
|
||||
</span>
|
||||
</a>`;
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
const languageSwitcherText = document.querySelector("#bd-language-text");
|
||||
const activeLanguageIcon = document.querySelector(".language-icon-active");
|
||||
const btnToActive = document.querySelector(`[data-bs-language-value="${language}"]`);
|
||||
const activeLanguageIconContent = btnToActive?.querySelector("span")?.textContent;
|
||||
const activeLanguageIconClass = btnToActive.querySelector(".fi").className.match(/fi-[\w-]+/)[0];
|
||||
|
||||
document.querySelectorAll("[data-bs-language-value]").forEach((element) => {
|
||||
element.classList.remove("active");
|
||||
@@ -37,7 +37,9 @@
|
||||
|
||||
btnToActive.classList.add("active");
|
||||
btnToActive.setAttribute("aria-pressed", "true");
|
||||
activeLanguageIcon.textContent = activeLanguageIconContent;
|
||||
const classesToRemove = Array.from(activeLanguageIcon.classList).filter((className) => className.startsWith("fi-"));
|
||||
activeLanguageIcon.classList.remove(...classesToRemove);
|
||||
activeLanguageIcon.classList.add(activeLanguageIconClass);
|
||||
const languageSwitcherLabel = `${languageSwitcherText.textContent} (${btnToActive.dataset.bsLanguageValue})`;
|
||||
languageSwitcher.setAttribute("aria-label", languageSwitcherLabel);
|
||||
|
||||
|
||||
40
static/src/lib/bootstrap-icons.scss
vendored
Normal file
40
static/src/lib/bootstrap-icons.scss
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
//$bootstrap-icons: "circle-half", "moon-stars-fill", "brightness-high", "gear", "sun-fill", "tv";
|
||||
|
||||
.bi {
|
||||
display: inline-block;
|
||||
text-transform: none;
|
||||
line-height: 1;
|
||||
vertical-align: -0.125em;
|
||||
width: 1em;
|
||||
height: 1em;
|
||||
|
||||
mask-size: contain;
|
||||
mask-position: 50%;
|
||||
mask-repeat: no-repeat;
|
||||
background-color: currentColor;
|
||||
|
||||
//@each $icon in $bootstrap-icons {
|
||||
// &.bi-#{$icon} {
|
||||
// mask-image: url("bootstrap-icons/icons/#{$icon}.svg");
|
||||
// }
|
||||
///
|
||||
|
||||
&.bi-circle-half {
|
||||
mask-image: url(bootstrap-icons/icons/circle-half.svg);
|
||||
}
|
||||
&.bi-moon-stars-fill {
|
||||
mask-image: url(bootstrap-icons/icons/moon-stars-fill.svg);
|
||||
}
|
||||
&.bi-brightness-high {
|
||||
mask-image: url(bootstrap-icons/icons/brightness-high.svg);
|
||||
}
|
||||
&.bi-gear {
|
||||
mask-image: url(bootstrap-icons/icons/gear.svg);
|
||||
}
|
||||
&.bi-sun-fill {
|
||||
mask-image: url(bootstrap-icons/icons/sun-fill.svg);
|
||||
}
|
||||
&.bi-tv {
|
||||
mask-image: url(bootstrap-icons/icons/tv.svg);
|
||||
}
|
||||
}
|
||||
52
static/src/lib/bootstrap.scss
vendored
Normal file
52
static/src/lib/bootstrap.scss
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
@import "bootstrap/scss/mixins/banner";
|
||||
@include bsBanner("");
|
||||
|
||||
|
||||
// scss-docs-start import-stack
|
||||
// Configuration
|
||||
@import "bootstrap/scss/functions";
|
||||
@import "bootstrap/scss/variables";
|
||||
@import "bootstrap/scss/variables-dark";
|
||||
@import "bootstrap/scss/maps";
|
||||
@import "bootstrap/scss/mixins";
|
||||
@import "bootstrap/scss/utilities";
|
||||
|
||||
// Layout & components
|
||||
@import "bootstrap/scss/root";
|
||||
@import "bootstrap/scss/reboot";
|
||||
@import "bootstrap/scss/type";
|
||||
//@import "bootstrap/scss/images";
|
||||
//@import "bootstrap/scss/containers";
|
||||
@import "bootstrap/scss/grid";
|
||||
@import "bootstrap/scss/tables";
|
||||
@import "bootstrap/scss/forms";
|
||||
@import "bootstrap/scss/buttons";
|
||||
//@import "bootstrap/scss/transitions";
|
||||
@import "bootstrap/scss/dropdown";
|
||||
//@import "bootstrap/scss/button-group";
|
||||
@import "bootstrap/scss/nav";
|
||||
@import "bootstrap/scss/navbar";
|
||||
//@import "bootstrap/scss/card";
|
||||
//@import "bootstrap/scss/accordion";
|
||||
//@import "bootstrap/scss/breadcrumb";
|
||||
//@import "bootstrap/scss/pagination";
|
||||
//@import "bootstrap/scss/badge";
|
||||
//@import "bootstrap/scss/alert";
|
||||
//@import "bootstrap/scss/progress";
|
||||
@import "bootstrap/scss/list-group";
|
||||
//@import "bootstrap/scss/close";
|
||||
//@import "bootstrap/scss/toasts";
|
||||
//@import "bootstrap/scss/modal";
|
||||
//@import "bootstrap/scss/tooltip";
|
||||
//@import "bootstrap/scss/popover";
|
||||
//@import "bootstrap/scss/carousel";
|
||||
//@import "bootstrap/scss/spinners";
|
||||
//@import "bootstrap/scss/offcanvas";
|
||||
//@import "bootstrap/scss/placeholders";
|
||||
|
||||
// Helpers
|
||||
@import "bootstrap/scss/helpers";
|
||||
|
||||
// Utilities
|
||||
@import "bootstrap/scss/utilities/api";
|
||||
// scss-docs-end import-stack
|
||||
@@ -1,6 +1,10 @@
|
||||
@import "bootstrap/scss/bootstrap";
|
||||
$bootstrap-icons-font-dir: "bootstrap-icons/font/fonts";
|
||||
@import "bootstrap-icons/font/bootstrap-icons";
|
||||
@use "flag-icons/sass/flag-icons" with (
|
||||
$flag-icons-path: "flag-icons/flags",
|
||||
$flag-icons-included-countries: ("gb", "ru", "by", "ua", "kz")
|
||||
);
|
||||
|
||||
@import "./lib/bootstrap";
|
||||
@import "./lib/bootstrap-icons";
|
||||
|
||||
@import "./widget.scss";
|
||||
@import "./weather.scss";
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
const themeSwitcherText = document.querySelector("#bd-theme-text");
|
||||
const activeThemeIcon = document.querySelector(".theme-icon-active");
|
||||
const btnToActive = document.querySelector(`[data-bs-theme-value="${theme}"]`);
|
||||
const activeThemeIconClass = btnToActive.querySelector("i.bi").className.match(/bi-[\w-]+/)[0];
|
||||
const activeThemeIconClass = btnToActive.querySelector(".bi").className.match(/bi-[\w-]+/)[0];
|
||||
|
||||
document.querySelectorAll("[data-bs-theme-value]").forEach((element) => {
|
||||
element.classList.remove("active");
|
||||
|
||||
Reference in New Issue
Block a user