-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(logo): integrate sizes and related pulse as an option for headli…
…nes (#171) * refactor: added headline pulse * feat: added logo component * refactor(logo): further optimizations * chore: added another aspect
- Loading branch information
Showing
22 changed files
with
239 additions
and
8 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,7 @@ | ||
--- | ||
title: Headline | ||
--- | ||
|
||
## Pulse | ||
|
||
You could add the DB Pulse to the headline element by adding the `data-pulse` attribute – we're taking care of sizing it accordingly to the DB logo if this one is also present on the same page, as defined by the rules on the Marketingportal regarding the [logo](https://marketingportal.extranet.deutschebahn.com/de/brandguide/logo-3) and the [pulse](https://marketingportal.extranet.deutschebahn.com/en/pulse). |
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,3 @@ | ||
{{> elements-logo }} | ||
<!-- [html-validate-disable-next heading-level -- we're doing some simple demonstration simplification here] --> | ||
{{> elements-headline }} |
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,5 @@ | ||
{ | ||
"type": "2", | ||
"text": "Lorem ipsum dolores sint", | ||
"pulse": true | ||
} |
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,2 @@ | ||
<!-- [html-validate-disable-next heading-level -- we're doing some simple demonstration simplification here] --> | ||
<h{{ type }} class="elm-headline {{ styleModifier }}"{{#if id}} id="{{id}}"{{/if }}{{#if pulse}} data-pulse{{/if }}>{{ text }}</h{{ type }}> |
2 changes: 1 addition & 1 deletion
2
...terns/01-elements/headline/_headline.json → ...tterns/01-elements/headline/headline.json
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"type": "1", | ||
"type": "2", | ||
"text": "Lorem ipsum dolores sint" | ||
} |
This file was deleted.
Oops, something went wrong.
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
41 changes: 41 additions & 0 deletions
41
source/_patterns/01-elements/logo/_logo.demonstration.scss
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,41 @@ | ||
.DO-NOT-COPY-THIS-CLASS-example-logo-list { | ||
list-style: none; | ||
|
||
padding-left: 0; | ||
|
||
color: $db-color-cool-gray-700; | ||
|
||
li { | ||
display: inline-block; | ||
box-sizing: border-box; | ||
|
||
margin: 4px; | ||
padding: 80px; | ||
border-radius: 4px; | ||
|
||
color: $db-color-cool-gray-700; | ||
|
||
&.DO-NOT-COPY-THIS-CLASS-example-bg-variants-cool-gray { | ||
background-color: $db-color-cool-gray-100; | ||
} | ||
|
||
&.DO-NOT-COPY-THIS-CLASS-example-bg-variants-red { | ||
--db-logo-color: #{$db-color-white}; | ||
background-color: $db-color-red-500; | ||
} | ||
|
||
&.DO-NOT-COPY-THIS-CLASS-example-bg-variants-image { | ||
--db-logo-backgroundColor: #{$db-color-white}; | ||
background-image: url("https://marketingportal.extranet.deutschebahn.com/sites/default/files/2021-05-19/Gruppe%20maskieren%2024.png"); | ||
background-repeat: no-repeat; | ||
background-size: cover; | ||
|
||
display: block; | ||
|
||
padding: 20px; | ||
|
||
width: 555px; | ||
height: 400px; | ||
} | ||
} | ||
} |
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,24 @@ | ||
--- | ||
title: Deutsche Bahn Logo | ||
--- | ||
|
||
Please find a lot of more information regarding our logo and how to use it within the [Marketingportal](https://marketingportal.extranet.deutschebahn.com/de/logo-3). | ||
|
||
## Adapt logos colors (background and fill) | ||
|
||
You could easily change the line-colors of the logo as well as the background color by defining different color values for both CSS variables: | ||
|
||
- `--db-logo-color` | ||
- `--db-logo-backgroundColor` | ||
|
||
The fallback for an undefined `--db-logo-color` is our DB Red (`#f01414`), and `--db-logo-backgroundColor` would fall back to `transparent`, which is the general background defined by brand. | ||
|
||
## Size | ||
|
||
### SCSS (recommended) | ||
|
||
Extend one of the size SCSS placeholders in case that you don't want the default (xlarge, 58px width, 40px height): `%logo-size-xsmall`, `%logo-size-small`, `%logo-size-medium`, `%logo-size-large` or `%logo-size-xlarge` | ||
|
||
### HTML attribute | ||
|
||
You could set the different button sizes via the `data-size` attribute, the default is `xlarge` and in that case is optional. |
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 @@ | ||
@import "../../../css/db-ui-core.variables"; |
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,7 @@ | ||
<ul class="DO-NOT-COPY-THIS-CLASS-example-logo-list"> | ||
{{#each example-bgs }} | ||
<li class="DO-NOT-COPY-THIS-CLASS-example-bg-variants-{{ variant }}"> | ||
{{> elements-logo }} | ||
</li> | ||
{{/each }} | ||
</ul> |
16 changes: 16 additions & 0 deletions
16
source/_patterns/01-elements/logo/logo-on-backgrounds.json
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,16 @@ | ||
{ | ||
"example-bgs": [ | ||
{ | ||
"variant": "regular" | ||
}, | ||
{ | ||
"variant": "cool-gray" | ||
}, | ||
{ | ||
"variant": "red" | ||
}, | ||
{ | ||
"variant": "image" | ||
} | ||
] | ||
} |
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,7 @@ | ||
<ul class="DO-NOT-COPY-THIS-CLASS-example-logo-list"> | ||
{{#each sizes }} | ||
<li class="DO-NOT-COPY-THIS-CLASS-example-bg-variants-{{ size }}"> | ||
{{> elements-logo }} | ||
</li> | ||
{{/each }} | ||
</ul> |
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 @@ | ||
{ | ||
"sizes": [ | ||
{ | ||
"size": "xsmall" | ||
}, | ||
{ | ||
"size": "small" | ||
}, | ||
{ | ||
"size": "medium" | ||
}, | ||
{ | ||
"size": "large" | ||
}, | ||
{ | ||
"size": "xlarge" | ||
} | ||
] | ||
} |
2 changes: 2 additions & 0 deletions
2
source/_patterns/01-elements/logo/logo-with-following-headline.hbs
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,2 @@ | ||
{{> elements-logo }} | ||
{{> elements-headline pulse="true" text="Lorem ipsum dolores sint" type="1" }} |
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,6 @@ | ||
<svg xmlns="http://www.w3.org/2000/svg" | ||
aria-hidden="true" | ||
class="elm-logo" | ||
{{#if size }} data-size="{{ size }}"{{/if }}> | ||
<use href="../../images/db_logo.svg#logo"></use> | ||
</svg> |
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,71 @@ | ||
@use "sass:map"; | ||
@import "logo.variables"; | ||
|
||
.elm-logo { | ||
$logo-sizes: ( | ||
"xsmall": ( | ||
"width": 20px, | ||
"height": 14px | ||
), | ||
"small": ( | ||
"width": 29px, | ||
"height": 20px | ||
), | ||
"medium": ( | ||
"width": 34px, | ||
"height": 24px | ||
), | ||
"large": ( | ||
"width": 40px, | ||
"height": 28px | ||
), | ||
"xlarge": ( | ||
"width": 56px, | ||
"height": 40px | ||
) | ||
); | ||
// aspect-ratio: 10 / 7; | ||
|
||
width: var(--db-logo-width, #{$db-logo-default-width}); | ||
height: var(--db-logo-height, #{$db-logo-default-height}); | ||
// Logo safe zone | ||
// margin: calc(var(--db-logo-height, #{$db-logo-default-height}) * 0.5); | ||
|
||
&[data-size="xsmall"] { | ||
@extend %logo-size-xsmall; | ||
} | ||
|
||
&[data-size="small"] { | ||
@extend %logo-size-small; | ||
} | ||
|
||
&[data-size="medium"] { | ||
@extend %logo-size-medium; | ||
} | ||
|
||
&[data-size="large"] { | ||
@extend %logo-size-large; | ||
} | ||
|
||
&[data-size="xlarge"] { | ||
@extend %logo-size-xlarge; | ||
} | ||
|
||
@each $name, $dimensions in $logo-sizes { | ||
&%logo-size-#{$name} { | ||
--db-logo-width: #{map.get($dimensions, "width")}; | ||
--db-logo-height: #{map.get($dimensions, "height")}; | ||
|
||
body:has(&) .elm-headline[data-pulse] { | ||
--db-logo-width: #{map.get($dimensions, "width")}; | ||
--db-logo-height: #{map.get($dimensions, "height")}; | ||
} | ||
|
||
// Legacy browsers | ||
& ~ .elm-headline[data-pulse] { | ||
--db-logo-width: #{map.get($dimensions, "width")}; | ||
--db-logo-height: #{map.get($dimensions, "height")}; | ||
} | ||
} | ||
} | ||
} |
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
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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.