Skip to content

Commit fd02704

Browse files
authored
feat: add elevation as foundation variables (#154)
* feat: add elevation as foundation variables
1 parent 8b0d5b3 commit fd02704

File tree

6 files changed

+95
-0
lines changed

6 files changed

+95
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
@use "../../../build/scss/variables" as *;
2+
@use "../../../build/scss/variables.global" as *;
3+
4+
%elevation-placeholder {
5+
width: 15rem;
6+
height: $db-sizing-lg;
7+
padding: $db-spacing-responsive-sm $db-spacing-responsive-md;
8+
border-radius: 8px;
9+
background-color: $db-colors-neutral-bg-0-enabled;
10+
}
11+
12+
.DO-NOT-COPY-THIS-CLASS-elevation-background {
13+
display: flex;
14+
flex-wrap: wrap;
15+
gap: $db-spacing-responsive-md;
16+
padding: $db-spacing-fixed-md;
17+
background-color: $db-colors-neutral-bg-1-enabled;
18+
}
19+
20+
$list: "", $db-elevation-1, $db-elevation-2, $db-elevation-3, $db-elevation-4,
21+
$db-elevation-8, $db-elevation-12, $db-elevation-24;
22+
23+
@mixin elevation() {
24+
@for $i from 0 to length($list) {
25+
$className: $i;
26+
@if ($i==5) {
27+
$className: 8;
28+
}
29+
@if ($i==6) {
30+
$className: 12;
31+
}
32+
@if ($i==7) {
33+
$className: 24;
34+
}
35+
.DO-NOT-COPY-THIS-CLASS-elevation-#{$className} {
36+
@extend %elevation-placeholder;
37+
38+
@if ($i != 0) {
39+
box-shadow: nth($list, $i + 1);
40+
}
41+
}
42+
}
43+
}
44+
45+
@include elevation();
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<main >
2+
<h1>Elevation Examples</h1>
3+
4+
<div class="DO-NOT-COPY-THIS-CLASS-elevation-background">
5+
<div class="DO-NOT-COPY-THIS-CLASS-elevation-0">Elevation-0</div>
6+
<div class="DO-NOT-COPY-THIS-CLASS-elevation-1">Elevation-1</div>
7+
<div class="DO-NOT-COPY-THIS-CLASS-elevation-2">Elevation-2</div>
8+
<div class="DO-NOT-COPY-THIS-CLASS-elevation-3">Elevation-3</div>
9+
<div class="DO-NOT-COPY-THIS-CLASS-elevation-4">Elevation-4</div>
10+
<div class="DO-NOT-COPY-THIS-CLASS-elevation-8">Elevation-8</div>
11+
<div class="DO-NOT-COPY-THIS-CLASS-elevation-12">Elevation-12</div>
12+
<div class="DO-NOT-COPY-THIS-CLASS-elevation-24">Elevation-24</div>
13+
</div>
14+
</main>

source/_patterns/elevation/intro.hbs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<main>
2+
<h1>Elevation Intro</h1>
3+
<p>
4+
Please find a lot of more information regarding our spacings and how to use it within the <a target="_blank" rel="nofollow" href="https://marketingportal.extranet.deutschebahn.com/de/brandguide/layout">Marketingportal</a>
5+
</p>
6+
</main>

source/_patterns/elevation/intro.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
title: Intro
3+
order: -1
4+
---

source/css/documentation.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ textarea {
2020
@import "../_patterns/icons/icons.demonstration";
2121
@import "../_patterns/logo/examples.demonstration";
2222
@import "../_patterns/spacings/examples.demonstration";
23+
@import "../_patterns/elevation/examples.demonstration";
2324

2425
main {
2526
padding: $db-spacing-fixed-normal-xs $db-spacing-fixed-normal-l;

tokens/elevation.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"elevation": {
3+
"1": {
4+
"value": "0 0 1px 0 rgba(0, 0, 0, 0.2), 0 0 2px 0 rgba(0, 0, 0, 0.12), 0 0 1px 0 rgba(0, 0, 0, 0.14)"
5+
},
6+
"2": {
7+
"value": "0 0 1px -1px rgba(0, 0, 0, 0.2), 0 0 4px 1px rgba(0, 0, 0, 0.12), 0 0 2px 0 rgba(0, 0, 0, 0.14)"
8+
},
9+
"3": {
10+
"value": "0 0 2px -1px rgba(0, 0, 0, 0.2), 0 0 8px 1px rgba(0, 0, 0, 0.12), 0 0 4px 0 rgba(0, 0, 0, 0.14)"
11+
},
12+
"4": {
13+
"value": "0 0 2px -1px rgba(0, 0, 0, 0.2), 0 0 8px 1px rgba(0, 0, 0, 0.12), 0 0 4px 0 rgba(0, 0, 0, 0.14)"
14+
},
15+
"8": {
16+
"value": "0 0 4px -3px rgba(0, 0, 0, 0.2), 0 0 16px 3px rgba(0, 0, 0, 0.12), 0 0 8px 1px rgba(0, 0, 0, 0.14)"
17+
},
18+
"12": {
19+
"value": "0 0 6px -4px rgba(0, 0, 0, 0.2), 0 0 24px 4px rgba(0, 0, 0, 0.12), 0 0 12px 2px rgba(0, 0, 0, 0.14)"
20+
},
21+
"24": {
22+
"value": "0 0 12px -8px rgba(0, 0, 0, 0.2), 0 0 48px 8px rgba(0, 0, 0, 0.12), 0 0 24px 3px rgba(0, 0, 0, 0.14)"
23+
}
24+
}
25+
}

0 commit comments

Comments
 (0)