Skip to content

Commit

Permalink
docs(typography): Clean up css and update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
lzcabrera committed Sep 6, 2017
1 parent 29b8dfd commit b082b14
Show file tree
Hide file tree
Showing 12 changed files with 47 additions and 31 deletions.
2 changes: 1 addition & 1 deletion src/components/Notification/Notification.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const renderContent = (variant, children) => {

/**
* A banner that highlights important messages.
* <span class="docs--badge green">new!</span> <span class="docs--badge purple">v0.21.0</span>
* <span class="docs--badge green">updated!</span> <span class="docs--badge purple">v0.21.0</span>
*/
const Notification = ({ variant, children, ...rest }) => (
<div {...safeRest(rest)} className={styles[variant]}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,12 @@
@import '../../../scss/settings/responsive-grid';
@import '../../../scss/utility/responsive';

.baseHeadingSupSubScripts {
position: relative;
vertical-align: baseline;
padding-left: 0.1em;
}

.sup {
composes: baseHeadingSupSubScripts;
composes: baseSupSubScripts from '../Text/Text.modules.scss';
}

.sub {
composes: baseHeadingSupSubScripts;
composes: baseSupSubScripts from '../Text/Text.modules.scss';
}

.displayHeading {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,5 @@
The Display Heading Sup component wraps text in a `<sup>` tag. It assures proper font sizes are rendered depending on the parent font size.

```
<div>
<DisplayHeading>Great Deals<DisplayHeading.Sup>1</DisplayHeading.Sup></DisplayHeading>
</div>
```
10 changes: 2 additions & 8 deletions src/components/Typography/Heading/Heading.modules.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,12 @@
@import '../../../scss/settings/typography';
@import '../../../scss/utility/responsive';

.baseHeadingSupSubScripts {
position: relative;
vertical-align: baseline;
padding-left: 0.1em;
}

.sup {
composes: baseHeadingSupSubScripts;
composes: baseSupSubScripts from '../Text/Text.modules.scss';
}

.sub {
composes: baseHeadingSupSubScripts;
composes: baseSupSubScripts from '../Text/Text.modules.scss';
}

.largeHeading {
Expand Down
8 changes: 0 additions & 8 deletions src/components/Typography/Heading/HeadingSup/HeadingSup.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,11 @@ The Heading Sup component wraps text in a `<sup>` tag. It assures proper font si
<Heading level="h3">Optik TV<Heading.Sup>®</Heading.Sup></Heading>
<Heading level="h4">Optik TV<Heading.Sup>®</Heading.Sup></Heading>
</div>
<div>
<Heading level="h1">TELUS Pik TV<Heading.Sup>&trade;</Heading.Sup></Heading>
<Heading level="h2">TELUS Pik TV<Heading.Sup>&trade;</Heading.Sup></Heading>
<Heading level="h3">TELUS Pik TV<Heading.Sup>&trade;</Heading.Sup></Heading>
<Heading level="h4">TELUS Pik TV<Heading.Sup>&trade;</Heading.Sup></Heading>
</div>
<div>
<Heading level="h1">Beats Solo<Heading.Sup>3</Heading.Sup> Wireless Headphones</Heading>
<Heading level="h2">Beats Solo<Heading.Sup>3</Heading.Sup> Wireless Headphones</Heading>
<Heading level="h3">Beats Solo<Heading.Sup>3</Heading.Sup> Wireless Headphones</Heading>
<Heading level="h4">Beats Solo<Heading.Sup>3</Heading.Sup> Wireless Headphones</Heading>
</div>
</div>
```
8 changes: 8 additions & 0 deletions src/components/Typography/Small/Small.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,21 @@ import safeRest from '../../../safeRest'

import styles from '../Text/Text.modules.scss'

/**
* The text you wish to display in small print
*
* <span class="docs--badge green">new!</span> <span class="docs--badge purple">v0.22.0</span>
*/
const Small = ({ children, ...rest }) => (
<small {...safeRest(rest)} className={`${styles.small} ${styles.smallFont}`}>
{children}
</small>
)

Small.propTypes = {
/**
* The text you wish to display in small print
*/
children: PropTypes.string.isRequired
}

Expand Down
4 changes: 3 additions & 1 deletion src/components/Typography/Small/Small.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
### Usage

```
<Small>This is legal text</Small>
<Small>Taxes and pay-per-use charges (including long distance, roaming and additional airtime or data) are extra.</Small>
```
3 changes: 3 additions & 0 deletions src/components/Typography/Strong/Strong.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ const Strong = ({ children, ...rest }) => (
)

Strong.propTypes = {
/**
* The text you wish to embolden
*/
children: PropTypes.string.isRequired
}

Expand Down
1 change: 1 addition & 0 deletions src/components/Typography/Strong/Strong.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
### Usage

```
<Strong>This text is bold</Strong>
Expand Down
5 changes: 5 additions & 0 deletions src/components/Typography/Text/Text.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ import TextSub from './TextSub/TextSub'

import styles from './Text.modules.scss'

/**
* Use to style small print, including copyright and legal text
*
* <span class="docs--badge green">new!</span> <span class="docs--badge purple">v0.22.0</span>
*/
const Text = ({ bold, size, invert, children, ...rest }) => {
const classes = `
${styles[size]}
Expand Down
22 changes: 19 additions & 3 deletions src/components/Typography/Text/Text.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
### Usage

The Text component can be used within other typography components such as [Paragraph](#paragraph). It is useful for modifying text appearance such as **bold**, or changing text size.

```
<Text>TELUS Pik TV<Text.Sup>&trade;</Text.Sup></Text>
<Text size="small" bold>Tell us what you think</Text>
```

### Usage
### Inherits props from Paragraph

The Text component can be used within other typography components such as [Paragraph](#paragraph). It is useful for modifying text appearance such as **bold**, or changing text size.
```
<Paragraph size="small"><Text size="small">Tell us what you think></Text> It's in our nature to listen.</Paragraph>
```

### Invert on dark colours

```
const PurpleBlock = require('../../__docs__/PurpleBlock').default;
<PurpleBlock>
<Text invert>Personal</Text>
</PurpleBlock>
```
3 changes: 3 additions & 0 deletions src/components/Typography/Text/Text.modules.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
position: relative;
vertical-align: baseline;
padding-left: 0.1em;
}

.sup, .sub {
font-size: .875rem;
}

Expand Down

0 comments on commit b082b14

Please sign in to comment.