Skip to content

Commit

Permalink
DS-80 Feat: Implement Container component to spirit-web and showcase …
Browse files Browse the repository at this point in the history
…it in demo
  • Loading branch information
crishpeen committed Feb 10, 2022
1 parent 7e67d13 commit a83f749
Show file tree
Hide file tree
Showing 13 changed files with 125 additions and 58 deletions.
48 changes: 24 additions & 24 deletions examples/web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,8 @@

header,
main {
padding: 1.5rem 8vw;
}

@media (min-width: 960px) {
header,
main {
padding-inline: 16vw;
}
padding-top: 1.5rem;
padding-bottom: 1.5rem;
}

header {
Expand All @@ -47,29 +41,35 @@
</head>
<body>
<header>
<h1>Spirit Web Demo</h1>
<div class="Container">
<h1>Spirit Web Demo</h1>
</div>
</header>

<main>
<section>
<h2>Button</h2>
<button type="button" class="Button Button--primary">Primary button</button>
<button type="button" class="Button Button--secondary">Secondary button</button>
<button type="button" class="Button Button--tertiary">Tertiary button</button>
<div class="Container">
<h2>Button</h2>
<button type="button" class="Button Button--primary">Primary button</button>
<button type="button" class="Button Button--secondary">Secondary button</button>
<button type="button" class="Button Button--tertiary">Tertiary button</button>
</div>
</section>

<section>
<h2>Tag</h2>
<span class="Tag Tag--default-light">I'm tag. I feel like filling marketing pages :-)</span>
<span class="Tag Tag--default-dark">I'm tag. I feel like filling marketing pages :-)</span>
<span class="Tag Tag--info-light">I'm tag. I feel like filling marketing pages :-)</span>
<span class="Tag Tag--info-dark">I'm tag. I feel like filling marketing pages :-)</span>
<span class="Tag Tag--success-light">I'm tag. I feel like filling marketing pages :-)</span>
<span class="Tag Tag--success-dark">I'm tag. I feel like filling marketing pages :-)</span>
<span class="Tag Tag--warning-light">I'm tag. I feel like filling marketing pages :-)</span>
<span class="Tag Tag--warning-dark">I'm tag. I feel like filling marketing pages :-)</span>
<span class="Tag Tag--danger-light">I'm tag. I feel like filling marketing pages :-)</span>
<span class="Tag Tag--danger-dark">I'm tag. I feel like filling marketing pages :-)</span>
<div class="Container">
<h2>Tag</h2>
<span class="Tag Tag--default-light">I'm tag. I feel like filling marketing pages :-)</span>
<span class="Tag Tag--default-dark">I'm tag. I feel like filling marketing pages :-)</span>
<span class="Tag Tag--info-light">I'm tag. I feel like filling marketing pages :-)</span>
<span class="Tag Tag--info-dark">I'm tag. I feel like filling marketing pages :-)</span>
<span class="Tag Tag--success-light">I'm tag. I feel like filling marketing pages :-)</span>
<span class="Tag Tag--success-dark">I'm tag. I feel like filling marketing pages :-)</span>
<span class="Tag Tag--warning-light">I'm tag. I feel like filling marketing pages :-)</span>
<span class="Tag Tag--warning-dark">I'm tag. I feel like filling marketing pages :-)</span>
<span class="Tag Tag--danger-light">I'm tag. I feel like filling marketing pages :-)</span>
<span class="Tag Tag--danger-dark">I'm tag. I feel like filling marketing pages :-)</span>
</div>
</section>
</main>
</body>
Expand Down
48 changes: 24 additions & 24 deletions examples/web/jobs.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,8 @@

header,
main {
padding: 1.5rem 8vw;
}

@media (min-width: 960px) {
header,
main {
padding-inline: 16vw;
}
padding-top: 1.5rem;
padding-bottom: 1.5rem;
}

header {
Expand All @@ -60,29 +54,35 @@
</head>
<body>
<header>
<h1>Spirit Web Demo <span></span> <em>Jobs</em></h1>
<div class="jobs-Container">
<h1>Spirit Web Demo <span></span> <em>Jobs</em></h1>
</div>
</header>

<main>
<section>
<h2>Button</h2>
<button type="button" class="jobs-Button jobs-Button--primary">Primary button</button>
<button type="button" class="jobs-Button jobs-Button--secondary">Secondary button</button>
<button type="button" class="jobs-Button jobs-Button--tertiary">Tertiary button</button>
<div class="jobs-Container">
<h2>Button</h2>
<button type="button" class="jobs-Button jobs-Button--primary">Primary button</button>
<button type="button" class="jobs-Button jobs-Button--secondary">Secondary button</button>
<button type="button" class="jobs-Button jobs-Button--tertiary">Tertiary button</button>
</div>
</section>

<section>
<h2>Tag</h2>
<span class="jobs-Tag jobs-Tag--default-light">I'm tag. I feel like filling marketing pages :-)</span>
<span class="jobs-Tag jobs-Tag--default-dark">I'm tag. I feel like filling marketing pages :-)</span>
<span class="jobs-Tag jobs-Tag--info-light">I'm tag. I feel like filling marketing pages :-)</span>
<span class="jobs-Tag jobs-Tag--info-dark">I'm tag. I feel like filling marketing pages :-)</span>
<span class="jobs-Tag jobs-Tag--success-light">I'm tag. I feel like filling marketing pages :-)</span>
<span class="jobs-Tag jobs-Tag--success-dark">I'm tag. I feel like filling marketing pages :-)</span>
<span class="jobs-Tag jobs-Tag--warning-light">I'm tag. I feel like filling marketing pages :-)</span>
<span class="jobs-Tag jobs-Tag--warning-dark">I'm tag. I feel like filling marketing pages :-)</span>
<span class="jobs-Tag jobs-Tag--danger-light">I'm tag. I feel like filling marketing pages :-)</span>
<span class="jobs-Tag jobs-Tag--danger-dark">I'm tag. I feel like filling marketing pages :-)</span>
<div class="jobs-Container">
<h2>Tag</h2>
<span class="jobs-Tag jobs-Tag--default-light">I'm tag. I feel like filling marketing pages :-)</span>
<span class="jobs-Tag jobs-Tag--default-dark">I'm tag. I feel like filling marketing pages :-)</span>
<span class="jobs-Tag jobs-Tag--info-light">I'm tag. I feel like filling marketing pages :-)</span>
<span class="jobs-Tag jobs-Tag--info-dark">I'm tag. I feel like filling marketing pages :-)</span>
<span class="jobs-Tag jobs-Tag--success-light">I'm tag. I feel like filling marketing pages :-)</span>
<span class="jobs-Tag jobs-Tag--success-dark">I'm tag. I feel like filling marketing pages :-)</span>
<span class="jobs-Tag jobs-Tag--warning-light">I'm tag. I feel like filling marketing pages :-)</span>
<span class="jobs-Tag jobs-Tag--warning-dark">I'm tag. I feel like filling marketing pages :-)</span>
<span class="jobs-Tag jobs-Tag--danger-light">I'm tag. I feel like filling marketing pages :-)</span>
<span class="jobs-Tag jobs-Tag--danger-dark">I'm tag. I feel like filling marketing pages :-)</span>
</div>
</section>
</main>
</body>
Expand Down
2 changes: 2 additions & 0 deletions packages/design-tokens/src/scss/_breakpoints.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
$breakpoint-mobile: 0;
$breakpoint-tablet: 48em !default; // 768px
$breakpoint-desktop: 80em !default; // 1280px

$breakpoints: (
mobile: $breakpoint-mobile,
tablet: $breakpoint-tablet,
desktop: $breakpoint-desktop,
) !default;
13 changes: 13 additions & 0 deletions packages/design-tokens/src/scss/_layout.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@use 'spacing';

$grid-padding-mobile: spacing.$space-6 !default;
$grid-padding-tablet: spacing.$space-8 !default;
$grid-padding-desktop: spacing.$space-8 !default;

$grid-paddings: (
mobile: $grid-padding-mobile,
tablet: $grid-padding-tablet,
desktop: $grid-padding-desktop,
) !default;

$container-width: 80rem !default;
1 change: 1 addition & 0 deletions packages/design-tokens/src/scss/index.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@forward 'borders';
@forward 'breakpoints';
@forward 'colors';
@forward 'layout';
@forward 'radii';
@forward 'shadows';
@forward 'spacing';
Expand Down
11 changes: 11 additions & 0 deletions packages/web/src/components/Container/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Container

Container centers your content horizontally and sets its max-width with horizontal paddings.

```html
<div class="Container">Content</div>
```

## Theming

Container variables `max-width`, `paddings` and `breakpoints` are mapped to design tokens.
12 changes: 12 additions & 0 deletions packages/web/src/components/Container/_Container.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
@use 'theme';
@use 'tools';

.Container {
width: 100%;
max-width: theme.$max-width;
margin-right: auto;
margin-left: auto;
box-sizing: border-box;

@include tools.paddings(theme.$paddings, theme.$breakpoints);
}
5 changes: 5 additions & 0 deletions packages/web/src/components/Container/_theme.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@use '@tokens' as tokens;

$max-width: tokens.$container-width;
$paddings: tokens.$grid-paddings;
$breakpoints: tokens.$breakpoints;
12 changes: 12 additions & 0 deletions packages/web/src/components/Container/_tools.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
@use '../../tools/breakpoint';
@use 'sass:map';
@use '@tokens' as tokens;

@mixin paddings($paddings, $breakpoints) {
@each $name, $breakpoint in $breakpoints {
@include breakpoint.up($breakpoint) {
padding-right: map.get($paddings, $name);
padding-left: map.get($paddings, $name);
}
}
}
1 change: 1 addition & 0 deletions packages/web/src/components/Container/index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@forward 'Container';
20 changes: 10 additions & 10 deletions packages/web/src/components/Tag/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ Available variants are:
- danger-dark

```html
<span class="lmc-Tag lmc-Tag--default-light">Discount</span>
<span class="lmc-Tag lmc-Tag--default-dark">Discount</span>
<span class="lmc-Tag lmc-Tag--info-light">Discount</span>
<span class="lmc-Tag lmc-Tag--info-dark">Discount</span>
<span class="lmc-Tag lmc-Tag--success-light">Discount</span>
<span class="lmc-Tag lmc-Tag--success-dark">Discount</span>
<span class="lmc-Tag lmc-Tag--warning-light">Discount</span>
<span class="lmc-Tag lmc-Tag--warning-dark">Discount</span>
<span class="lmc-Tag lmc-Tag--danger-light">Discount</span>
<span class="lmc-Tag lmc-Tag--danger-dark">Discount</span>
<span class="Tag Tag--default-light">Discount</span>
<span class="Tag Tag--default-dark">Discount</span>
<span class="Tag Tag--info-light">Discount</span>
<span class="Tag Tag--info-dark">Discount</span>
<span class="Tag Tag--success-light">Discount</span>
<span class="Tag Tag--success-dark">Discount</span>
<span class="Tag Tag--warning-light">Discount</span>
<span class="Tag Tag--warning-dark">Discount</span>
<span class="Tag Tag--danger-light">Discount</span>
<span class="Tag Tag--danger-dark">Discount</span>
```

## Theming
Expand Down
1 change: 1 addition & 0 deletions packages/web/src/components/index.scss
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
@forward 'Button';
@forward 'Container';
@forward 'Tag';
9 changes: 9 additions & 0 deletions packages/web/src/tools/_breakpoint.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@mixin up($breakpointValue) {
@if $breakpointValue > 0 {
@media (min-width: $breakpointValue) {
@content;
}
} @else {
@content;
}
}

0 comments on commit a83f749

Please sign in to comment.