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

customize CSS namespace #2325

Merged
merged 27 commits into from
Apr 19, 2018
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
fc983d6
classes constants support custom namespace
Mar 27, 2018
cfd42a0
add $pt-namespace variable, alias as $ns
Mar 27, 2018
a187823
use $ns in all sass classes
Mar 27, 2018
17f0057
docs css examples replace $ns at render time
Mar 27, 2018
d57cb01
landing app uses landing- prefix
Mar 27, 2018
59c4a86
fix lint
Mar 27, 2018
796cef2
KSS examples: use `#{$ns}` in markup, simplify references
Mar 28, 2018
776aeff
replace ns interpolations in KSS examples at DM build time
Mar 28, 2018
2fdc0f9
do the documentalist ns replace in the stringify transform fn
Mar 28, 2018
c4b0745
fix examples styles
Mar 28, 2018
372e329
use Classes constants instead of hardcoded strings
Mar 28, 2018
8e66a96
add new Classes constants (from previous commit)
Mar 28, 2018
246012e
one more
Mar 28, 2018
f353054
use parent constant to derive child classes
Mar 28, 2018
1434de2
revert namespace
Mar 28, 2018
e5dbc2b
PopoverSizingExample uses custom class
Mar 28, 2018
cfc091e
use `@ns` in docs md files
Mar 28, 2018
8684245
replace `@ns` in compile-docs-data
Mar 28, 2018
2ce7f72
Merge branch 'develop' of github.com:palantir/blueprint into gg/custo…
Apr 3, 2018
c69f87b
fix table editable tests
Apr 3, 2018
28ae451
only one `$ns` variable
Apr 3, 2018
0219d8f
Merge branch 'develop' of github.com:palantir/blueprint into gg/custo…
Apr 18, 2018
53afd22
bring back env variable, namespace modifiers
Apr 18, 2018
957edfa
Merge branch 'develop' of github.com:palantir/blueprint into gg/custo…
Apr 18, 2018
120363d
Merge branch 'develop' of github.com:palantir/blueprint into gg/custo…
Apr 18, 2018
91dad55
add Classes docs page
Apr 18, 2018
584804c
outstanding pt- namespace references
Apr 19, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/core/src/_accessibility.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
@include focus-outline();
}

.pt-focus-disabled :focus {
.#{$ns}-focus-disabled :focus {
// override any focus outline anywhere
// stylelint-disable declaration-no-important
outline: none !important;

// special override for checkbox etc which render focus on a separate element
~ .pt-control-indicator {
~ .#{$ns}-control-indicator {
outline: none !important;
}
}
62 changes: 31 additions & 31 deletions packages/core/src/_typography.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ hr {
border: none;
border-bottom: 1px solid $pt-divider-black;

.pt-dark & {
.#{$ns}-dark & {
border-color: $pt-dark-divider-white;
}
}
Expand All @@ -37,12 +37,12 @@ Fonts
Markup:
<div class="{{.modifier}}">Blueprint components react overlay date picker.</div>

.pt-monospace-text - Use a monospace font (ideal for code)
.#{$ns}-monospace-text - Use a monospace font (ideal for code)

Styleguide fonts
*/

.pt-monospace-text {
.#{$ns}-monospace-text {
@include monospace-typography();
}

Expand Down Expand Up @@ -86,17 +86,17 @@ UI text
Markup:
<div class="{{.modifier}}">Blueprint components react overlay date picker.</div>

.pt-ui-text - Default UI text. This is applied to the document body as part of core styles.
.pt-ui-text-large - Larger UI text.
.#{$ns}-ui-text - Default UI text. This is applied to the document body as part of core styles.
.#{$ns}-ui-text-large - Larger UI text.

Styleguide pt-ui-text
*/

.pt-ui-text {
.#{$ns}-ui-text {
@include base-typography();
}

