Skip to content

Commit ed9994b

Browse files
fix(components/layout): remove bottom margin from description lists (#767)
1 parent 08f1487 commit ed9994b

File tree

3 files changed

+87
-2
lines changed

3 files changed

+87
-2
lines changed

libs/components/layout/src/lib/modules/description-list/description-list.component.scss

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
@use 'libs/components/theme/src/lib/styles/mixins' as mixins;
22
@use 'libs/components/theme/src/lib/styles/variables' as *;
33

4+
:host {
5+
display: block;
6+
}
7+
48
.sky-description-list {
59
margin: 0;
610
padding: 0;
@@ -21,15 +25,20 @@
2125
// Vertical mode
2226
&.sky-description-list-vertical-mode {
2327
.sky-description-list-content {
24-
margin: 0 0 $sky-space-lg;
2528
width: auto;
29+
30+
&:not(:last-child) {
31+
margin: 0 0 $sky-space-lg;
32+
}
2633
}
2734
}
2835

2936
// Horizontal mode
3037
&.sky-description-list-horizontal-mode {
3138
display: flex;
3239
flex-wrap: wrap;
40+
margin: 0 0 var(--sky-compat-description-list-margin-bottom, -$sky-space-lg)
41+
0;
3342

3443
.sky-description-list-content {
3544
margin: 0 0 $sky-space-lg 0;
@@ -90,7 +99,7 @@
9099
@include mixins.sky-theme-modern {
91100
.sky-description-list {
92101
&.sky-description-list-vertical-mode {
93-
.sky-description-list-content {
102+
.sky-description-list-content:not(:last-child) {
94103
margin: 0 0 $sky-theme-modern-margin-stacked-lg;
95104
}
96105

libs/components/packages/src/schematics/migrations/update-7/add-compat-stylesheets.spec.ts

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,43 @@ describe('Migrations > Add compat stylesheets', () => {
3232
.sky-alert {
3333
margin-bottom: 20px;
3434
}
35+
`;
36+
37+
const descriptionListContents = `/*******************************************************************************
38+
* TODO: The following component libraries introduced visual breaking changes
39+
* in SKY UX 7. Each block of CSS reintroduces the styles that were changed or
40+
* removed for backwards compatibility. You will need to do the following
41+
* before migrating to the next major version of SKY UX:
42+
* - Address each of the changes by following the instructions
43+
* in each block of CSS, then remove the block.
44+
* - Delete this file after all blocks have been addressed.
45+
* - Remove each occurrence of this file in your project's
46+
* angular.json file.
47+
*******************************************************************************/
48+
49+
/*******************************************************************************
50+
* COMPONENT: DESCRIPTION LIST
51+
*******************************************************************************/
52+
53+
/*******************************************************************************
54+
* The preset bottom margin has been removed from description list components
55+
* in horizontal and vertical modes in default theme and vertical mode in
56+
* modern. To implement the newly-recommended spacing, add the
57+
* \`sky-margin-stacked-lg\` CSS class to each \`sky-description-list\` component
58+
* in your application, then remove this block.
59+
*******************************************************************************/
60+
61+
.sky-description-list-vertical-mode .sky-description-list-content:last-child {
62+
margin-bottom: 15px;
63+
}
64+
65+
.sky-theme-modern .sky-description-list-vertical-mode .sky-description-list-content:last-child {
66+
margin-bottom: 20px;
67+
}
68+
69+
:root {
70+
--sky-compat-description-list-margin-bottom: 0;
71+
}
3572
`;
3673

3774
const runner = new SchematicTestRunner(
@@ -125,6 +162,18 @@ describe('Migrations > Add compat stylesheets', () => {
125162
);
126163
});
127164

165+
it('should add a compat stylesheet for the layout library', async () => {
166+
await validateCompatStylesheet(
167+
JSON.stringify({
168+
dependencies: {
169+
'@skyux/layout': '6.0.0',
170+
},
171+
}),
172+
descriptionListContents,
173+
[]
174+
);
175+
});
176+
128177
it('should add a compat stylesheet for libraries in devDependencies', async () => {
129178
await validateCompatStylesheet(
130179
JSON.stringify({

libs/components/packages/src/schematics/migrations/update-7/add-compat-stylesheets.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,33 @@ The preset bottom margin has been removed from alert components. To implement th
2626
},
2727
],
2828
},
29+
{
30+
name: '@skyux/layout',
31+
components: [
32+
{
33+
name: 'description list',
34+
styles: [
35+
{
36+
css: `
37+
.sky-description-list-vertical-mode .sky-description-list-content:last-child {
38+
margin-bottom: 15px;
39+
}
40+
41+
.sky-theme-modern .sky-description-list-vertical-mode .sky-description-list-content:last-child {
42+
margin-bottom: 20px;
43+
}
44+
45+
:root {
46+
--sky-compat-description-list-margin-bottom: 0;
47+
}
48+
`,
49+
instructions: `
50+
The preset bottom margin has been removed from description list components in horizontal and vertical modes in default theme and vertical mode in modern. To implement the newly-recommended spacing, add the \`sky-margin-stacked-lg\` CSS class to each \`sky-description-list\` component in your application, then remove this block.`,
51+
},
52+
],
53+
},
54+
],
55+
},
2956
],
3057
};
3158

0 commit comments

Comments
 (0)