-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #89 from emulsify-ds/feat-spacing-component
feat: add spacing component
- Loading branch information
Showing
4 changed files
with
115 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
.spacing { | ||
td:not(:last-child) { | ||
width: 14rem; | ||
} | ||
} | ||
|
||
.spacing-visualization__wrapper { | ||
display: inline-flex; | ||
flex-flow: row nowrap; | ||
} | ||
|
||
.spacing-visualization { | ||
width: 3rem; | ||
height: 3rem; | ||
display: block; | ||
border-radius: 4px; | ||
background-color: clr(text); | ||
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.25); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import spacingTwig from './spacing.twig'; | ||
import spacingData from './spacing.yml'; | ||
|
||
export default { | ||
title: 'Base/Spacing', | ||
}; | ||
|
||
export const Spacing = () => spacingTwig(spacingData); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{% set table__base_class = 'table' %} | ||
{% set spacing__base_class = 'spacing' %} | ||
|
||
<div {{ bem(spacing__base_class) }}> | ||
{% for spacing in spacing_list %} | ||
{% include "@atoms/text/headings/_heading.twig" with { | ||
heading_level: 1, | ||
heading: spacing.name, | ||
heading_base_class: spacing__base_class, | ||
} %} | ||
<table {{ bem(table__base_class) }}> | ||
<thead {{ bem('header', [], table__base_class) }}> | ||
<tr> | ||
<th {{ bem('header_cell', [], table__base_class) }}>Token name</th> | ||
<th {{ bem('header_cell', [], table__base_class) }}>REM</th> | ||
<th {{ bem('header_cell', [], table__base_class) }}>PX</th> | ||
<th {{ bem('header_cell', [], table__base_class) }}>Example</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{% for space in spacing.items %} | ||
<tr {{ bem('row', [], table__base_class) }}> | ||
<td {{ bem('cell', [], table__base_class) }}>{{ space.name}}</td> | ||
<td {{ bem('cell', [], table__base_class) }}>{{ space.rem }}</td> | ||
<td {{ bem('cell', [], table__base_class) }}>{{ space.px }}</td> | ||
<td {{ bem('cell', [], table__base_class) }}> | ||
<span class="spacing-visualization__wrapper" style="gap: {{space.px}}"> | ||
<span class="spacing-visualization"></span> | ||
<span class="spacing-visualization"></span> | ||
<span class="spacing-visualization"></span> | ||
</span> | ||
</td> | ||
</tr> | ||
{% endfor %} | ||
</tbody> | ||
</table> | ||
{% endfor %} | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
spacing_heading: Spacing | ||
spacing_list: | ||
- name: Spacing | ||
items: | ||
- name: $space | ||
rem: 1rem | ||
px: 16px | ||
- name: Times | ||
items: | ||
- name: $space-double | ||
rem: 2rem | ||
px: 32px | ||
- name: $space-triple | ||
rem: 3rem | ||
px: 48px | ||
- name: $space-quadruple | ||
rem: 4rem | ||
px: 64px | ||
- name: $space-quintuple | ||
rem: 5rem | ||
px: 80px | ||
- name: $space-sextuple | ||
rem: 6rem | ||
px: 96px | ||
- name: $space-septuple | ||
rem: 7rem | ||
px: 112px | ||
- name: Divided | ||
items: | ||
- name: $space-one-half | ||
rem: 0.5rem | ||
px: 8px | ||
- name: $space-one-third | ||
rem: 0.33rem | ||
px: 5.33px | ||
- name: $space-one-fourth | ||
rem: 0.25rem | ||
px: 4px | ||
- name: $space-one-fifth | ||
rem: 0.2rem | ||
px: 3.2px | ||
- name: $space-one-sixth | ||
rem: 0.16rem | ||
px: 2.66px | ||
- name: $space-one-seventh | ||
rem: 0.14rem | ||
px: 2.28px | ||
- name: $space-one-eighth | ||
rem: 0.12rem | ||
px: 2px |