Skip to content

Commit

Permalink
refactor: auto-generate base-modal sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
valeriansaliou committed Aug 15, 2024
1 parent 99ab2bb commit 42e7cd1
Showing 1 changed file with 24 additions and 44 deletions.
68 changes: 24 additions & 44 deletions src/components/base/BaseModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,21 @@ export default {
$c: ".c-base-modal";

// VARIABLES
$popup-min-width-medium: 350px;
$popup-min-width-large: 440px;
$popup-min-width-mid-large: 560px;
$popup-sizes: (
"medium": (
"min-width": 350px
),

$popup-max-width: $popup-min-width-mid-large;
"large": (
"min-width": 440px
),

"mid-large": (
"min-width": 560px
)
);

$popup-max-width: map-get(map-get($popup-sizes, "mid-large"), "min-width");
$popup-max-width-toleration-sides: 20px;

$popup-padding-sides: 25px;
Expand Down Expand Up @@ -169,50 +179,20 @@ $popup-width-full-breakpoint: (

// --> SIZES <--

&--medium {
#{$c}__popup {
min-width: $popup-min-width-medium;

max-width: (
$popup-min-width-medium + (2 * $popup-max-width-toleration-sides)
);
}

&#{$c}--constrained {
@each $name, $size in $popup-sizes {
&--#{$name} {
#{$c}__popup {
max-width: $popup-min-width-medium;
}
}
}

&--large {
#{$c}__popup {
min-width: $popup-min-width-large;

max-width: (
$popup-min-width-large + (2 * $popup-max-width-toleration-sides)
);
}
min-width: map-get($size, "min-width");

&#{$c}--constrained {
#{$c}__popup {
max-width: $popup-min-width-large;
max-width: (
map-get($size, "min-width") + (2 * $popup-max-width-toleration-sides)
);
}
}
}

&--mid-large {
#{$c}__popup {
min-width: $popup-min-width-mid-large;

max-width: (
$popup-min-width-mid-large + (2 * $popup-max-width-toleration-sides)
);
}

&#{$c}--constrained {
#{$c}__popup {
max-width: $popup-min-width-mid-large;
&#{$c}--constrained {
#{$c}__popup {
max-width: map-get($size, "min-width");
}
}
}
}
Expand Down

0 comments on commit 42e7cd1

Please sign in to comment.