Skip to content

refactor: cards to match with dbux-3 #193

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

Merged
merged 26 commits into from
Nov 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
12fefa9
refactor: cards to match with dbux-3
nmerget Nov 22, 2022
2b738d8
fix: issue with dependency
nmerget Nov 22, 2022
1427d0e
chore: out of my dead cold hands …
mfranzke Nov 22, 2022
8d87821
fix: we can define custom attributes by data-*
mfranzke Nov 23, 2022
62169ea
chore(docs): optimized the code parts
mfranzke Nov 23, 2022
868fc1c
Restore cards.hbs
mfranzke Nov 23, 2022
8ec5415
refactor: let's leave the components contents for the moment
mfranzke Nov 23, 2022
a846093
fix: change _init.global.scss for a tags
nmerget Nov 23, 2022
300d30c
Merge remote-tracking branch 'origin/refactor-guidelines-3-card' into…
nmerget Nov 23, 2022
089c817
fix: removed sass:list from _color-variants.scss
nmerget Nov 23, 2022
ba076e7
Merge branch 'dbux-3' into refactor-guidelines-3-card
nmerget Nov 23, 2022
68c3294
refactor: the full width is actually a variant currently
mfranzke Nov 23, 2022
f27e403
chore: these variables need to get named a little bit more exclusive
mfranzke Nov 23, 2022
facf42a
Update _init.global.scss
mfranzke Nov 23, 2022
95f2f0a
Merge branch 'refactor-guidelines-3-card' of https://github.com/db-ui…
mfranzke Nov 23, 2022
4d15af9
chore: prettier
mfranzke Nov 23, 2022
ee2d633
chore: even variant is an optional attribute
mfranzke Nov 23, 2022
6e51535
refactor: an interactive element needs a link as well
mfranzke Nov 23, 2022
e226415
chore: this file has been moved to DB UI Base
mfranzke Nov 23, 2022
2f27240
Merge branch 'dbux-3' into refactor-guidelines-3-card
mfranzke Nov 23, 2022
9bc9467
fix: corrected that path
mfranzke Nov 23, 2022
eb15580
Merge branch 'dbux-3' into refactor-guidelines-3-card
mfranzke Nov 23, 2022
35518f2
chore: heavily simplifying these examples
mfranzke Nov 23, 2022
b8e0c42
test: let's deactivate this component for the moment
mfranzke Nov 23, 2022
44e7591
Merge branch 'dbux-3' into refactor-guidelines-3-card
mfranzke Nov 23, 2022
50ef795
refactor: we need to extract the classes to an external file
mfranzke Nov 23, 2022
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
1 change: 0 additions & 1 deletion .pa11yci
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"http://127.0.0.1:8080/patterns/elements-toggle/index.html",
"http://127.0.0.1:8080/patterns/components-accordion/index.html",
"http://127.0.0.1:8080/patterns/components-breadcrumb/index.html",
"http://127.0.0.1:8080/patterns/components-cards/index.html",
"http://127.0.0.1:8080/patterns/components-dialog/index.html",
"http://127.0.0.1:8080/patterns/components-dropdown/index.html",
"http://127.0.0.1:8080/patterns/components-form/index.html",
Expand Down
1 change: 1 addition & 0 deletions source/_meta/_head.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

<!-- If you're adapting the HTML out of this document, only include the following CSS file, as the other below are related to pattern lab styling and presenting our patterns in this context even only //-->
<link rel="stylesheet" href="../../css/{{ domain }}/db-ui-core.css?{{ cacheBuster }}" media="all">
<link rel="stylesheet" href="../../css/{{ domain }}/db-ui-core.classes.css?{{ cacheBuster }}" media="all">

