Skip to content

Commit

Permalink
Improve styles of messages with icons
Browse files Browse the repository at this point in the history
  • Loading branch information
claudiopro committed Sep 9, 2024
1 parent a2ccbd6 commit 7fd44e5
Showing 1 changed file with 23 additions and 7 deletions.
30 changes: 23 additions & 7 deletions sass/_messages.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
* @format
*/

@use 'sass:map';

@import 'variables';
@import 'base';

Expand Down Expand Up @@ -66,6 +68,10 @@ category: messages
Finally, setting a modifier of `msg-icon`, the message will include an icon.
```html_example
<div class="msg msg-icon">
<p>Hello there!</p>
</div>
<div class="msg msg-icon error">
<p>There was an error</p>
</div>
Expand All @@ -83,6 +89,14 @@ Finally, setting a modifier of `msg-icon`, the message will include an icon.
</div>
```
*/

$msg-icon-colors: (
'error': $dark-red,
'info': $dark-blue,
'success': $dark-green,
'warning': $dark-amber,
);

.msg {
border-radius: $border-radius;
border-style: solid;
Expand All @@ -95,23 +109,25 @@ Finally, setting a modifier of `msg-icon`, the message will include an icon.
@include levels(light);

&.msg-icon {
:first-child:before {
color: $dark-accent;
content: '\f075';
font-family: 'FontAwesome';
margin-right: 0.8em;
vertical-align: middle;
}

@each $level in error, info, warning, success {
&.#{$level} :first-child:before {
font-family: 'FontAwesome';
margin-right: 0.8em;
vertical-align: middle;
color: map.get($msg-icon-colors, $level);

@if $level == error {
color: #{$dark-red};
content: '\f06a';
} @else if $level == warning {
color: #{$dark-amber};
content: '\f071';
} @else if $level == info {
color: #{$dark-blue};
content: '\f05a';
} @else if $level == success {
color: #{$dark-green};
content: '\f058';
}
}
Expand Down

0 comments on commit 7fd44e5

Please sign in to comment.