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 all 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;
}
}
72 changes: 36 additions & 36 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
Styleguide 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 <code>.#{$ns}-list</code> 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
Styleguide 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 @@ -388,24 +388,24 @@ Right-to-left text
Markup:
<h4>Arabic:</h4>
<p class="pt-rtl">
<p class="#{$ns}-rtl">
لكل لأداء بمحاولة من. مدينة الواقعة يبق أي, وإعلان وقوعها، حول كل, حدى عجّل مشروط الخاسرة قد.
من الذود تكبّد بين, و لها واحدة الأراضي. عل الصفحة والروسية يتم, أي للحكومة استعملت شيء. أم وصل زهاء اليا
</p>
<h4>Hebrew:</h4>
<p class="pt-rtl">
<p class="#{$ns}-rtl">
כדי על עזרה יידיש הבהרה, מלא באגים טכניים דת. תנך או ברית ביולי. כתב בה הטבע למנוע, דת כלים פיסיקה החופשית זכר.
מתן החלל מאמרשיחהצפה ב. הספרות אנציקלופדיה אם זכר, על שימושי שימושיים תאולוגיה עזה
</p>
Styleguide pt-rtl
Styleguide 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
8 changes: 4 additions & 4 deletions packages/core/src/common/_react-transition.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ value). For enter & appear transitions, each property will transition from its i
value. For exit transitions, each property will transition in reverse, from final to initial.
**Simple example:**
`@include react-transition("pt-popover", (opacity: 0 1), $before: "&");`
Transition named "pt-popover" moves opacity from 0 to 1. `"&"` indicates that the
`@include react-transition("popover", (opacity: 0 1), $before: "&");`
Transition named "popover" moves opacity from 0 to 1. `"&"` indicates that the
Transition classes are expected to be applied to this element, where the mixin is invoked.
**Params:**
Expand Down Expand Up @@ -52,8 +52,8 @@ If `enter` phase is given then `appear` phase will be generated at the same time
If `exit` phase is given then property values are animated in reverse, from final to initial.
**Example:**
@include react-transition-phase(pt-toast, enter, $enter-translate, $before: "&");
@include react-transition-phase(pt-toast, leave, $leave-blur, $pt-transition-duration * 3, $before: "&");
@include react-transition-phase(toast, enter, $enter-translate, $before: "&");
@include react-transition-phase(toast, leave, $leave-blur, $pt-transition-duration * 3, $before: "&");
*/
@mixin react-transition-phase(
$name,
Expand Down
5 changes: 4 additions & 1 deletion packages/core/src/common/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
@import "colors";
@import "mixins";

// easily the most important variable, so it comes first
// Namespace appended to the beginning of each CSS class: `.#{$ns}-button`.
$ns: "pt" !default;

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

Expand Down
Loading