<!-- Do not include the following CSS, as these are related to pattern lab styling and presenting our patterns in this context even only //-->
<link rel="stylesheet" href="../../css/pattern-scaffolding.css?{{ cacheBuster }}" media="all">
Expand Down
7 changes: 2 additions & 5 deletions source/_patterns/00-base/_init.global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,12 @@ body {

// Inline
a {
color: $db-colors-secondary-enabled;
// TODO: Move to DB UI Base
color: inherit;

strong {
color: currentColor;
}

&:hover {
color: #5d616a; // TODO: Identify correct color variable
}
}

code {
Expand Down
19 changes: 0 additions & 19 deletions source/_patterns/02-components/cards/_card.hbs

This file was deleted.

This file was deleted.

29 changes: 29 additions & 0 deletions source/_patterns/02-components/cards/card.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{{#unless list }}
<div class="cmp-card"{{#if variant}} data-variant="{{ variant }}"{{/if }}>
{{else}}
<!-- [html-validate-disable-next element-permitted-content, element-permitted-parent -- we're only providing a partial here] -->
<li class="cmp-card"{{#if variant}} data-variant="{{ variant }}"{{/if }}>
{{/unless}}
{{#if hyperlink }}<a href="#">{{/if }}
{{#if figure }}<figure>
{{#if_eq variant "banner" }}
<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" aria-hidden="true">
<use href="../../icons/illustrative/{{ icon }}.svg#icon"></use>
</svg>
{{else}}
{{> elements-image src="../../icons/functional/images/navigation/db_ic_list_20.svg" alt="" role="presentation" }}
{{/if_eq }}
<figcaption>{{/if }}
{{#if headline}}
<!-- [html-validate-disable-next heading-level] -->
<h3 class="elm-headline">{{ headline }}</h3>
{{/if }}
{{#if text }}<p>{{{ text }}}</p>{{/if }}
{{#if figure }}</figcaption>
</figure>{{/if }}
{{#if hyperlink }}</a>{{/if }}
{{#unless list }}
</div>
{{else}}
</li>
{{/unless }}
36 changes: 31 additions & 5 deletions source/_patterns/02-components/cards/card.scss
Original file line number Diff line number Diff line change
@@ -1,22 +1,49 @@
@use "@db-ui/base/build/scss/init" as *;
@use "@db-ui/base/build/scss/variables" as *;
@use "@db-ui/base/build/scss/variables.global" as *;
@use "@db-ui/base/build/scss/helpers/functions" as *;
@import "cards.variables";
@use "@db-ui/base/build/scss/color/color-variants" as *;

.cmp-card {
background-color: #fff;
@extend %focus-placeholder;
@extend %color-variants;

background-color: var(
--db-current-background-color,
$db-colors-neutral-bg-0-enabled
);

border-radius: 8px;
box-shadow: $box-shadow-01, $box-shadow-02;
box-shadow: $db-elevation-4;
padding: $db-spacing-fixed-md;

& > a {
text-decoration: none;
}

&[data-variant="w-full"],
&[data-variant="width-full"] {
width: 100vw;
border-radius: 0;
}

&[data-variant="ia"] {
&:hover {
cursor: pointer;
box-shadow: $db-elevation-8;
}

&:active {
box-shadow: $db-elevation-2;
}
}

// Cards contents are probably deprecated
// TODO: probably remove after discussions and/or move to demonstration styles for the homepage
figure {
margin: $db-spacing-fixed-normal-m $db-spacing-fixed-normal-m
$db-spacing-fixed-normal-m $db-spacing-fixed-normal-xs;
}

// Banner variant
&[data-variant="banner"] {
figure {
Expand Down Expand Up @@ -49,7 +76,6 @@
}
}
}

// Tile variant
&[data-variant="tile"] {
text-align: center;
Expand Down
80 changes: 80 additions & 0 deletions source/_patterns/02-components/cards/cards-colors.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<p>outer container db-bg-neutral-2</p>
<div class="cmp-card db-bg-neutral-2">
<ul class="cmp-cards">
<li class="cmp-card">
<strong>db-bg-neutral-2</strong>
<br>
<a href="#">Test</a>
</li>
<li class="cmp-card">
<strong>db-bg-neutral-2</strong>
<br>
<a href="#">Test2</a>
</li>
<li class="cmp-card">
<strong>db-bg-neutral-2</strong>
<br>
<a href="#">Test3</a>
</li>
</ul>
</div>

<p>card with nested cards db-bg-information</p>
<div class="cmp-card">
<ul class="cmp-cards">
<li class="cmp-card db-bg-information">
<strong>db-bg-information</strong>
<br>
<a href="#">Test</a>
</li>
<li class="cmp-card db-bg-information">
<strong>db-bg-information</strong>
<br>
<a href="#">Test2</a>
</li>
<li class="cmp-card db-bg-information">
<strong>db-bg-information</strong>
<br>
<a href="#">Test3</a>
</li>
</ul>
</div>

<p>cards with <code>data-color-variant=success-light</code></p>
<ul class="cmp-cards">
<li class="cmp-card" data-color-variant="success-light">
<strong>db-bg-success-light</strong>
<br>
<a href="#">Test</a>
</li>
<li class="cmp-card" data-color-variant="success-light">
<strong>db-bg-success-light</strong>
<br>
<a href="#">Test2</a>
</li>
<li class="cmp-card" data-color-variant="success-light">
<strong>db-bg-success-light</strong>
<br>
<a href="#">Test3</a>
</li>
</ul>

<p>cards with <code>data-color-variant=success-light</code> and <code>data-variant="ia"</code></p>

<ul class="cmp-cards">
<li class="cmp-card" data-color-variant="success-light" data-variant="ia">
<strong>db-bg-success-light</strong>
<br>
<span>Test</span>
</li>
<li class="cmp-card" data-color-variant="success-light" data-variant="ia">
<strong>db-bg-success-light</strong>
<br>
<span>Test2</span>
</li>
<li class="cmp-card" data-color-variant="success-light" data-variant="ia">
<strong>db-bg-success-light</strong>
<br>
<span>Test3</span>
</li>
</ul>
2 changes: 1 addition & 1 deletion source/_patterns/02-components/cards/cards.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<ul class="cmp-cards">
{{#each cards }}
{{> components-card variant=../variant }}
{{> components-card variant=../variant list=true }}
{{/each }}
</ul>
28 changes: 0 additions & 28 deletions source/_patterns/02-components/cards/cards.json

This file was deleted.

25 changes: 0 additions & 25 deletions source/_patterns/02-components/cards/cards~banner.json

This file was deleted.

20 changes: 20 additions & 0 deletions source/_patterns/02-components/cards/cards~default.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"cards": [
{
"headline": "Headline 01",
"text": "Lorem ipsum dolores sint."
},
{
"headline": "Headline 02",
"text": "Lorem ipsum dolores sint."
},
{
"headline": "Headline 03",
"text": "Lorem ipsum dolores sint."
},
{
"headline": "Headline 04",
"text": "Lorem ipsum dolores sint."
}
]
}
25 changes: 25 additions & 0 deletions source/_patterns/02-components/cards/cards~interactive.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"variant": "ia",
"cards": [
{
"headline": "Interactive 01",
"text": "Lorem ipsum dolores sint.",
"hyperlink": true
},
{
"headline": "Interactive 02",
"text": "Lorem ipsum dolores sint.",
"hyperlink": true
},
{
"headline": "Interactive 03",
"text": "Lorem ipsum dolores sint.",
"hyperlink": true
},
{
"headline": "Interactive 04",
"text": "Lorem ipsum dolores sint.",
"hyperlink": true
}
]
}
5 changes: 5 additions & 0 deletions source/_patterns/02-components/cards/card~full-width.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"headline": "Test",
"text": "Test 123",
"variant": "width-full"
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
@import "cards.variables";
@import "../card";
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
@import "cards.variables";
@import "../cards";
@import "../card";
2 changes: 1 addition & 1 deletion source/_patterns/04-pages/intro.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<section>
{{> elements-headline type='2' text='Core principals' }}

{{> components-cards variant="banner" }}
{{> components-cards variant="banner" figure=true }}
</section>

<section>
Expand Down
Loading