Skip to content

Commit

Permalink
feat: component toasts page
Browse files Browse the repository at this point in the history
  • Loading branch information
zuramai committed Aug 9, 2022
1 parent 485fe8b commit 08b3ebc
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 4 deletions.
9 changes: 9 additions & 0 deletions src/assets/js/pages/component-toasts.js
@@ -0,0 +1,9 @@
const toastTrigger = document.getElementById("liveToastBtn")
const toastLiveExample = document.getElementById("liveToast")
if (toastTrigger) {
toastTrigger.addEventListener("click", () => {
const toast = new bootstrap.Toast(toastLiveExample)

toast.show()
})
}
8 changes: 4 additions & 4 deletions src/assets/scss/_variables.scss
Expand Up @@ -1281,12 +1281,12 @@ $toast-max-width: 350px !default;
$toast-padding-x: .75rem !default;
$toast-padding-y: .5rem !default;
$toast-font-size: .875rem !default;
$toast-color: null !default;
$toast-color: $gray-800 !default;
$toast-background-color: rgba($white, .85) !default;
$toast-border-width: 1px !default;
$toast-border-color: rgba(0, 0, 0, .1) !default;
$toast-border-radius: $border-radius !default;
$toast-box-shadow: $box-shadow !default;
$toast-border-color: rgba(56, 56, 56, 0.1) !default;
$toast-border-radius: .3rem;
$toast-box-shadow: 0 0.5rem 1.5rem rgba(40, 40, 40, 0.1) !default;
$toast-spacing: $container-padding-x !default;

$toast-header-color: $gray-600 !default;
Expand Down
3 changes: 3 additions & 0 deletions src/assets/scss/themes/dark/_mazer-dark.scss
@@ -1,3 +1,6 @@
.toast .btn-close {
background: transparent 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 011.414 0L8 6.586 14.293.293a1 1 0 111.414 1.414L9.414 8l6.293 6.293a1 1 0 01-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 01-1.414-1.414L6.586 8 .293 1.707a1 1 0 010-1.414z'/%3e%3c/svg%3e") center/1em auto no-repeat;
}

// Sweetalert2 Dark
.swal2-popup, .swal2-validation-message {
Expand Down
8 changes: 8 additions & 0 deletions src/assets/scss/themes/dark/_variables-dark.scss
Expand Up @@ -231,6 +231,14 @@ $carousel-caption-color: $white;
$carousel-dark-indicator-active-bg: $black;
$carousel-dark-caption-color: $black;

// Toasts
$toast-color: $body-color ;
$toast-background-color: rgba(44, 46, 66, .85) ;
$toast-header-color: $white;
$toast-header-background-color: #12121e;



$btn-close-color: $black;
$code-color: $pink;
$kbd-color: $white;
Expand Down
75 changes: 75 additions & 0 deletions src/component-toasts.html
@@ -0,0 +1,75 @@
{% set title = 'Toast' %}
{% set filename = 'component-toasts.html' %}

{% extends 'layouts/master.html' %}
{% block content %}
<div class="page-heading">
<div class="page-title">
<div class="row">
<div class="col-12 col-md-6 order-md-1 order-last">
<h3>Toast</h3>
<p class="text-subtitle text-muted">Push notifications to your visitors with a toast, a lightweight and easily customizable alert message.</p>
</div>
<div class="col-12 col-md-6 order-md-2 order-first">
<nav aria-label="breadcrumb" class="breadcrumb-header float-start float-lg-end">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="index.html">Dashboard</a></li>
<li class="breadcrumb-item active" aria-current="page">Toasts</li>
</ol>
</nav>
</div>
</div>
</div>
<section class="section">
<div class="row">
<div class="col-md-6 col-12">
<div class="card">
<div class="card-header">
<h5>Basic Toasts</h5>
</div>
<div class="card-body">
<div class="toast show" role="alert" aria-live="assertive" aria-atomic="true">
<div class="toast-header">
<svg class="bd-placeholder-img rounded me-2" width="20" height="20" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" preserveAspectRatio="xMidYMid slice" focusable="false"><rect width="100%" height="100%" fill="#007aff"></rect></svg>
<strong class="me-auto">Bootstrap</strong>
<small>11 mins ago</small>
<button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
</div>
<div class="toast-body">
Hello, world! This is a toast message.
</div>
</div>
</div>
</div>
</div>
<div class="col-md-6 col-12">
<div class="card">
<div class="card-header">
<h5>Open Toast Buttons</h5>
</div>
<div class="card-body">
<p>Click the button to show toasts.</p>
<button type="button" class="btn btn-primary" id="liveToastBtn">Show live toast</button>
<div class="toast-container position-fixed bottom-0 end-0 p-3">
<div id="liveToast" class="toast" role="alert" aria-live="assertive" aria-atomic="true">
<div class="toast-header">
<svg class="bd-placeholder-img rounded me-2" width="20" height="20" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" preserveAspectRatio="xMidYMid slice" focusable="false"><rect width="100%" height="100%" fill="#007aff"></rect></svg>
<strong class="me-auto">Bootstrap</strong>
<small>11 mins ago</small>
<button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
</div>
<div class="toast-body">
Hello, world! This is a toast message.
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
</div>
{% endblock %}
{% block js %}
<script src="assets/js/pages/component-toasts.js"></script>
{% endblock %}
4 changes: 4 additions & 0 deletions src/sidebar-items.json
Expand Up @@ -69,6 +69,10 @@
"name": "Spinner",
"url": "component-spinner.html"
},
{
"name": "Toasts",
"url": "component-toasts.html"
},
{
"name": "Tooltip",
"url": "component-tooltip.html"
Expand Down

0 comments on commit 08b3ebc

Please sign in to comment.