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

Make set-type margins optional #141

Merged
merged 4 commits into from
Jan 14, 2019

Conversation

khawkins98
Copy link
Contributor

@khawkins98 khawkins98 commented Jan 11, 2019

There are cases where we want to use the default typography, but not have margins.

vf-badge is a good example of this:

image

The fix here is one approach, a few other options:

  1. As I've done but with different variable names/logic (not sure if I've done a good approach)"
  • mixin set-type($font-size, $global-font-family: $global-font-family, $set-margins: true) {
  1. Just let the margin: 0 0 var(--vf-text-margin--bottom, 16px) 0; and then unset/add margin-bottom: 0 (feels messy)
  2. Update the token YAML with a new prop:
  - name: button--r
    value:
      font-size: 16px
      font-weight: 700
      line-height: 1
      margin: 0 0 var(--vf-text-margin--bottom, 16px) 0

The way I've gone in this PR feels like the most balanced approach, I think.

There are cases where we want to use the default typogrpahy, but not have margins.
@khawkins98 khawkins98 added this to the v2.0.0-alpha.2 milestone Jan 11, 2019
@sturobson
Copy link

As the components seeemingly have different margins, and the variants could also have different margins. I wonder if we should leave it to a component level to set margin, instead of abstracting it away?

@khawkins98
Copy link
Contributor Author

khawkins98 commented Jan 12, 2019

I do like that the set-type gives you a reasonable default. I think we could also make it a bit more reasonable by looking at the font setting being passed and setting different margins...

  • body--* could get one setting
  • heading--* another
  • button--* gets nothing
  • and then an optional component param to disable the margins

(See updated PR)

@sturobson
Copy link

I like this, do you think it'd would be even better if we allow $margin to have a value that's passed through?

I'm wondering as we're using CSS custom properties that we can reset it, as needed, at the component level.

@sturobson
Copy link

Do we need to set an @if for the zero margins?

@khawkins98
Copy link
Contributor Author

Only thing I'd worry about doing --vf-text-margin--bottom: 0; at the component level: could potentially cascade within the component in weird ways? In theory, we should be able to scope our way out of it...

But, updated the PR with your thoughts, so now it supports three states: passed variable, automatic/default, disabled.

@sturobson
Copy link

cool :)

the idea is being employed in vf-summary where changes are scoped to the component variant:

.vf-summary--news .vf-summary__date {
  --vf-text-margin--bottom: 4px
}

@sturobson sturobson merged commit e324345 into develop Jan 14, 2019
@sturobson sturobson deleted the feature/make-set-type-margins-optional branch January 14, 2019 10:08
@khawkins98
Copy link
Contributor Author

Sounds good. I'm more than happy to defer to your judgement on how we should be setting/passing things around in the code, you've far more experience with the design/maintenance of 'em.

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.

None yet

2 participants