-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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 constant spacing #432
Add constant spacing #432
Conversation
Codecov Report
@@ Coverage Diff @@
## master #432 +/- ##
=========================================
- Coverage 94.24% 94.2% -0.05%
=========================================
Files 78 78
Lines 1113 1121 +8
Branches 246 247 +1
=========================================
+ Hits 1049 1056 +7
- Misses 60 61 +1
Partials 4 4
Continue to review full report at Codecov.
|
marginLeft: -30, | ||
paddingLeft: 30, | ||
marginLeft: -32, | ||
paddingLeft: spacing.space32, |
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.
I think they both should you the same variable.
@@ -9,19 +9,19 @@ | |||
.tableBody { |
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.
We don’t use this file, could you please remove it? Merge artifact ;-/
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.
Sure!
paddingRight: 15, | ||
paddingBottom: 6, | ||
paddingRight: spacing.space16, | ||
paddingTop: spacing.space8, |
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.
Looks like a typo, it should be bottom padding.
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.
Sorry , typo
root: { | ||
margin: [[-15, -15, -18]], | ||
margin: [[-16, -16, -16]], |
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.
space16? But actually this numbers are not random — the red background should fill the playground container.
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.
I will change them back and add that as a comment
src/styles/theme.js
Outdated
@@ -10,7 +12,17 @@ export const type = '#b77daa'; | |||
export const baseBackground = '#fff'; | |||
export const errorBackground = '#c00'; | |||
export const codeBackground = '#f5f5f5'; | |||
export const font = ['-apple-system', 'BlinkMacSystemFont', '"Segoe UI"', '"Roboto"', '"Oxygen"', '"Ubuntu"', | |||
export const font = ['"Roboto"', '-apple-system', 'BlinkMacSystemFont', '"Segoe UI"', '"Roboto"', '"Oxygen"', '"Ubuntu"', |
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.
Why Roboto?
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.
Because it's pretty. That's all :p
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.
We’re using system fonts.
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.
But why ?
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.
They are available on all platforms, they look good (especially SF ;-) and they are used in the OS UI.
How many people have Roboto installed? :-)
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.
Not many , but for those who don't we can just go to the apple-system ones
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.
Sorry, I don’t see any reason to use Roboto just for a few people who have it, while system fonts are still better.
'"Cantarell"', '"Fira Sans"', '"Droid Sans"', '"Helvetica Neue"', 'sans-serif']; | ||
export const monospace = ['Consolas', '"Liberation Mono"', 'Menlo', 'monospace']; | ||
export const small = '@media (max-width: 600px)'; | ||
export const sidebarWidth = 200; | ||
export const spacing = { |
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.
I’d use space.0
, space.1
, space.2
. Actual numbers are implementation detail, so it’s a bit like red = blue
thing ;-)
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.
I did it like this to be easier to make sense of it, so when someone sees space16 they will see its 16 px
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.
In that case you need to remember that and calculate the right number every time, with 1, 2, 3 it easy: single space, double space…
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.
But the first one is half , how should I call it ?
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.
Spacing renamed to:
export const spacing = {
0: `${spacingFactor / 2}px`, // 4
1: `${spacingFactor}px`, // 8
2: `${spacingFactor * 2}px`, // 16
3: `${spacingFactor * 3}px`, // 24
4: `${spacingFactor * 4}px`, // 32
5: `${spacingFactor * 5}px`, // 40
6: `${spacingFactor * 6}px`, // 48
};
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.
I also exported the spacingFactor if someone wants to change it in their project
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.
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.
Changed :)
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.
👍
fontFamily: font, | ||
fontSize: 15, | ||
fontSize: spacing.space16, |
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.
We shouldn’t use spacers for font sizes. But would be nice to have variables for that too.
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.
Typo again, but I can add some :)
@sapegin Most of the requested changes were made and I added font variables too :) |
@sapegin All changed made. may I merge ? |
Merged, thanks! |
1. More consistent naming. 2. Use numbers instead of strings for spacing. 3. Group font families, media queries, colors. 4. Variable for border radius. 5. Fix bugs introduced in the previous commit.
I’ve made some tweaks in 19ed879 ;-) |
1. Variables for sidebar background and max width. 2. Fix error color. @SaraVieira 👻
This PR adds constant spacing throughout the project with an 8px grid.
I did this by adding the spacing variables to the theme like so:
These were the only spaces I used in the entire project to main consistency.