.pt-ui-text-large {
.#{$ns}-ui-text-large {
line-height: 1.25;
font-size: $pt-font-size-large;
}
Expand All @@ -107,23 +107,23 @@ Running text
Markup:
<div class="{{.modifier}}">
<p>Longform text, such as rendered Markdown documents, benefit from additional spacing and slightly
large font size. Apply <code>.pt-running-text</code> to the parent element to adjust spacing for the following
large font size. Apply <code>.#{$ns}-running-text</code> to the parent element to adjust spacing for the following
elements:</p>
<ul>
<li><code>&lt;p></code> tags have increased line-height and font size.</li>
<li><code>&lt;h*></code> tag margins are adjusted to provide clear separation between sections in a document.</li>
<li><code>&lt;ul></code> and <code>&lt;ol></code> tags receive [`.pt-list`](#typography.lists) styles for legibility.</li>
<li><code>&lt;ul></code> and <code>&lt;ol></code> tags receive [`.#{$ns}-list`](#typography.lists) styles for legibility.</li>
</ul>
<h3>New section</h3>
<p>And another paragraph.</p>
</div>

.pt-running-text - Apply larger font size and additional spacing.
.#{$ns}-running-text - Apply larger font size and additional spacing.

Styleguide pt-running-text
*/

.pt-running-text {
.#{$ns}-running-text {
@include running-typography();

@each $header, $props in $headers {
Expand All @@ -134,7 +134,7 @@ Styleguide pt-running-text
}
}

.pt-running-text-small {
.#{$ns}-running-text-small {
@include running-typography-small();
}

Expand Down Expand Up @@ -169,12 +169,12 @@ a {
}

code,
.pt-dark & code {
.#{$ns}-dark & code {
color: inherit;
}

.pt-dark &,
.pt-dark &:hover {
.#{$ns}-dark &,
.#{$ns}-dark &:hover {
color: $pt-dark-link-color;

#{$icon-classes} {
Expand Down Expand Up @@ -222,7 +222,7 @@ code {
padding: 2px 5px;
color: $pt-code-text-color;

.pt-dark & {
.#{$ns}-dark & {
box-shadow: inset border-shadow(0.4);
background: $pt-dark-code-background-color;
color: $pt-dark-code-text-color;
Expand Down Expand Up @@ -252,7 +252,7 @@ pre {
font-size: inherit;
}

.pt-dark & {
.#{$ns}-dark & {
box-shadow: inset 0 0 0 1px $pt-dark-divider-black;
background: $pt-dark-code-background-color;
color: $pt-dark-text-color;
Expand Down Expand Up @@ -296,7 +296,7 @@ blockquote {
margin-bottom: 0;
}

.pt-dark & {
.#{$ns}-dark & {
border-color: rgba($gray2, 0.5);
}
}
Expand All @@ -316,8 +316,8 @@ Markup:
<li>Item the third</li>
</ol>

.pt-list - Add a little spacing between items for readability.
.pt-list-unstyled - Remove all list styling (including indicators) so you can add your own.
.#{$ns}-list - Add a little spacing between items for readability.
.#{$ns}-list-unstyled - Remove all list styling (including indicators) so you can add your own.

Styleguide lists
*/
Expand All @@ -328,9 +328,9 @@ ul {
padding-left: $pt-grid-size * 4;
}

.pt-list,
.pt-running-text ul,
.pt-running-text ol {
.#{$ns}-list,
.#{$ns}-running-text ul,
.#{$ns}-running-text ol {
li:not(:last-child) {
padding-bottom: $pt-grid-size / 2;
}
Expand All @@ -346,7 +346,7 @@ ul {
}
}

.pt-list-unstyled {
.#{$ns}-list-unstyled {
margin: 0;
padding: 0;
list-style: none;
Expand All @@ -364,22 +364,22 @@ Markup:
Blueprint components react overlay date picker. Breadcrumbs dialog progress non-ideal state.
</div>

.pt-text-muted - Changes text color to a gentler gray.
.pt-text-overflow-ellipsis - Truncates a single line of text with an ellipsis if it overflows its
.#{$ns}-text-muted - Changes text color to a gentler gray.
.#{$ns}-text-overflow-ellipsis - Truncates a single line of text with an ellipsis if it overflows its
container.

Styleguide utilities
*/

.pt-text-muted {
.#{$ns}-text-muted {
color: $pt-text-color-muted;

.pt-dark & {
.#{$ns}-dark & {
color: $pt-dark-text-color-muted;
}
}

.pt-text-overflow-ellipsis {
.#{$ns}-text-overflow-ellipsis {
@include overflow-ellipsis();
}

Expand All @@ -401,11 +401,11 @@ Markup:
Styleguide pt-rtl
*/

.pt-rtl {
.#{$ns}-rtl {
text-align: right;
}

.pt-dark {
.#{$ns}-dark {
color: $pt-dark-text-color;

@each $header, $props in $headers {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/common/_flex.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// supply `$margin` to put space between each child.
// supply `$inline: inline` to use `display: flex-inline`.
// customize `flex: 1 1` child selector with $fill.
@mixin pt-flex-container($direction: row, $margin: none, $inline: none, $fill: ".pt-fill") {
@mixin pt-flex-container($direction: row, $margin: none, $inline: none, $fill: ".#{$ns}-fill") {
@if $inline == inline or $inline == true {
display: inline-flex;
} @else {
Expand Down
3 changes: 3 additions & 0 deletions packages/core/src/common/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
@import "colors";
@import "mixins";

$pt-namespace: "pt" !default;
Copy link
Contributor

@llorca llorca Mar 27, 2018

Choose a reason for hiding this comment

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

why not one var like $ns: "pt" !default or $namespace: "pt" !default or $blueprint-namespace: "pt" !default?

$ns: $pt-namespace;

// easily the most important variable, so it comes first
// (so other variables can use it to define themselves)
$pt-grid-size: 10px !default;
Expand Down
Loading