Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: encapsulate Typography styles. #383

Merged
merged 3 commits into from
Jan 3, 2019
Merged

feat: encapsulate Typography styles. #383

merged 3 commits into from
Jan 3, 2019

Conversation

montezume
Copy link
Contributor

Closes #382

@montezume montezume requested review from emmenko and dferber90 January 3, 2019 11:58
'inverted',
])}
tone={select('Text tone', {
none: null,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixes storybook proptype warning

Copy link
Contributor

Choose a reason for hiding this comment

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

Could it also be fixed by providing a default value to select?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The problem was that when you selected "none", it set the proptype to none, which is not in the list.

@@ -39,8 +30,3 @@ a {
text-decoration: none;
transition: color 0.2s ease-in;
}

p {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

making reset.mod.css a bit lighter 👍

Copy link
Member

@emmenko emmenko left a comment

Choose a reason for hiding this comment

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

Nice! 🎉

rollup.config.js Outdated
@@ -49,6 +50,7 @@ const postcssPlugins = [
preserve: false,
importFrom: { 'custom-properties': customProperties },
}),
postcssNesting(),
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice. This removes the need to compose even more.

@montezume
Copy link
Contributor Author

Yay for Percy 🎉

Copy link
Contributor

@dferber90 dferber90 left a comment

Choose a reason for hiding this comment

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

Thanks for starting this!

I wonder whether we can simplify the CSS and avoid adding postcss-nesting.

To me postcss-nesting and css-modules don't seem like they would work together very well conceptually. But I've never actually used postcss-nesting together with css-modules.

'inverted',
])}
tone={select('Text tone', {
none: null,
Copy link
Contributor

Choose a reason for hiding this comment

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

Could it also be fixed by providing a default value to select?

font-size: var(--font-h4);
font-weight: normal;
}

h5 {
h5.subheadline {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we remove those h1 prefixes from the selectors? Our JS code should ensure that they're applied to the right elements. I wouldn't consider it part of the CSS's job.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We still need it for the font size though right? either that or we need two different classnames.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah yeah, I missed that part. I'm okay with either approach then 👍


&.negative {
color: var(--color-red);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we define separate top-level classes instead? Then we might not need the postcss-nesting plugin as well.

So something like

.bold {
  font-weight bold;
}

.positive {
   color: var(--color-green-25);
 }

.subheadline {
   margin: 0;
   color: var(--font-color);
 }

We are using the same "modifier" values from what I can tell, so this should reduce the amount of CSS as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done, I removed postcss-nesting and updated the PR to simplify the CSS. VRT still passing. I love VRT.

Copy link
Contributor

@dferber90 dferber90 left a comment

Choose a reason for hiding this comment

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

Nice 👍

@montezume montezume changed the title feat: encapsulate Typograph styles. feat: encapsulate Typography styles. Jan 3, 2019
@montezume montezume merged commit 874bf56 into master Jan 3, 2019
@montezume montezume deleted the ml-text branch January 3, 2019 12:55
@montezume montezume self-assigned this Jan 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants