Skip to content

Commit d697454

Browse files
committed
fixup! Fix(web, web-react): Make individual items in vertical Flex reflect alignmentX #DS-1820
1 parent 6dcc12a commit d697454

File tree

2 files changed

+36
-4
lines changed

2 files changed

+36
-4
lines changed

packages/web/src/scss/tools/__tests__/_dictionaries.test.scss

+24-3
Original file line numberDiff line numberDiff line change
@@ -67,18 +67,39 @@
6767
$properties: (
6868
'justify-content',
6969
'justify-items',
70-
),
71-
$infix: 'tablet--'
70+
)
7271
);
7372
}
7473

7574
@include test.expect() {
76-
.Test--tablet--alignmentXStretch {
75+
.Test--alignmentXStretch {
7776
justify-content: stretch;
7877
justify-items: stretch;
7978
}
8079
}
8180
}
81+
82+
@include test.assert() {
83+
@include test.output() {
84+
@include dictionaries.generate-alignments(
85+
$class-name: 'Test',
86+
$dictionary-values: (
87+
'space-between',
88+
),
89+
$axis: 'x',
90+
$properties: (
91+
'justify-content',
92+
'justify-items',
93+
)
94+
);
95+
}
96+
97+
@include test.expect() {
98+
.Test--alignmentXSpaceBetween {
99+
justify-content: space-between;
100+
}
101+
}
102+
}
82103
}
83104
}
84105

packages/web/src/scss/tools/_dictionaries.scss

+12-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
}
2525

2626
// Mixin to generate alignment classes based on a dictionary
27+
// Invalid property-value pairs are filtered out from the generated classes.
2728
// Parameters are:
2829
// * $class-name: the name of the component class to generate
2930
// * $dictionary-values: map of the dictionary values to generate
@@ -39,6 +40,9 @@
3940
'align-items',
4041
),
4142
);
43+
$invalid-property-value-map: (
44+
'justify-items': 'space-between',
45+
);
4246

4347
@if $properties {
4448
$axis-properties: map.set($axis-properties, $axis, $properties);
@@ -47,7 +51,14 @@
4751
@each $alignment in $dictionary-values {
4852
.#{$class-name}--#{$infix}#{spirit-string.convert-kebab-case-to-camel-case(alignment-#{$axis}-#{$alignment})} {
4953
@each $property in map.get($axis-properties, $axis) {
50-
#{$property}: string.unquote(alignment.translate-physical-to-logical($alignment));
54+
@if not(
55+
map.has-key($invalid-property-value-map, $property) and
56+
map.get($invalid-property-value-map, $property) ==
57+
$alignment
58+
)
59+
{
60+
#{$property}: string.unquote(alignment.translate-physical-to-logical($alignment));
61+
}
5162
}
5263
}
5364
}

0 commit comments

Comments
 (0)