Skip to content

Commit

Permalink
chore(Housekeeping): rename typography example (#1720)
Browse files Browse the repository at this point in the history
* chore(Housekeeping): rename typography example

* Fix example-box usage with image-box and typography-box
  • Loading branch information
tujoworker authored Nov 14, 2022
1 parent e576faf commit e289ba1
Show file tree
Hide file tree
Showing 10 changed files with 219 additions and 131 deletions.
1 change: 0 additions & 1 deletion packages/dnb-design-system-portal/gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ const plugins = [
'**/*.md',
'**/Examples.*',
'**/*_not_in_use*',
'**/TypographyExamples.js',
'**/demos/layout/Layout.js',
'**/skip-link-example.js',
'**/CardProductsTable.js',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ import { Button } from '@dnb/eufemia/src'

Components are custom made **user interaction elements** with an internal state, your application can interact with.

<div className="example-box" align="center">
<div className="image-box" align="center">
<Button text="Button" href="/uilib/components/button" target="_blank" />
</div>

## [Elements](!/uilib/elements)

Elements are basicity ready to use styled HTML elements.

<div className="example-box" align="center">
<div className="image-box" align="center">
<a className="dnb-anchor" href="!/uilib/elements/anchor" target="_blank">Anchor (Text Link)</a>
</div>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
/**
* UI lib Component Example
*
*/

import React from 'react'
import PropTypes from 'prop-types'
import styled from '@emotion/styled'
import ComponentBox from '../../../shared/tags/ComponentBox'
import Anchor from '@dnb/eufemia/src/elements/Anchor'
import P from '@dnb/eufemia/src/elements/P'

const Wrapper = styled.div`
margin-bottom: 3rem;
`

const FontUsageExample = ({ typo_class, font_family }) => (
<div className="typography-box">
<h3 className={typo_class}>{font_family}</h3>
<p className={typo_class}>
Here is a paragraph with some nonsense{' '}
<a href="/" className="dnb-anchor">
Lorem Ipsum
</a>{' '}
comes from <b>sections</b> 1.10.32 and 1.10.33 of "de
<i>Finibus Bonorum</i> et <u>Malorum</u>" (
<strong>The Extremes</strong> of Good and Evil) by Cicero, written in
45 BC.
</p>
</div>
)
FontUsageExample.propTypes = {
typo_class: PropTypes.string,
font_family: PropTypes.string.isRequired,
}
FontUsageExample.defaultProps = {
typo_class: null,
}

export function FontWeightExample() {
return (
<Wrapper>
{/* Regular */}
<FontUsageExample
font_family="DNB Regular"
typo_class="dnb-typo-regular"
/>

{/* Medium */}
<FontUsageExample
font_family="DNB Medium"
typo_class="dnb-typo-medium"
/>

{/* Bold */}
<FontUsageExample
font_family="DNB Bold"
typo_class="dnb-typo-bold"
/>

{/* Mono Regular */}
<FontUsageExample
font_family="DNB Mono Regular"
typo_class="dnb-typo-mono-regular"
/>
</Wrapper>
)
}

const Case = styled.span`
display: block;
padding: 0.25rem 0;
`

export function ParagraphDefault() {
return (
<ComponentBox
scope={{ Case }}
hideCode
data-visual-test="paragraph-default"
>
<P>
<Case>Here is a paragraph text</Case>
<Case>
<Anchor href="/">Anchor / Text Link</Anchor>
</Case>
<Case>
<b>Bold paragraph (medium weight)</b>
</Case>
<Case>
<strong>Strong paragraph (medium weight)</strong>
</Case>
{/*<i>Italic paragraph (Currently not supported by DNB UX)</i>*/}
{/*<u>Underline paragraph (Currently not supported by DNB UX)</u>*/}
<Case>Numbers 0123456789</Case>
<Case>
<code className="dnb-code">Code paragraph</code>
</Case>
<Case>
<cite>Cite paragraph</cite>
</Case>
</P>
</ComponentBox>
)
}

export function ParagraphSmall() {
return (
<ComponentBox
scope={{ Case }}
hideCode
data-visual-test="paragraph-small"
>
<div>
<P size="small">
<Case>Here is a small paragraph text</Case>
<Case>
<Anchor href="/">Anchor / Text Link</Anchor>
</Case>
<Case>
<b>Bold paragraph (medium weight)</b>
</Case>
<Case>
<strong>Strong paragraph (medium weight)</strong>
</Case>
{/*<i>Italic paragraph</i>*/}
{/*<u>Underline paragraph</u>*/}
<Case>Numbers 0123456789</Case>
<Case>
<code className="dnb-code">Code paragraph</code>
</Case>
<Case>
<cite>Cite paragraph</cite>
</Case>
</P>
<P size="x-small">
<Case>
Here is a x-small paragraph text
<br />
with a new line.
</Case>
</P>
</div>
</ComponentBox>
)
}

export function ParagraphAdditional() {
return (
<ComponentBox
scope={{ Case }}
hideCode
data-visual-test="paragraph-additional"
>
<P>
<Case>
<i>Italic paragraph</i>
</Case>
<Case>
<u>Underline paragraph</u>
</Case>
<Case>
<Anchor title="User Experience">UX</Anchor>
</Case>
<Case>
<del>Deleted paragraph</del>
</Case>
<Case>
<mark>Marked paragraph</mark>
</Case>
<Case>
<ins>Inserted paragraph</ins>
</Case>
<Case>
Text <sup>Superscript</sup>
</Case>
<Case>
Text <sub>Subscript</sub>
</Case>
</P>
</ComponentBox>
)
}

export function ParagraphModifiers() {
return (
<ComponentBox data-visual-test="paragraph-modifiers">
<div>
<P>Default paragraph</P>
<P modifier="medium">Medium weight paragraph</P>
<P size="small">Small paragraph</P>
<P modifier="small medium">Small paragraph with medium weight</P>
{/*(Bold is currently not supported by DNB UX)*/}
{/*<P modifier="bold">Bold weight paragraph</P>*/}
{/*<P modifier="small bold">Small paragraph with bold weight</P>*/}
</div>
</ComponentBox>
)
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ redirect_from:
- /uilib/typography/font-weights
---

import TypographyExamples from 'Docs/uilib/typography/TypographyExamples'
import { FontWeightExample } from 'Docs/uilib/typography/Examples'

# Font Weights

Expand Down Expand Up @@ -60,4 +60,4 @@ p {

## Examples

<TypographyExamples />
<FontWeightExample />
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
showTabs: true
---

import ComponentBox from 'dnb-design-system-portal/src/shared/tags/ComponentBox'
import { ParagraphDefault, ParagraphSmall, ParagraphAdditional, ParagraphModifiers } from 'Docs/uilib/typography/Examples'

## Paragraphs and other text elements

Expand All @@ -25,77 +25,24 @@ Eufemia comes with several styles you can use on paragraphs and other HTML text

### Paragraphs in React

Paragraphs using React JSX.

```jsx
import { P, Lead, Link, ... } from '@dnb/eufemia/elements'
```

<ComponentBox data-visual-test="paragraph-modifiers" caption="Paragraphs using React JSX">
{`
<P>Default paragraph</P>
<P modifier="medium">Medium weight paragraph</P>
<P size="small">Small paragraph</P>
<P modifier="small medium">Small paragraph with medium weight</P>
{/*(Bold is currently not supported by DNB UX)*/}
{/*<P modifier="bold">Bold weight paragraph</P>*/}
{/*<P modifier="small bold">Small paragraph with bold weight</P>*/}
`}
</ComponentBox>
<ParagraphModifiers />

### Paragraphs with vanilla HTML

<ComponentBox hideCode data-visual-test="paragraph-default">
{`
<p className="dnb-p">
Here is a paragraph text<br />
<a href="/" className="dnb-anchor">Anchor / Text Link</a><br />
<b>Bold paragraph (medium weight)</b><br />
<strong>Strong paragraph (medium weight)</strong><br />
{/*<i>Italic paragraph (Currently not supported by DNB UX)</i><br />*/}
{/*<u>Underline paragraph (Currently not supported by DNB UX)</u><br />*/}
Numbers 0123456789<br />
<code className="dnb-code">Code paragraph</code><br />
<cite>Cite paragraph</cite><br />
</p>
`}
</ComponentBox>
<ParagraphDefault />

#### Paragraph with small font-size

<ComponentBox hideCode data-visual-test="paragraph-small">
{`
<p className="dnb-p dnb-p--small">
Here is a small paragraph text<br />
<a href="/" className="dnb-anchor">Anchor / Text Link</a><br />
<b>Bold paragraph (medium weight)</b><br />
<strong>Strong paragraph (medium weight)</strong><br />
{/*<i>Italic paragraph</i><br />*/}
{/*<u>Underline paragraph</u><br />*/}
Numbers 0123456789<br />
<code className="dnb-code">Code paragraph</code><br />
<cite>Cite paragraph</cite><br />
</p>
<p className="dnb-p dnb-p--x-small">
Here is a x-small paragraph text<br />
with a new line.
</p>
`}
</ComponentBox>
<ParagraphSmall />

#### Additional Paragraph formatting (not defined yet)

<ComponentBox hideCode data-visual-test="paragraph-additional">
{`
<p className="dnb-p">
<i>Italic paragraph</i><br />
<u>Underline paragraph</u><br />
<abbr title="User Experience">UX</abbr><br />
<del>Deleted paragraph</del><br />
<mark>Marked paragraph</mark><br />
<ins>Inserted paragraph</ins><br />
<sub>Subscript paragraph</sub><br />
<sup>Superscript paragraph</sup><br />
</p>
`}
</ComponentBox>
<ParagraphAdditional />

Read more [about Fonts in the Designer Guides](/quickguide-designer/fonts/).
Loading

0 comments on commit e289ba1

Please sign in to comment.