N°3791 - Panel: Use style defined in the DM for classes

Note that for now, semantic colors cannot be used directly in a <main_color> or <complementary_color> tag. Only valid CSS color (hexa, hsla, ...)
This commit is contained in:
Molkobain
2021-09-26 00:59:22 +02:00
parent 39d71c9c43
commit b15c8e30bc
8 changed files with 91 additions and 64 deletions

View File

@@ -19,11 +19,31 @@ $ibo-panel--base-transition: $ibo-panel--base-transition-property $ibo-panel--ba
transition: $ibo-panel--base-transition;
}
$ibo-panel-colors: (
'primary': $ibo-color-primary-600,
'secondary': $ibo-color-secondary-600,
'neutral': $ibo-color-grey-600,
'information': $ibo-color-information-600,
'success': $ibo-color-success-600,
'failure': $ibo-color-danger-600,
'warning': $ibo-color-warning-600,
'danger': $ibo-color-danger-600,
'grey' : $ibo-color-grey-600,
'blue-grey': $ibo-color-blue-grey-600,
'blue': $ibo-color-blue-800,
'cyan': $ibo-color-cyan-600,
'green': $ibo-color-green-600,
'orange' : $ibo-color-orange-600,
'red': $ibo-color-red-600,
'pink': $ibo-color-pink-600,
) !default;
/* - Specific variables for the block */
$ibo-panel--spacing-top: 24px !default;
$ibo-panel--highlight--width: 100% !default;
$ibo-panel--highlight--height: 8px !default;
$ibo-panel--highlight--background-color: 8px !default;
$ibo-panel--highlight--border-radius: $ibo-border-radius-400 $ibo-border-radius-400 0 0 !default;
$ibo-panel--highlight--padding-bottom: $ibo-panel--highlight--height !default;
@@ -68,47 +88,14 @@ $ibo-panel--collapsible-toggler--margin-right: 8px !default;
$ibo-panel--collapsible-toggler--font-size: $ibo-font-size-250 !default;
$ibo-panel--collapsible-toggler--color: $ibo-color-grey-700 !default;
$ibo-panel-colors: (
'primary': $ibo-color-primary-600,
'secondary': $ibo-color-secondary-600,
'neutral': $ibo-color-grey-600,
'information': $ibo-color-information-600,
'success': $ibo-color-success-600,
'failure': $ibo-color-danger-600,
'warning': $ibo-color-warning-600,
'danger': $ibo-color-danger-600,
'grey' : $ibo-color-grey-600,
'blue-grey': $ibo-color-blue-grey-600,
'blue': $ibo-color-blue-800,
'cyan': $ibo-color-cyan-600,
'green': $ibo-color-green-600,
'orange' : $ibo-color-orange-600,
'red': $ibo-color-red-600,
'pink': $ibo-color-pink-600,
) !default;
@each $sColor, $sColorValue in $ibo-panel-colors {
.ibo-panel.ibo-is-#{$sColor} > .ibo-panel--body::before {
position: absolute;
top: 0;
left: 0;
display: block;
background-color: $sColorValue;
content: "";
width: $ibo-panel--highlight--width;
height: $ibo-panel--highlight--height;
padding-bottom: $ibo-panel--highlight--padding-bottom;
}
}
/* Rules */
.ibo-panel + .ibo-panel {
margin-top: $ibo-panel--spacing-top;
}
.ibo-panel {
--ibo-main-color: map-get($ibo-panel-colors, 'neutral'); /* --ibo-main-color is to allow overload from custom dynamic value from the DM. The overload will be done through an additional CSS class of a particular DM class or DM attribute */
position: relative;
&.ibo-has-icon {
@@ -214,6 +201,26 @@ $ibo-panel-colors: (
overflow: hidden; /* To force highlight color to be cropped by the border radius */
@extend %ibo-font-size-150;
&::before {
position: absolute;
top: 0;
left: 0;
display: block;
background-color: var(--ibo-main-color); /* Default value defined in .ibo-panel, can be overloaded by custom CSS classes */
content: "";
width: $ibo-panel--highlight--width;
height: $ibo-panel--highlight--height;
padding-bottom: $ibo-panel--highlight--padding-bottom;
}
}
@each $sColor, $sColorValue in $ibo-panel-colors {
.ibo-panel.ibo-is-#{$sColor} > .ibo-panel--body::before {
background-color: $sColorValue;
}
}
.ibo-panel--collapsible-toggler {