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

Add constant spacing #432

Merged
merged 5 commits into from
May 7, 2017
Merged

Add constant spacing #432

merged 5 commits into from
May 7, 2017

Conversation

SaraVieira
Copy link
Collaborator

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:

const spacingFactor = 8;
export const spacing = {
	space4: `${spacingFactor / 2}px`,  // 4
	space8: `${spacingFactor}px`,      // 8
	space16: `${spacingFactor * 2}px`,  // 16
	space24: `${spacingFactor * 3}px`,  // 24
	space32: `${spacingFactor * 4}px`,  // 32
	space40: `${spacingFactor * 5}px`,  // 40
	space48: `${spacingFactor * 6}px`,  // 48
};

These were the only spaces I used in the entire project to main consistency.

@SaraVieira SaraVieira requested review from okonet and sapegin May 6, 2017 17:36
@codecov-io
Copy link

codecov-io commented May 6, 2017

Codecov Report

Merging #432 into master will decrease coverage by 0.04%.
The diff coverage is 100%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
src/rsg-components/Section/SectionRenderer.js 100% <100%> (ø) ⬆️
src/rsg-components/Logo/LogoRenderer.js 100% <100%> (ø) ⬆️
...omponents/ReactComponent/ReactComponentRenderer.js 100% <100%> (ø) ⬆️
...ponents/PlaygroundError/PlaygroundErrorRenderer.js 100% <100%> (ø) ⬆️
src/rsg-components/Markdown/Markdown.js 90.47% <100%> (ø) ⬆️
...ponents/TableOfContents/TableOfContentsRenderer.js 100% <100%> (ø) ⬆️
...rc/rsg-components/Playground/PlaygroundRenderer.js 90.9% <100%> (ø) ⬆️
src/rsg-components/Methods/MethodsRenderer.js 100% <100%> (ø) ⬆️
src/styles/theme.js 100% <100%> (ø) ⬆️
src/rsg-components/Message/MessageRenderer.js 100% <100%> (ø) ⬆️
... and 8 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ccfb8e8...a9a8c24. Read the comment docs.

marginLeft: -30,
paddingLeft: 30,
marginLeft: -32,
paddingLeft: spacing.space32,
Copy link
Member

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 {
Copy link
Member

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 ;-/

Copy link
Collaborator Author

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,
Copy link
Member

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.

Copy link
Collaborator Author

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]],
Copy link
Member

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.

Copy link
Collaborator Author

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

@@ -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"',
Copy link
Member

Choose a reason for hiding this comment

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

Why Roboto?

Copy link
Collaborator Author

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

Copy link
Member

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

But why ?

Copy link
Member

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? :-)

Copy link
Collaborator Author

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

Copy link
Member

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 = {
Copy link
Member

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 ;-)

Copy link
Collaborator Author

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

Copy link
Member

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…

Copy link
Collaborator Author

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 ?

Copy link
Collaborator Author

@SaraVieira SaraVieira May 7, 2017

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
};

Copy link
Collaborator Author

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

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Changed :)

Copy link
Member

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,
Copy link
Member

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.

Copy link
Collaborator Author

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 :)

@SaraVieira
Copy link
Collaborator Author

@sapegin Most of the requested changes were made and I added font variables too :)

@SaraVieira
Copy link
Collaborator Author

SaraVieira commented May 7, 2017

@sapegin All changed made. may I merge ?

@sapegin sapegin merged commit f4e894a into master May 7, 2017
@sapegin sapegin deleted the spacing branch May 7, 2017 21:47
@sapegin
Copy link
Member

sapegin commented May 7, 2017

Merged, thanks!

sapegin added a commit that referenced this pull request May 8, 2017
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.
@sapegin
Copy link
Member

sapegin commented May 8, 2017

I’ve made some tweaks in 19ed879 ;-)

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.

3 participants