-
Notifications
You must be signed in to change notification settings - Fork 122
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
Add a babel plugin to handle the gu unit #500
Conversation
@@ -0,0 +1,53 @@ | |||
import { isStyled, isHelper } from './utils/detectors' | |||
|
|||
const GU = 8 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to bring this from aragonUI
?
import { GU } from '@aragon/ui'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I thought about it, but it would mean either having a specific aragonUI as a dependency, or having it as a peerDependency, which doesn’t work since we also want to use it from aragonUI itself 😆
So I thought it’s just simpler to have it hardcoded. Another option would be to transform to x * GU
, and add the import dynamically, but it seems a bit too much for something that should not change often, if ever.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, makes sense, tough circular dependency, we'll need to keep this in sync or we might end up with two different values for GU
|
||
## Features | ||
|
||
- Adds the `gu` unit to styled component’s CSS blocks (in normal styled |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This paragraph sounds like the description, maybe it should go right after the h1?
Should we add some usage?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I need to make this a bit better, with some examples to. I also added some “To do” items in the PR description that I’ll add later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️ gu
26f0baa
to
a61268e
Compare
Should we pick this up again or just close? A babel plugin for |
@Evalir I think we could merge it in its current state, since it is functional and separated from aragonUI. The idea of leaving this open was to have other people testing it a little bit more, but we or someone else can iterate on it in separate PRs. What do you think? |
Sounds good to me! Let's merge and then iterate on it. 😬 |
Adds the gu unit to styled component’s CSS blocks (in normal styled components, in the css prop, or using the css helper).
See discussion: https://github.com/aragon/aragon-ui/issues/333
babel-plugin-aragon-ui
Plugin greatly inspired from babel-plugin-styled-components, and made to work with it.
What it does
Transforms this:
Into this:
Features
gu
unit to styled component’s CSS blocks (in normal styledcomponents, in the
css
prop, or using thecss
helper).Installation
In your .babelrc, declare this plugin before styled-components:
To do
-ui-text-style: title1
-ui-theme(surfaceContent)
Note: both are using the CSS syntax for proprietary extensions, but we might as well decide to drop them, or not follow it exactly (e.g. by removing the initial
-
).