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

Spacing refactor rebased on the 3.0 feature branch #3971

Merged
merged 9 commits into from
Sep 15, 2021

Conversation

lyubomir-popov
Copy link
Contributor

@lyubomir-popov lyubomir-popov commented Sep 6, 2021

Done

[List of work items including drive-bys]

Fixes https://github.com/canonical-web-and-design/vanilla-squad/issues/1104

QA

  • Review refactoring and simplicity of use of the proposed systtem of spacing variables
  • Review Percy for any regressions
  • Review updated documentation:
    • docs/settings/spacing-settings

@webteam-app
Copy link

Demo starting at https://vanilla-framework-3971.demos.haus

@lyubomir-popov lyubomir-popov changed the base branch from master to vanilla-3.0 September 7, 2021 08:16
@lyubomir-popov
Copy link
Contributor Author

@bartaz @sowasred2012 I think this is ready for review. Haven't ticked all the checkboxes as I am not sure whether they apply to the 3.0 feature branch, if they do I'll add those changes too, just let me know please.

remove some morre variables that are not needed

add some clarifications and remove unnecessary var

test change to see if percy works on this branch

convert some remaining vars

fix-typo

update spacing md file

remove unneeded markup

fix table explanations

fix typo

fix tyypo
Copy link
Contributor

@sowasred2012 sowasred2012 left a comment

Choose a reason for hiding this comment

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

Looks good, and Percy passes - just one question about the code.

Comment on lines 59 to 63
margin-left: -#{$sph--small};
}

&:last-child {
margin-right: -#{$sph-inner--small};
margin-right: -#{$sph--small};
Copy link
Contributor

Choose a reason for hiding this comment

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

Is interpolation needed in these cases? There's an example of a negative variable in another file in this PR here that doesn't use interpolation

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know why GH won't allow me to add a suggested change here, but yes, this interpolation could be removed.

Comment on lines 100 to 101
margin-left: -#{$sph--small};
margin-right: $sph--small;
Copy link
Contributor

Choose a reason for hiding this comment

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

Same question re: interpolation

Copy link
Contributor

@bartaz bartaz left a comment

Choose a reason for hiding this comment

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

Looks great, thanks! Couple minor suggestions in inline comments.

scss/_base_button.scss Outdated Show resolved Hide resolved
scss/_base_button.scss Outdated Show resolved Hide resolved
scss/_patterns_pagination.scss Outdated Show resolved Hide resolved
Comment on lines 59 to 63
margin-left: -#{$sph--small};
}

&:last-child {
margin-right: -#{$sph-inner--small};
margin-right: -#{$sph--small};
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know why GH won't allow me to add a suggested change here, but yes, this interpolation could be removed.

scss/_patterns_search-box.scss Outdated Show resolved Hide resolved
scss/_patterns_search-box.scss Outdated Show resolved Hide resolved
scss/_patterns_side-navigation.scss Outdated Show resolved Hide resolved
@@ -7,70 +7,60 @@ context:
# Spacing

<hr>
Spacing in Vanilla is controlled via a set of variables. There are two kinds of variables - nudges, which keep text aligned to the baseline grid, and multiples of the spacing unit, which define vertical and horizontal spacing.
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason why you list "nudges" always before standard 'multiples' spacing?

I think it would be clearer to do the opposite. The default (and easier to understand) are the spacing unit based variables, only if something doesn't align to baseline it uses nudges.
So in case of this sentence:

Suggested change
Spacing in Vanilla is controlled via a set of variables. There are two kinds of variables - nudges, which keep text aligned to the baseline grid, and multiples of the spacing unit, which define vertical and horizontal spacing.
Spacing in Vanilla is controlled via a set of variables. There are two kinds of variables - multiples of the spacing unit, which define vertical and horizontal spacing. and nudges, which keep text aligned to the baseline grid.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Precisely because they are more likely to be overlooked - especially if left after a second "and". they are also the firsrt things thst need to be set right, otherwise nothing would align to the baseline grid, and the multiples would be pointless.


Vanilla uses a default spacing unit of `.5rem` (`8px`) as a basis to calculate spacing inside and between components, as well as the line-heights of the different type sizes.
- text baselines are "nudged" until they fall precisely on the grid
- any margin, padding or other positioning happens in multiples of the baseline grid spacing unit.
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd move this up above the point with nudges.

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 nudges is what makes vertical rhythm work, I don't want them to feel like an optional final step - that's why I always put it at the top.

- text baselines are "nudged" until they fall precisely on the grid
- any margin, padding or other positioning happens in multiples of the baseline grid spacing unit.

## Nudges
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd move the nudge section down to the bottom after other spacing is defined.

lyubomir-popov and others added 6 commits September 14, 2021 09:16
Co-authored-by: Bartek Szopka <83575+bartaz@users.noreply.github.com>
Co-authored-by: Bartek Szopka <83575+bartaz@users.noreply.github.com>
Co-authored-by: Bartek Szopka <83575+bartaz@users.noreply.github.com>
Co-authored-by: Bartek Szopka <83575+bartaz@users.noreply.github.com>
Co-authored-by: Bartek Szopka <83575+bartaz@users.noreply.github.com>
Co-authored-by: Bartek Szopka <83575+bartaz@users.noreply.github.com>
Copy link
Contributor

@bartaz bartaz left a comment

Choose a reason for hiding this comment

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

Great work, thanks!

@bartaz bartaz merged commit 540865f into canonical:vanilla-3.0 Sep 15, 2021
bartaz added a commit to bartaz/vanilla-framework that referenced this pull request Sep 15, 2021
Co-authored-by: Bartek Szopka <83575+bartaz@users.noreply.github.com>
petesfrench added a commit to petesfrench/vanilla-framework that referenced this pull request Sep 16, 2021
sowasred2012 pushed a commit that referenced this pull request Sep 29, 2021
Co-authored-by: Bartek Szopka <83575+bartaz@users.noreply.github.com>
sowasred2012 pushed a commit that referenced this pull request Oct 6, 2021
Co-authored-by: Bartek Szopka <83575+bartaz@users.noreply.github.com>
sowasred2012 pushed a commit that referenced this pull request Oct 11, 2021
Co-authored-by: Bartek Szopka <83575+bartaz@users.noreply.github.com>
bartaz added a commit that referenced this pull request Oct 13, 2021
Co-authored-by: Bartek Szopka <83575+bartaz@users.noreply.github.com>
sowasred2012 pushed a commit that referenced this pull request Oct 21, 2021
Co-authored-by: Bartek Szopka <83575+bartaz@users.noreply.github.com>
bartaz added a commit to bartaz/vanilla-framework that referenced this pull request Oct 25, 2021
Co-authored-by: Bartek Szopka <83575+bartaz@users.noreply.github.com>
bartaz added a commit that referenced this pull request Nov 3, 2021
Co-authored-by: Bartek Szopka <83575+bartaz@users.noreply.github.com>
bartaz added a commit that referenced this pull request Nov 3, 2021
Co-authored-by: Bartek Szopka <83575+bartaz@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants