Skip to content

Commit

Permalink
feat: add confirmation modal
Browse files Browse the repository at this point in the history
  • Loading branch information
danielmatthew committed Oct 6, 2021
1 parent 89497d1 commit 9d92b69
Show file tree
Hide file tree
Showing 7 changed files with 145 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/assets/css/talis.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/assets/css/talis.css.map

Large diffs are not rendered by default.

52 changes: 52 additions & 0 deletions docs/assets/img/discard.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 30 additions & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1055,6 +1055,10 @@ <h2>Modals</h2>
Launch demo modal
</button>

<button type="button" class="btn btn-primary btn-lg" data-bs-toggle="modal" data-bs-target="#confirmation-modal">
Launch confirmation modal
</button>

<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="modal-label" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
Expand Down Expand Up @@ -1082,6 +1086,32 @@ <h2 class="modal-title" id="modal-label">Modal title</h2>
</div>
<!-- /.modal-dialog -->
</div>

<div class="modal o-confirmation-modal fade" id="confirmation-modal" tabindex="-1" role="dialog" aria-labelledby="confirmation-label" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<img src="/bootstrap-theme/assets/img/discard.svg" class="modal-image" alt="" width="149" height="158" />
<div class="modal-header">
<h2 class="modal-title" id="confirmation-label">Are you sure?</h2>
</div>
<div class="modal-body">
<p>
You will lose your unsaved data.
</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-lg btn-danger" data-bs-dismiss="modal">
Yes
</button>
<button type="button" class="btn btn-lg btn-default">
Cancel
</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<hr>

<button type="button" class="btn btn-primary btn-lg js-btn-toast">
Expand Down
29 changes: 29 additions & 0 deletions scss/_confirmation-modal.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
@use "sass:math";

.o-confirmation-modal {

.modal-dialog {
max-width: 26.25rem;
}

.modal-image {
margin: $modal-inner-padding $modal-inner-padding 0;
}

.modal-header {
justify-content: flex-start;
padding-bottom: 0;
}

.modal-content {
padding: math.div($modal-inner-padding, 2);
@include border-radius(0.5rem);
font-size: 1rem;
}

.modal-footer {
justify-content: flex-start;
background-color: transparent;
border-color: transparent;
}
}
2 changes: 2 additions & 0 deletions scss/talis.scss
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,5 @@ $enable-shadows: false;
@import "typography";
@import "utils";
@import "well";

@import "confirmation-modal";
30 changes: 30 additions & 0 deletions src/docs/_includes/modals.njk
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
Launch demo modal
</button>

<button type="button" class="btn btn-primary btn-lg" data-bs-toggle="modal" data-bs-target="#confirmation-modal">
Launch confirmation modal
</button>

<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="modal-label" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
Expand Down Expand Up @@ -31,4 +35,30 @@
</div>
<!-- /.modal-dialog -->
</div>

<div class="modal o-confirmation-modal fade" id="confirmation-modal" tabindex="-1" role="dialog" aria-labelledby="confirmation-label" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<img src="{{ '/assets/img/discard.svg' | url }}" class="modal-image" alt="" width="149" height="158" />
<div class="modal-header">
<h2 class="modal-title" id="confirmation-label">Are you sure?</h2>
</div>
<div class="modal-body">
<p>
You will lose your unsaved data.
</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-lg btn-danger" data-bs-dismiss="modal">
Yes
</button>
<button type="button" class="btn btn-lg btn-default">
Cancel
</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<hr>

0 comments on commit 9d92b69

Please sign in to comment.