Skip to content

Global styles and rename Link component#115

Merged
lederer merged 6 commits intomasterfrom
feature/sml/global-styles
Dec 18, 2018
Merged

Global styles and rename Link component#115
lederer merged 6 commits intomasterfrom
feature/sml/global-styles

Conversation

@lederer
Copy link
Copy Markdown
Contributor

@lederer lederer commented Dec 17, 2018

Overview

Introduce GlobalStyle component to handle (opinionated) CSS reset.

Deprecate reset.css, including all references in build scripts and docs.

Rename Link component to A to avoid conflict with react-router.

Drive-by tweak to Header to ensure as prop defaults to h1.

Checklist

  • Relevant documentation pages have been created or updated
  • Description of PR is in an appropriate section of the changelog and grouped with similar changes if possible

Are there any of the following in this PR?

  • Changes to the prop names or types of existing components
  • Changes in intended behavior of existing component props
  • Changes in the theme file's structure
  • A required version bump to a non-dev dependency of the project

If one of the above is checked...

  • information or guidance around needed changes for consumers of this library has been added to the changelog under Upgrade Instructions

Notes

I created GlobalStyle using the blaster CLI so it lives as just another component in the core package. I thought about whether it would make sense to put it somewhere else, since it's sort of a system-level component, not one to be generally used by consumers. But, I couldn't think of a better place to put it, and since it's technically a styled-component like any other, I figured this is good enough for now.

I also considered what to name it, ultimately landing on GlobalStyle simply because that's what styled-components calls it. Should help minimize confusion.

A couple of enhancements we could make:

  1. A boolean reset prop that defaults to true, allowing consumers to opt out of the meyer reset code we're using.
  2. A css prop allowing consumers to pass in their own custom global CSS.

I'd be happy to make those enhancements as part of this PR if it makes sense.

Closes #92
Closes #93

@lederer lederer requested a review from designmatty December 17, 2018 18:26
@lederer
Copy link
Copy Markdown
Contributor Author

lederer commented Dec 18, 2018

Added ce37d9b to set up default fonts:

  • Change theme fonts object to include body, display, code
    • Removed sans and serif
  • Set <body> font-family to fonts.body in GlobalStyle
  • Default <Header> font-family to fonts.display via defaultProps

@designmatty Note that last bit, where I opted to set Header font via its defaultProp instead of via h1, h2, h3, h4, h5, h6 in GlobalStyle. After some thought I felt it made sense to have a single font-family declared for <body> and to use styled-system to override.

- Change theme `fonts` object to include `body`, `display`, `code`
- Set `<body>` font-family to `fonts.body` in `GlobalStyle`
- Default `<Header>` font-family to `fonts.display` via `defaultProps`
@lederer lederer force-pushed the feature/sml/global-styles branch from 6a620ec to ce37d9b Compare December 18, 2018 20:57
Copy link
Copy Markdown
Contributor

@designmatty designmatty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once CLI finishes @lederer this is good to go.

@lederer
Copy link
Copy Markdown
Contributor Author

lederer commented Dec 18, 2018

Awesome. Thanks!

@lederer lederer merged commit c3302fd into master Dec 18, 2018
@lederer lederer deleted the feature/sml/global-styles branch December 18, 2018 21:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants