Refactor alert shortcode (#858)
Signed-off-by: hossainemruz <hossainemruz@gmail.com>
This commit is contained in:
parent
d3968ca711
commit
fdfee4d3bb
4 changed files with 93 additions and 2 deletions
|
@ -31,6 +31,24 @@ pre {
|
|||
}
|
||||
}
|
||||
}
|
||||
$alert-types: ('success', 'info', 'warning', 'danger');
|
||||
|
||||
.alert {
|
||||
@each $type in $alert-types {
|
||||
&.#{$type} {
|
||||
background: get-alert-bg-color($type, 'light');
|
||||
svg {
|
||||
width: 1.25rem;
|
||||
height: 1.25rem;
|
||||
color: get-alert-text-color($type, 'light') !important;
|
||||
}
|
||||
strong {
|
||||
padding-left: 0.5rem;
|
||||
color: get-alert-text-color($type, 'light') !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
html[data-theme='dark'] {
|
||||
.paginator {
|
||||
|
@ -45,4 +63,17 @@ html[data-theme='dark'] {
|
|||
}
|
||||
}
|
||||
}
|
||||
.alert {
|
||||
@each $type in $alert-types {
|
||||
&.#{$type} {
|
||||
background: get-alert-bg-color($type, 'dark');
|
||||
svg {
|
||||
color: get-alert-text-color($type, 'dark') !important;
|
||||
}
|
||||
strong {
|
||||
color: get-alert-text-color($type, 'dark') !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,3 +50,23 @@
|
|||
color: get-dark-color('text-over-accent-color');
|
||||
}
|
||||
}
|
||||
|
||||
@function get-alert-bg-color($type, $mode) {
|
||||
$colors: map-get($alerts, $type);
|
||||
@if $mode == 'light' {
|
||||
@return map-get($colors, 'bg-color');
|
||||
} @else {
|
||||
@return map-get($colors, 'text-color');
|
||||
}
|
||||
@return red;
|
||||
}
|
||||
|
||||
@function get-alert-text-color($type, $mode) {
|
||||
$colors: map-get($alerts, $type);
|
||||
@if $mode == 'light' {
|
||||
@return map-get($colors, 'text-color');
|
||||
} @else {
|
||||
@return map-get($colors, 'bg-color');
|
||||
}
|
||||
@return red;
|
||||
}
|
||||
|
|
|
@ -93,3 +93,30 @@ $brand-colors: (
|
|||
'diaspora': #1e1e1e,
|
||||
'whatsapp': #25d366,
|
||||
);
|
||||
|
||||
$alerts: (
|
||||
'success': (
|
||||
// green 100
|
||||
'bg-color': #dcfce7,
|
||||
// green 800
|
||||
'text-color': #166534,
|
||||
),
|
||||
'info': (
|
||||
// sky 100
|
||||
'bg-color': #e0f2fe,
|
||||
// sky 800
|
||||
'text-color': #075985,
|
||||
),
|
||||
'warning': (
|
||||
// yellow 100
|
||||
'bg-color': #fef9c3,
|
||||
// yellow 800
|
||||
'text-color': #854d0e,
|
||||
),
|
||||
'danger': (
|
||||
// red 100
|
||||
'bg-color': #fee2e2,
|
||||
// red 800
|
||||
'text-color': #991b1b,
|
||||
),
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue