Skip to content

Commit

Permalink
refactor: change color table image to generated table (#899)
Browse files Browse the repository at this point in the history
  • Loading branch information
marvinLaubenstein authored Feb 23, 2022
1 parent ab5cf09 commit aa54b03
Show file tree
Hide file tree
Showing 6 changed files with 3,735 additions and 102 deletions.
331 changes: 319 additions & 12 deletions packages/storybook-vue/stories/1_for_designers/4.Typography.stories.mdx
Original file line number Diff line number Diff line change
@@ -1,19 +1,326 @@
import { Meta, Description, DocsContainer } from "@storybook/addon-docs/blocks";
import { Meta, Description, DocsContainer } from '@storybook/addon-docs/blocks';
import index from '../telekom-design-tokens.light.json';

import text_en from "./4.Typography_en.md";
import text_de from "./4.Typography_de.md";
import text_first_de from './4.Typography_firstPart_de.md';
import text_second_de from './4.Typography_secondPart_de.md';
import text_first_en from './4.Typography_firstPart_en.md';
import text_second_en from './4.Typography_secondPart_en.md';

<Meta title="Scale for Designers/Typography"
<Meta
title="Scale for Designers/Typography"
parameters={{
docs: {
container: ({ context }) => {
const locale = context && context.globals && context.globals.locale
return (
<DocsContainer context={context}>
{locale && <Description markdown={locale ==='en' ? text_en : text_de}/>}
</DocsContainer>
)
docs: {
container: ({ context }) => {
const locale = context && context.globals && context.globals.locale;
const tokenPathStrings = [
'color.text-&-icon.standard',
'color.text-&-icon.additional',
'color.text-&-icon.link.standard',
'color.text-&-icon.functional.danger',
'color.text-&-icon.functional.success',
];
function getTokenValueByPathString(path) {
for (let i = 0; i < 100; i++) {
if (index.tokens[i].pathString === path) {
return index.tokens[i].value;
}
}
}
function getTokenNameByPathString(path) {
for (let i = 0; i < 100; i++) {
if (index.tokens[i].pathString === path) {
return index.tokens[i].name;
}
}
}
function getCssVariableNameByPathString(path) {
for (let i = 0; i < 100; i++) {
if (index.tokens[i].pathString === path) {
return index.tokens[i].cssVariableName;
}
}
}
function getJsPathNameByPathString(path) {
for (let i = 0; i < 100; i++) {
if (index.tokens[i].pathString === path) {
return index.tokens[i].jsPathName;
}
}
}
function getCommentByPathString(path) {
for (let i = 0; i < 100; i++) {
if (index.tokens[i].pathString === path) {
return index.tokens[i].comment;
}
}
}
return (
<DocsContainer context={context}>
{locale && (
<div>
<Description
markdown={locale === 'en' ? text_first_en : text_first_de}
/>
<div>
<table>
<tr>
<th
style={{
textAlign: 'left',
color: '#6A6A6A',
fontSize: '13px',
borderColor: '#fff',
borderBottom: '#000',
}}
>
Example
</th>
<th
style={{
textAlign: 'left',
color: '#6A6A6A',
fontSize: '13px',
borderColor: '#fff',
borderBottom: '#000',
}}
>
Description
</th>
<th
style={{
textAlign: 'left',
color: '#6A6A6A',
fontSize: '13px',
borderColor: '#fff',
borderBottom: '#000',
}}
>
Token Name
</th>
</tr>
{tokenPathStrings.map((pathString) => {
return (
<tr>
<td
style={{
border: 'none',
verticalAlign: 'top',
width: '200px',
}}
>
<div
style={{
backgroundColor: `${getTokenValueByPathString(
pathString
)}`,
padding: '20px',
marginTop: '10px',
border: '1px solid #f0f1f1',
borderRadius: '4px',
width: '350px',
minHeight: '120px',
}}
></div>
</td>
<td
style={{
verticalAlign: 'top',
width: '00px',
height: 'inherit',
border: 'none',
}}
>
<div
style={{
marginTop: '7px',
marginBottom: '7px',
width: '400px',
}}
>
<div>
<span
style={{
fontWeight: 'bolder',
fontSize: '18px',
}}
>
{getTokenNameByPathString(pathString)}
</span>
</div>
<div>
<span
style={{
fontSize: '14px',
}}
>
{getCommentByPathString(pathString)}
</span>
</div>
</div>
</td>
<td
style={{
verticalAlign: 'top',
border: 'none',
}}
>
<div
style={{ fontWeight: '500', fontSize: '13px' }}
>
css
</div>
<div
style={{
textAlign: 'start',
position: 'relative',
width: '350px',
height: '30px',
backgroundColor: '#f0f1f1',
}}
>
<span
style={{
fontSize: '11px',
lineHeight: '30px',
padding: '20px',
}}
>
{getCssVariableNameByPathString(pathString)}
</span>
<div
style={{
margin: '0',
position: 'absolute',
top: '50%',
right: '5px',
msTransform: 'translateY(-50%)',
transform: 'translateY(-50%)',
}}
>
<button
style={{
border: '1px solid #f0f1f1',
borderRadius: '4px',
padding: '1px 3px 1px 3px',
cursor: 'pointer',
}}
onClick={() => {
navigator.clipboard.writeText(
getCssVariableNameByPathString(pathString)
);
}}
>
<scale-icon-action-copy-paste
size={15}
accessibility-title="copy-paste"
color="hsla(0, 0%, 0%, 0.65)"
/>
</button>
</div>
</div>
<div
style={{
padding: '10px 0 0 0',
fontWeight: '500',
fontSize: '13px',
}}
>
js
</div>
<div
style={{
textAlign: 'start',
position: 'relative',
width: '350px',
height: '30px',
backgroundColor: '#f0f1f1',
}}
>
<span
style={{
fontSize: '11px',
lineHeight: '30px',
padding: '20px',
}}
id={pathString.pathString}
>
{pathString.jsPathName}
{getJsPathNameByPathString(pathString)}
</span>
<div
style={{
margin: '0',
position: 'absolute',
top: '50%',
right: '5px',
msTransform: 'translateY(-50%)',
transform: 'translateY(-50%)',
}}
>
<button
style={{
border: '1px solid #f0f1f1',
borderRadius: '4px',
padding: '1px 3px 1px 3px',
cursor: 'pointer',
}}
onClick={() => {
navigator.clipboard.writeText(
getJsPathNameByPathString(pathString)
);
}}
>
<scale-icon-action-copy-paste
size={15}
accessibility-title="copy-paste"
color="hsla(0, 0%, 0%, 0.65)"
/>
</button>
</div>
</div>
<div
style={{
padding: '10px 0 0 0',
fontWeight: '500',
fontSize: '13px',
}}
>
hex
</div>
<div
style={{
textAlign: 'start',
position: 'relative',
width: '350px',
height: '30px',
backgroundColor: '#f0f1f1',
}}
>
<span
style={{
fontSize: '11px',
lineHeight: '30px',
padding: '20px',
}}
id={pathString.pathString}
>
{getTokenValueByPathString(pathString)}
</span>
</div>
</td>
</tr>
);
})}
</table>
</div>
<Description
markdown={locale === 'en' ? text_second_en : text_second_de}
/>
</div>
)}
</DocsContainer>
);
},
},
}}
/>
Original file line number Diff line number Diff line change
Expand Up @@ -48,49 +48,3 @@ Scale verwendet eine ausgewählte Kombination von Schriftformaten, um klare und

Achte bei der Auswahl von Textfarben auf die Lesbarkeit. Der Mindestkontrast bei kleinen Texten liegt bei 4,5 zu 1.
Scale enthält Standardfarben für Texte, Text-Links sowie Nutzerfeedback wie Fehler- und Erfolgsmeldungen.

![Image Name](assets/2_guidelines/3_typography/typography-farben-helle-hintergruende-de.png)

## Hierarchie durch Typografie

Klar unterscheidbare Schrifthierarchien erleichtern die Orientierung und machen wichtige Informationen direkt ersichtlich.

![Image Name](assets/2_guidelines/3_typography/hierarchie01.png)

Beispiel 1: Der Fokus auf Headline mit Lead-Text (Body large) ermöglicht einen einfachen Einstieg in den Inhalt. Die Linksbündigkeit erleichtert den Lesefluss.

![Image Name](assets/2_guidelines/3_typography/hierarchie02.png)

Beispiel 2: Der Einsatz von Abschnittsüberschriften dient der einfachen Strukturierung komplexer Inhalte.

## Lesbarkeit

### Zeilenabstand

Längere Fließtexte sind einfacher zu lesen, wenn der Zeilenabstand etwas größer ist.
Für Text mit mehr als 3 Zeilen nutze das Format „Body long“ (TeleNeo Regular 16 px mit 24 px Zeilenabstand).

![Image Name](assets/2_guidelines/3_typography/lesbarkeit01.png)

Kurze Texte sind einfacher zu erfassen, wenn sie kompakt dargestellt sind.
Nutze bei wenigen Zeilen das Format „Body short“ (TeleNeo Regular 16 px mit 20 px Zeilenabstand).

![Image Name](assets/2_guidelines/3_typography/lesbarkeit02.png)

### Zeilenlängen

Zu lange Zeilen sind anstrengend zu lesen. Zu kurze Zeilen erschweren jedoch das Verständnis und die Verarbeitung von Text.
Für unterschiedliche Schriftgrößen zeigt die Hierarchietabelle unsere Empfehlungen für die jeweilige Zeilenlänge.
In der Tabelle der Schriftformate findest du für die unterschiedlichen Schriftgrößen die jeweiligen Empfehlungen der Zeilenlängen.

![Image Name](assets/2_guidelines/3_typography/zeilenlaengen01.png)

Eine Headline mit der Größe „Heading 01“ sollte aus ca. 30 - 50 Anschlägen bestehen. Vermeide mehrzeilige Headlines.

![Image Name](assets/2_guidelines/3_typography/zeilenlaengen02.png)

Ein Copy-Text (hier: „Body short“) sollte eine Zeilenlänge von mindestens 25 und maximal 80 - 100 Anschlägen haben.

## Sprache, Schreibweise und Tonalität

Hinweise zu Stil, Sprache und Tonalität der Telekom findest du im Artikel [Markentypisch schreiben](https://www.brand-design.telekom.com/artikel/markentypisch-schreiben/).
Loading

0 comments on commit aa54b03

Please sign in to comment.