Skip to content

Commit 0d039a8

Browse files
authored
refactor(docs): switched tabs from classes to data-HTML-attributes (#5453)
* refactor(docs): switched tabs from classes to data-attributes * Update color-schemes.tsx * Update color-schemes.tsx * Update color-schemes.tsx * Update color-schemes.tsx * Update color-schemes.tsx * refactor: prettier * Apply suggestions from code review
1 parent 79b5ae1 commit 0d039a8

File tree

3 files changed

+28
-28
lines changed

3 files changed

+28
-28
lines changed

packages/foundations/README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,6 @@ In CSS:
112112
In HTML:
113113

114114
```html
115-
<!-- With classes-->
116-
<div
117-
data-density="functional"
118-
class="db-successful-bg-lvl-1 my-container"
119-
></div>
120-
121115
<!-- With data attributes-->
122116
<div
123117
class="my-container"
@@ -126,6 +120,12 @@ In HTML:
126120
></div>
127121
```
128122

123+
<!-- With classes-->
124+
<div
125+
data-density="functional"
126+
class="db-successful-bg-lvl-1 my-container"
127+
></div>
128+
129129
> **Note:** In CSS you might to use the classes or data-attributes even more because you cannot use placeholders or mixins like we have it in **scss**. If you use a 3rd party library and cannot apply classes or data-attributes you might want to copy the content of our helper classes to apply it to the 3rd party class.
130130
131131
### SCSS
@@ -197,12 +197,6 @@ In SCSS with placeholder:
197197
In HTML:
198198

199199
```html
200-
<!-- With classes-->
201-
<div
202-
data-density="functional"
203-
class="db-successful-bg-lvl-1 my-container"
204-
></div>
205-
206200
<!-- With data attributes-->
207201
<div
208202
class="my-container"
@@ -211,6 +205,12 @@ In HTML:
211205
></div>
212206
```
213207

208+
<!-- With classes-->
209+
<div
210+
data-density="functional"
211+
class="db-successful-bg-lvl-1 my-container"
212+
></div>
213+
214214
### Tailwind
215215

216216
Check the required imports for [CSS](https://design-system.deutschebahn.com/core-web/review/main/foundations/readme?current=css) to enable all tokens and defaults.

showcases/patternhub/components/foundations/colors/colors-overview-tabs/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ const ColorsOverviewTabs = ({
4141
</div>
4242
<DBTabs>
4343
<DBTabList>
44-
<DBTabItem>Classes</DBTabItem>
4544
<DBTabItem>Data Attributes</DBTabItem>
45+
<DBTabItem>Classes</DBTabItem>
4646
</DBTabList>
4747
<DBTabPanel>
4848
<ColorsGrid
49-
variant="class"
49+
variant="dataAttribute"
5050
values={values}
5151
prefixClass={prefixClass}
5252
dataAttributeName={dataAttributeName}
@@ -56,7 +56,7 @@ const ColorsOverviewTabs = ({
5656
</DBTabPanel>
5757
<DBTabPanel>
5858
<ColorsGrid
59-
variant="dataAttribute"
59+
variant="class"
6060
values={values}
6161
prefixClass={prefixClass}
6262
dataAttributeName={dataAttributeName}

showcases/patternhub/pages/foundations/colors/color-schemes.tsx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@ const ColorSchemes = () => {
1212
return (
1313
<DefaultPage>
1414
<div>
15-
<h1>Color classes</h1>
15+
<h1>Color declarations</h1>
1616
<p>
17-
These <strong>classes</strong> (or <code>data-</code>
18-
-attributes) can be used to apply a{' '}
17+
These <code>data-</code>-attributes (or{' '}
18+
<strong>classes</strong>) can be used to apply a{' '}
1919
<strong>monochromatic adaptive color scheme</strong> or a{' '}
2020
<strong>color modifier</strong> (background color,
2121
on-background color) to containers and elements.
2222
</p>
2323
<p>
2424
<i>
25-
These classes are <strong>not</strong> intended for
25+
These declarations are <strong>not</strong> intended for
2626
individual styling of your own components. The
2727
corresponding CSS Custom Properties should be used for
2828
this.
@@ -39,30 +39,30 @@ const ColorSchemes = () => {
3939
<li>
4040
Should an entire container be given an{' '}
4141
<strong>adaptive color scheme</strong>? Then use a{' '}
42-
<code>db-color-[ color ]</code> class.
42+
<code>data-color="[ color ]"</code> HTML-attribute.
4343
</li>
4444
<li>
4545
The <strong>background color</strong>, in particular the{' '}
4646
<strong>elevation level</strong>, can be modified with a{' '}
47-
<code>db-bg-color-[ color ]</code> class.
47+
<code>data-bg-color="[ color ]"</code> HTML-attribute.
4848
</li>
4949
<li>
5050
The contrast of the <strong>text</strong> and{' '}
5151
<strong>icon color</strong> can be changed with the{' '}
52-
<strong>on-background</strong> classes:{' '}
53-
<code>db-on-bg-color-[ color ]</code>
52+
<strong>on-background</strong> <code>data</code>-HTML-{' '}
53+
attribute: <code>data-on-bg-color="[ color ]"</code>
5454
</li>
5555
</ol>
5656
<h2 id="container-color-classes">1. Adaptive Color Scheme</h2>
5757
<p>
58-
These classes define the{' '}
58+
These declarations define the{' '}
5959
<strong>monochromatic adaptive color scheme</strong> for a
6060
container. Texts, icons and backgrounds in it than
6161
automatically adapt to the color set.
6262
</p>
6363
<p>
64-
Each adaptive color scheme class functions as a shorthand
65-
and applies the following by default:
64+
Each adaptive color scheme declaration functions as a
65+
shorthand and applies the following by default:
6666
</p>
6767
<ul>
6868
<li>
@@ -101,7 +101,7 @@ const ColorSchemes = () => {
101101
2. Background color modifier
102102
</h2>
103103
<p>
104-
These classes define the type of background color for a
104+
These declarations define the type of background color for a
105105
container. The exact color tone than results from the
106106
current semantics (in root <strong>neutral</strong> by
107107
default). This means that each of these background types
@@ -116,7 +116,7 @@ const ColorSchemes = () => {
116116
3. On background color modifier
117117
</h2>
118118
<p>
119-
This class is used to define the contrast for{' '}
119+
This declarations is used to define the contrast for{' '}
120120
<strong>texts</strong> and <strong>icons</strong>. As with
121121
the background colors, these are displayed according to the
122122
current color scheme.

0 commit comments

Comments
 (0)