-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
alerts: refactor alerts and fix issues
- Loading branch information
Showing
7 changed files
with
143 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 12 additions & 17 deletions
29
meinberlin/apps/contrib/templates/meinberlin_contrib/components/alert.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,17 @@ | ||
{% load i18n %} | ||
|
||
<div class="alert alert--{{ alert_type }}" | ||
role="alert" | ||
aria-live="{% if alert_type == 'danger' %}assertive{% else %}polite{% endif %}" | ||
aria-describedby="{% if alert_headline %}alert__headline{% endif %} alert__text" | ||
aria-atomic="true" | ||
> | ||
<div class="a4-alert__container"> | ||
<div class="a4-alert__content"> | ||
{% if alert_headline %} | ||
<h3 class="alert__headline"> | ||
<div class="alert alert--{{ alert_type }}" role="alert" aria-live="{% if alert_type == 'danger' %}assertive{% else %}polite{% endif %}" aria-atomic="true"> | ||
<div class="alert__content"> | ||
{% if alert_headline %} | ||
<h3 class="alert__headline"> | ||
{% translate alert_headline %} | ||
</h3> | ||
{% endif %} | ||
<p class="alert__text"> | ||
{% translate alert_message %} | ||
</p> | ||
</div> | ||
<button type="button" class="alert__close" data-bs-dismiss="alert" aria-label="{% translate 'Close' %}"><i class="fa fa-times" aria-hidden="true"></i></button> | ||
</h3> | ||
{% endif %} | ||
<p class="alert__text"> | ||
{% translate alert_message %} | ||
</p> | ||
<button type="button" class="alert__close" data-bs-dismiss="alert" aria-label="{% translate 'Close' %}"> | ||
<i class="fa fa-times" aria-hidden="true"></i> | ||
</button> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,66 @@ | ||
@use "sass:color"; | ||
|
||
$messages-margin-bottom: 25px; | ||
|
||
.messages { | ||
margin: 0 0 $messages-margin-bottom; | ||
padding: 0; | ||
.alert { | ||
position: relative; | ||
color: $info; | ||
background-color: $info-bg; | ||
animation: slide-in 0.2s ease-in-out; | ||
} | ||
|
||
li { | ||
display: block; | ||
} | ||
.alert__content { | ||
padding: 1.5rem 2rem 1.5rem 1.5rem; | ||
margin: 0 auto; | ||
max-width: 81rem; // reproduces the old container max-width in bootstrap | ||
} | ||
|
||
+ .messages { | ||
margin-top: -$messages-margin-bottom; | ||
} | ||
.alert__headline { | ||
margin-top: 0; | ||
} | ||
|
||
.alert { | ||
.alert__text { | ||
margin: 0; | ||
padding: $padding * 1.2 0; | ||
background-color: color.adjust($info, $lightness: 60%); | ||
color: $info; | ||
text-align: center; | ||
line-height: 1.5; | ||
} | ||
|
||
/* Alert types */ | ||
.alert--success { | ||
background-color: color.adjust($success, $lightness: 70%); | ||
color: $success; | ||
background-color: $success-bg; | ||
} | ||
|
||
.alert--error, | ||
.alert--danger { | ||
background-color: color.adjust($danger, $lightness: 50%); | ||
color: $danger; | ||
background-color: $danger-bg; | ||
} | ||
|
||
.alert--warning { | ||
background-color: color.adjust($warning, $lightness: 48%); | ||
color: $warning; | ||
} | ||
|
||
.alert__close { | ||
float: right; | ||
color: inherit; | ||
background-color: $warning-bg; | ||
} | ||
|
||
.alert--small { | ||
padding: 0.5em; | ||
} | ||
|
||
// If this directly follows the dialog box (see header.scss), add 16px | ||
// additional padding to the default value (see above). | ||
.messages:first-child > :first-child { | ||
padding-top: calc(16px + #{$padding * 1.2}); | ||
/* Close button */ | ||
.alert__close { | ||
position: absolute; | ||
top: 0.5rem; | ||
right: 0.5rem; | ||
padding: 0.25rem; | ||
border: 0; | ||
color: inherit; | ||
cursor: pointer; | ||
} | ||
|
||
// compensate for margin-bottom on messages | ||
.project-header, | ||
.hero-unit { | ||
.messages + & { | ||
margin-top: -$messages-margin-bottom; | ||
/* Animation */ | ||
@keyframes slide-in { | ||
from { | ||
opacity: 0; | ||
transform: translateY(-10px); | ||
} | ||
} | ||
|
||
to { | ||
opacity: 1; | ||
transform: translateY(0); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters