Skip to content

Commit

Permalink
refactor(components): use margin instead of padding in tab-panel (#370)
Browse files Browse the repository at this point in the history
this allows "margin collapse", so the vertical spacing does not visually break
when _unstyled_ block elements with some by-default margins, like p, ul, etc.
are used inside the tab-panel

Co-authored-by: Daniel Beck <[email protected]>
  • Loading branch information
Arturo Castillo Delgado and nowseemee authored May 28, 2021
1 parent a618efe commit 65caecb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions packages/components/src/components/modal/modal.css
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,8 @@
}

.modal--has-body .modal__body {
/* we use `margin` and top padding because we want to allow "margin collapse" */
/* @see https://web.dev/learn/css/spacing/#margin-collapse */
margin-top: var(--spacing-y-body);
margin-bottom: var(--spacing-y-body);
}
Expand Down
6 changes: 4 additions & 2 deletions packages/components/src/components/tab-panel/tab-panel.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@
}

.tab-panel {
padding-top: var(--spacing-top);
/* we use `margin` and top padding because we want to allow "margin collapse" */
/* @see https://web.dev/learn/css/spacing/#margin-collapse */
margin-top: var(--spacing-top);
}

.tab-panel--small {
padding-top: var(--spacing-top-small);
margin-top: var(--spacing-top-small);
}

0 comments on commit 65caecb

Please sign in to comment.