Skip to content

Commit 7e5d978

Browse files
authored
Add v2 alert (#1095)
1 parent 7fb4211 commit 7e5d978

File tree

4 files changed

+22
-0
lines changed

4 files changed

+22
-0
lines changed

docs/static/js/v2-alert.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
var migrationAlertContainer = document.getElementById('v2-alert-container');
2+
3+
if (!window.localStorage.getItem('dbc-v2-alert-seen')) {
4+
migrationAlertContainer.setAttribute('style', 'display:block');
5+
}
6+
7+
var migrationAlert = document.getElementById('v2-alert');
8+
migrationAlert.addEventListener('closed.bs.alert', function () {
9+
window.localStorage.setItem('dbc-v2-alert-seen', 'true');
10+
migrationAlertContainer.setAttribute('style', 'display:none');
11+
});

docs/templates/base.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
</head>
77
<body>
88
{% block header %}{% endblock %}
9+
{% include "partials/v2-alert.html" %}
910
{% block body %}{% endblock %}
1011
{% block scripts %}{% include "partials/scripts.html" %}{% endblock %}
1112
</body>

docs/templates/partials/scripts.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" crossorigin="anonymous"></script>
2+
<script src="/static/js/v2-alert.js"></script>
23
<script src="/static/js/highlight.min.js"></script>
34
<script>
45
hljs.configure({ignoreUnescapedHTML: true})

docs/templates/partials/v2-alert.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<div id="v2-alert-container" style="display:none" class="mt-3 px-5">
2+
<div id="v2-alert" class="alert alert-warning alert-dismissible mx-auto" style="max-width:1000px;"
3+
role="alert">
4+
You are viewing the documentation for
5+
<i>dash-bootstrap-components</i> version 2! Please check our
6+
<a href="/changelog">changelog</a> for details on breaking changes.
7+
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
8+
</div>
9+
</div>

0 commit comments

Comments
 (0)