Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DS-80 Feat: Implement Container component #130

Merged
merged 2 commits into from
Feb 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .stylelintrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"extends": ["@lmc-eu/stylelint-config", "@lmc-eu/stylelint-config/optional"]
"extends": ["@lmc-eu/stylelint-config", "@lmc-eu/stylelint-config/optional", "stylelint-config-prettier"]
}
50 changes: 24 additions & 26 deletions examples/web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,13 @@
}

h2 {
margin-top: 3rem;
margin-bottom: 1.5rem;
margin-block: 3rem 1.5rem;
font-size: 2rem;
}

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

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

header {
Expand All @@ -47,29 +39,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
50 changes: 24 additions & 26 deletions examples/web/jobs.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,14 @@
}

h2 {
margin-top: 3rem;
margin-bottom: 1.5rem;
margin-block: 3rem 1.5rem;
font-weight: normal;
font-size: 25px;
}

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

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

header {
Expand All @@ -60,29 +52,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 examples/web/src/jobs/@tokens.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
$font-family: #{'Open Sans', helvetica, roboto, arial, sans-serif};

@forward '@lmc-eu/spirit-design-tokens/dist/scss/borders';
@forward '@lmc-eu/spirit-design-tokens/dist/scss/breakpoints';
@forward '@lmc-eu/spirit-design-tokens/dist/scss/colors' with (
$brand-primary: #f90,
$brand-secondary: #19325a,
Expand All @@ -21,6 +22,7 @@ $font-family: #{'Open Sans', helvetica, roboto, arial, sans-serif};
$emotion-danger-default: #d40014,
$emotion-danger-background: #fbe6e8
);
@forward '@lmc-eu/spirit-design-tokens/dist/scss/layout';
@forward '@lmc-eu/spirit-design-tokens/dist/scss/radii' with (
$radius-1: 0,
$radius-2: 0,
Expand Down
1 change: 1 addition & 0 deletions examples/web/src/jobs/jobs.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// ⚠️ Remove the `dist/` part from paths below when copy-and-pasting the code to your project.
@use '@lmc-eu/spirit-web/dist/scss/components/Button';
@use '@lmc-eu/spirit-web/dist/scss/components/Container';
@use '@lmc-eu/spirit-web/dist/scss/components/Tag';
3 changes: 3 additions & 0 deletions packages/design-tokens/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
| 🖼 Borders | ✅ | [`_borders.sass`] |
| 🖥 Breakpoints | ✅ | [`_breakpoints.sass`] |
| 🎨 Colors | ✅ | [`_colors.sass`] |
| 🧱 Layout | ✅ | [`_layout.sass`] |
| 🎱 Radii | ✅ | [`_radii.sass`] |
| ⛱ Shadows | ✅ | [`_shadows.sass`] |
| 📏 Spacing | ✅ | [`_spacing.sass`] |
Expand Down Expand Up @@ -162,6 +163,7 @@ your design tokens compatible with Spirit, just create a `@tokens.scss` file and
@forward 'borders';
@forward 'breakpoints';
@forward 'colors';
@forward 'layout';
@forward 'radii';
@forward 'shadows';
@forward 'spacing';
Expand Down Expand Up @@ -258,6 +260,7 @@ See the [LICENSE](LICENSE.md) file for information.
[`_borders.sass`]: src/scss/_borders.scss
[`_breakpoints.sass`]: src/scss/_breakpoints.scss
[`_colors.sass`]: src/scss/_colors.scss
[`_layout.sass`]: src/scss/_layout.scss
[`_radii.sass`]: src/scss/_radii.scss
[`_shadows.sass`]: src/scss/_shadows.scss
[`_spacing.sass`]: src/scss/_spacing.scss
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';

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

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

$container-max-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';
crishpeen marked this conversation as resolved.
Show resolved Hide resolved
@forward 'radii';
@forward 'shadows';
@forward 'spacing';
Expand Down
1 change: 1 addition & 0 deletions packages/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"postcss-cli": "8.3.1",
"sass": "1.49.0",
"stylelint": "13.13.1",
"stylelint-config-prettier": "^9.0.3",
"stylelint-order": "4.1.0"
}
}
7 changes: 7 additions & 0 deletions packages/web/src/components/Container/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Container

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

```html
<div class="Container">Content</div>
```
11 changes: 11 additions & 0 deletions packages/web/src/components/Container/_Container.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@use 'theme';
@use 'tools';

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

@include tools.paddings(theme.$container-paddings, theme.$container-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;

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

@mixin paddings($paddings, $breakpoints) {
@each $name, $breakpoint in $breakpoints {
@include breakpoint.up($breakpoint) {
padding-inline: 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;
}
}
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13625,6 +13625,11 @@ [email protected], style-to-object@^0.3.0:
dependencies:
inline-style-parser "0.1.1"

stylelint-config-prettier@^9.0.3:
version "9.0.3"
resolved "https://registry.yarnpkg.com/stylelint-config-prettier/-/stylelint-config-prettier-9.0.3.tgz#0dccebeff359dcc393c9229184408b08964d561c"
integrity sha512-5n9gUDp/n5tTMCq1GLqSpA30w2sqWITSSEiAWQlpxkKGAUbjcemQ0nbkRvRUa0B1LgD3+hCvdL7B1eTxy1QHJg==

stylelint-config-recommended@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/stylelint-config-recommended/-/stylelint-config-recommended-3.0.0.tgz#e0e547434016c5539fe2650afd58049a2fd1d657"
Expand Down