Skip to content

Commit

Permalink
fix: remove margin reset (#3667)
Browse files Browse the repository at this point in the history
Resetting the margin on all elements breaks some default styles like the
native dialog placement.
  • Loading branch information
gfellerph authored Oct 17, 2024
1 parent 5d4a974 commit aa99b01
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 19 deletions.
5 changes: 5 additions & 0 deletions .changeset/shiny-ears-care.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-styles': patch
---

Updated margin styles according to the contribution guidelines. Content elements like headings and paragraphs no longer have a margin top if they're the first child and no margin bottom if they're the last child in a container.
22 changes: 10 additions & 12 deletions packages/styles/src/elements/heading.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,18 @@

tokens.$default-map: elements.$post-heading;

h1,
.h1,
h2,
.h2,
h3,
.h3,
h4,
.h4,
h5,
.h5,
h6,
.h6 {
// :is keeps specificity which is handy here
:is(h1, .h1, h2, .h2, h3, .h3, h4, .h4, h5, .h5, h6, .h6) {
line-height: tokens.get('heading-line-height');
font-weight: tokens.get('heading-font-weight');

&:first-child {
margin-block-start: 0;
}

&:last-child {
margin-block-end: 0;
}
}

h1,
Expand Down
8 changes: 1 addition & 7 deletions packages/styles/src/elements/reset.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,14 @@
box-sizing: border-box;
}

/*
Remove default margin
*/
* {
margin: 0;
}

/*
Typographic tweaks!
- Add accessible line-height
- Improve text rendering
*/
body {
-webkit-font-smoothing: antialiased;
margin: 0;
}

/*
Expand Down

0 comments on commit aa99b01

Please sign in to comment.