Skip to content

Commit

Permalink
feat(heading): Reset padding and margin on all headings
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanoglesby08 committed Aug 29, 2017
1 parent ae7529b commit e3aa79d
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 14 deletions.
4 changes: 4 additions & 0 deletions src/components/Spacing.modules.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.noSpacing {
padding: 0;
margin: 0;
}
2 changes: 1 addition & 1 deletion src/components/Typography/Heading/Heading.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Heading.propTypes = {
]).isRequired,
display: PropTypes.bool,
invert: PropTypes.bool,
children: PropTypes.string.isRequired
children: PropTypes.node.isRequired
}
Heading.defaultProps = {
size: 'h1',
Expand Down
18 changes: 12 additions & 6 deletions src/components/Typography/Heading/Heading.modules.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@
@import '../../../scss/settings/typography';
@import '../../../scss/utility/responsive';

.heading-large {
.largeHeading {
composes: noSpacing from '../../Spacing.modules.scss';

color: $color-secondary;
font-weight: 400;
}

.heading-small {
.smallHeading {
composes: noSpacing from '../../Spacing.modules.scss';

color: $color-shark;
letter-spacing: -.6px;
font-weight: 700;
Expand All @@ -19,6 +23,8 @@
}

.displayHeading {
composes: noSpacing from '../../Spacing.modules.scss';

color: $color-secondary;
font-size: rem(44px);
line-height: 1.14; // 48px
Expand All @@ -32,7 +38,7 @@
}

.h1 {
composes: heading-large;
composes: largeHeading;

font-size: 1.75rem;
line-height: 1.29; // 36px
Expand All @@ -47,7 +53,7 @@
}

.h2 {
composes: heading-large;
composes: largeHeading;

font-size: 1.5rem;
line-height: 1.33; // 30px
Expand All @@ -61,14 +67,14 @@
}

.h3 {
composes: heading-small;
composes: smallHeading;

font-size: 1.25rem;
line-height: 1.4; // 28px
}

.h4 {
composes: heading-small;
composes: smallHeading;

font-size: 1rem;
line-height: 1.25; // 20px
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('Heading', () => {
expect(heading).toHaveText('Go home')
})

it('renders a heading in six sizes', () => {
it('renders a heading in four sizes', () => {
let heading = doShallow({ size: 'h1' })
expect(heading).toHaveTagName('h1')

Expand Down
3 changes: 2 additions & 1 deletion src/components/Typography/Paragraph/Paragraph.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ import classnames from 'classnames'

import safeRest from '../../../safeRest'

import spacingStyles from '../../Spacing.modules.scss'
import styles from './Paragraph.modules.scss'
import textStyles from '../Text/Text.modules.scss'

const Paragraph = ({ bold, size, align, invert, children, ...rest }, context) => {
const paragraphColor = invert ? textStyles.colorInverted : textStyles.color

const classes = classnames(
styles.noSpacing,
spacingStyles.noSpacing,
context.inheritColor ? styles.inheritColor : paragraphColor,
textStyles[size],
bold ? textStyles.boldFont : textStyles[`${size}Font`],
Expand Down
5 changes: 0 additions & 5 deletions src/components/Typography/Paragraph/Paragraph.modules.scss
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
.noSpacing {
padding: 0;
margin: 0;
}

.inheritColor {
color: inherit;
}
Expand Down

0 comments on commit e3aa79d

Please sign in to comment.