Toast improve

pull/5312/head
Daniel 2023-09-13 18:14:11 +05:30
parent 7bca72b572
commit 0e71358c78
4 changed files with 1422 additions and 804 deletions

View File

@ -52,22 +52,3 @@ const adminlteJsUrl = path + "/js/adminlte.js";
});
</script>
<!--end::OverlayScrollbars Configure-->
<!--begin::Bootstrap Tooltips-->
<script is:inline>
const tooltipTriggerList = document.querySelectorAll('[data-bs-toggle="tooltip"]')
const tooltipList = [...tooltipTriggerList].map(tooltipTriggerEl => new bootstrap.Tooltip(tooltipTriggerEl));
</script>
<!--end::Bootstrap Tooltips-->
<!--begin::Bootstrap Toasts-->
<script is:inline>
const toastTriggerList = document.querySelectorAll('[data-bs-toggle="toast"]')
toastTriggerList.forEach(btn => {
btn.addEventListener('click', event => {
event.preventDefault();
const toastEle = document.getElementById(btn.getAttribute('data-bs-target'));
const toastBootstrap = bootstrap.Toast.getOrCreateInstance(toastEle);
toastBootstrap.show();
})
})
</script>
<!--end::Bootstrap Toasts-->

View File

@ -219,10 +219,10 @@ const htmlPath = convertPathToHtml(path);
<li class="nav-item">
<a
href={htmlPath + "/UI/general.html"}
class:list={["nav-link", page === "bsgeneral" && "active"]}
class:list={["nav-link", page === "general" && "active"]}
>
<i class="nav-icon bi bi-circle"></i>
<p>General Elements</p>
<p>General</p>
</a>
</li>
<li class="nav-item">

File diff suppressed because it is too large Load Diff

View File

@ -1,24 +1,5 @@
/**
* Custom toast styles to reflect Bootstrap colors
*/
/**
* Get button close SVG.
* Returns an either white or black button SVG dependent on the given color name.
*
* @param string $value - Bootstrap color name
* @return string - Close button SVG URL
*/
@function get-btn-close-svg($value) {
@if $value == "primary" or $value == "secondary" or $value == "success" or $value == "danger" or $value == "dark" {
@return "url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23fff'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3e%3c/svg%3e\")";
} @else {
@return "url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23000'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3e%3c/svg%3e\")";
}
}
//
// Color variants
// Toast
//
@each $name, $color in $theme-colors {
.toast-#{$name} {
@ -27,8 +8,11 @@
--#{$prefix}toast-header-border-color: #{$color};
--#{$prefix}toast-border-color: #{$color};
--#{$prefix}toast-bg: var(--#{$prefix}#{$name}-bg-subtle);
}
.toast-#{$name} .btn-close {
--#{$prefix}btn-close-bg: #{get-btn-close-svg($name)};
@if color-contrast($color) == $color-contrast-light {
.btn-close {
@include btn-close-white();
}
}
}
}