Extended List group variants capabilities#31758
Conversation
|
Can add docs and |
|
Thanks for the PR! The way you did this feels very weird though, compared to our existing components. Why not simply use your values as default values for mixin agument? Eg: @mixin list-group-item-variant(
$state,
$bg-color: color-level($value, $list-group-item-bg-level),
$color: color-level($value, $list-group-item-color-level),
$hover-bg-color: darken($bg-color, 5%),
$hover-color: $color,
$active-bg-color: $color,
$active-color: color-contrast($color)
) {Am I missing something? PS: I also used our |
|
@ffoodd if we just use it as a default value in mixin we won't be able on application side by just changing a If we do it only on mixin default variable to change them I would need to:
@each $color, $value in $app-list-group-item-variants {
@if type-of($value) == "map" {
@include list-group-item-variant(
$color,
map-get($value, bg-color),
map-get($value, color),
map-get($value, hover-bg-color),
map-get($value, hover-color),
map-get($value, active-bg-color),
map-get($value, active-color)
);
}
} |
|
That feels very weird to me, we have a mixin with arguments so no need to add another inerface between variables and mixin: if one need to customize it from Sass, it would be better to use the mixin out of a loop, wouldn't it? Let's wait for other opinions on this, I'm not against but questionning :) |
|
@ffoodd we can use spread operator, checked if it will work in this scss gist: https://www.sassmeister.com/gist/aa12c7e6678298c1492919d2c016ace4?token=043f800ce522585e46e6df8f9922d34da00023e9&scope=gist,read:user So we will be able to pass not full list of variables and then default values will be used. And if we need customization we just will add key to map |
…abilities simplier
|
@ffoodd added a commit with fixing usage of // This is in applications SCSS:
$list-group-item-variants: (
custom: (
bg-color: color-level($purple, $list-group-item-bg-level),
color: color-level($purple, $list-group-item-color-level)
// Other properties of mixin are optional now
),
primary: (
bg-color: color-level($primary, $list-group-item-bg-level),
color: color-level($primary, $list-group-item-color-level)
hover-bg-color: lighten($primary, 10%) // now it's lighten, not darken
)
); |
|
Closing per my comment at #31538 (comment). Let's please revisit this one-by-one, component-by-component, so we don't waste your time and effort. |
Refs to #31538 split some part from #31574