-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Refactor tags to support custom colors #668
Conversation
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's a really nice potential css refactor in here with this mixin, let's see if we can get there.
@@ -11,14 +11,16 @@ $tag-margin: ($pt-input-height - $tag-height) / 2 !default; | |||
$tag-height-large: $pt-grid-size * 3 !default; | |||
$tag-padding-large: ($tag-height-large - $pt-icon-size-large) / 2 !default; | |||
|
|||
$tag-removable-selector: "&.pt-tag-removable"; |
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.
no need for variable here cuz it can't be customized anymore. just do the normal selector thing and write it out in css below.
@@ -80,6 +82,8 @@ Styleguide components.tag.css | |||
.pt-intent-success - Success intent | |||
.pt-intent-warning - Warning intent | |||
.pt-intent-danger - Danger intent | |||
.pt-rose - Rose | |||
.pt-cobalt - Cobalt |
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.
👎 these are not real modifiers; they cannot appear in the modifier table.
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.
Yup that was just for showcase in the PR
background: none; | ||
cursor: pointer; | ||
padding: $tag-padding; | ||
@mixin custom-tag($color, $dark-color, $background-color) { |
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.
call this mixin tag-colors()
and use it to implement intents above.
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 tried to do that yesterday, but it's actually not that easy because this mixin implement its own pt-minimal
and pt-dark
which would conflict with other usages above
- they're all pt-tag-* now to indicate that they're somewhat public. - this is a Sass API break but those are unsupported so it's chill. - intent coloring has been pulled out to mixins--they don't come for free with the base mixin and that's ok.
&:not([class*="pt-intent-"]) { | ||
background: rgba($gray3, 0.2); | ||
background-color: rgba($gray3, 0.2); |
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.
Out of scope for this PR, but whoa, didn't realize we were using a non-standard color for minimal-tag backgrounds. Reasoning for not just using $light-gray4
?
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.
If you put a $light-gray4
tag on top of a $light-gray4
background, you end up with a problem 🎩 Transparency keeps this safe no matter what the background color
color: map-get($pt-intent-text-colors, $intent); | ||
} | ||
@mixin pt-tag-minimal-intent($background-color, $text-color, $dark-text-color) { | ||
background-color: rgba($background-color, 0.15); |
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.
What if I want an exact color for the background (e.g. some really light color from my style guide's color palette)?
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.
Fair point, but not a recommended practice for the same reasoning than above
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.
Eh I'll go ahead and approve. Looks good overall, just had a couple of questions. See above.
Fixes #606
Changes proposed in this pull request:
pt-tag[-*]()
now to indicate that they're sort-of public.-intent
and-minimal-intent
mixins for custom coloring, and use them to generate our own intent styles.