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

Wrap styles of BpkLink and bpk-stylesheets in layers #3102

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
2 changes: 1 addition & 1 deletion packages/bpk-component-link/src/BpkLink.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@keyframes bpk-keyframe-spin{100%{transform:rotate(1turn)}}.bpk-link{padding:0;border:0;background-color:transparent;text-decoration:none;cursor:pointer;appearance:none;color:#0062e3;color:var(--bpk-link-color, #0062e3)}.bpk-no-touch-support .bpk-link:hover:not(:active):not(:disabled){text-decoration:underline;color:#0062e3;color:var(--bpk-link-hover-color, #0062e3)}:global(.bpk-no-touch-support) .bpk-link:hover:not(:active):not(:disabled){text-decoration:underline;color:#0062e3;color:var(--bpk-link-hover-color, #0062e3)}.bpk-link:visited{color:#0062e3;color:var(--bpk-link-visited-color, #0062e3)}.bpk-link:active{text-decoration:underline;color:#0062e3;color:var(--bpk-link-active-color, #0062e3)}.bpk-link--active{color:#0062e3}.bpk-link--active:visited{color:#0062e3}.bpk-link--active:active{color:#0062e3}.bpk-link--alternate{color:#fff;color:var(--bpk-link-alternate-color, #fff)}.bpk-no-touch-support .bpk-link--alternate:hover:not(:active):not(:disabled){color:#fff;color:var(--bpk-link-alternate-hover-color, #fff)}:global(.bpk-no-touch-support) .bpk-link--alternate:hover:not(:active):not(:disabled){color:#fff;color:var(--bpk-link-alternate-hover-color, #fff)}.bpk-link--alternate:visited{color:#fff;color:var(--bpk-link-alternate-visited-color, #fff)}.bpk-link--alternate:active{color:#fff;color:var(--bpk-link-alternate-active-color, #fff)}
@layer component{@keyframes bpk-keyframe-spin{100%{transform:rotate(1turn)}}.bpk-link{padding:0;border:0;background-color:transparent;text-decoration:none;cursor:pointer;appearance:none;color:#0062e3;color:var(--bpk-link-color, #0062e3)}.bpk-no-touch-support .bpk-link:hover:not(:active):not(:disabled){text-decoration:underline;color:#0062e3;color:var(--bpk-link-hover-color, #0062e3)}:global(.bpk-no-touch-support) .bpk-link:hover:not(:active):not(:disabled){text-decoration:underline;color:#0062e3;color:var(--bpk-link-hover-color, #0062e3)}.bpk-link:visited{color:#0062e3;color:var(--bpk-link-visited-color, #0062e3)}.bpk-link:active{text-decoration:underline;color:#0062e3;color:var(--bpk-link-active-color, #0062e3)}.bpk-link--active{color:#0062e3}.bpk-link--active:visited{color:#0062e3}.bpk-link--active:active{color:#0062e3}.bpk-link--alternate{color:#fff;color:var(--bpk-link-alternate-color, #fff)}.bpk-no-touch-support .bpk-link--alternate:hover:not(:active):not(:disabled){color:#fff;color:var(--bpk-link-alternate-hover-color, #fff)}:global(.bpk-no-touch-support) .bpk-link--alternate:hover:not(:active):not(:disabled){color:#fff;color:var(--bpk-link-alternate-hover-color, #fff)}.bpk-link--alternate:visited{color:#fff;color:var(--bpk-link-alternate-visited-color, #fff)}.bpk-link--alternate:active{color:#fff;color:var(--bpk-link-alternate-active-color, #fff)}}
19 changes: 10 additions & 9 deletions packages/bpk-component-link/src/BpkLink.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@layer component {
@import '../../bpk-mixins/index.scss';

@import '../../bpk-mixins/index.scss';
.bpk-link {
@include bpk-link;

.bpk-link {
@include bpk-link;
&--active {
@include bpk-link--active;
}

&--active {
@include bpk-link--active;
}

&--alternate {
@include bpk-link--alternate;
&--alternate {
@include bpk-link--alternate;
}
}
}
2 changes: 1 addition & 1 deletion packages/bpk-stylesheets/base.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

96 changes: 54 additions & 42 deletions packages/bpk-stylesheets/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,65 +16,77 @@
* limitations under the License.
*/

@import '~normalize.css';
@import '../bpk-mixins/index.scss';
@layer reset, theme, utility;

// stylelint-disable-next-line selector-max-type
html {
font-size: $bpk-font-size-root;
box-sizing: border-box;
@layer reset {
@import '~normalize.css';
}

* {
box-sizing: inherit;
@layer theme {
@import '../bpk-mixins/index.scss';

&::before,
&::after {
box-sizing: inherit;
// stylelint-disable-next-line selector-max-type
html {
font-size: $bpk-font-size-root;
box-sizing: border-box;
}
}

/* stylelint-disable selector-class-pattern */
body {
color: $bpk-font-color-base;
font-family: $bpk-font-family-base;
font-size: $bpk-font-size-base;
line-height: 1.3rem; /* stylelint-disable-line scale-unlimited/declaration-strict-value */
* {
box-sizing: inherit;

:global(&.scaffold-font-size) {
font-size: 13px; /* stylelint-disable-line unit-disallowed-list, scale-unlimited/declaration-strict-value */
&::before,
&::after {
box-sizing: inherit;
}
}

:global(&.enable-font-smoothing) {
-webkit-font-smoothing: antialiased;
/* stylelint-disable selector-class-pattern */
body {
color: $bpk-font-color-base;
font-family: $bpk-font-family-base;
font-size: $bpk-font-size-base;
line-height: 1.3rem; /* stylelint-disable-line scale-unlimited/declaration-strict-value */

:global(&.scaffold-font-size) {
font-size: 13px; /* stylelint-disable-line unit-disallowed-list, scale-unlimited/declaration-strict-value */
}

:global(&.enable-font-smoothing) {
-webkit-font-smoothing: antialiased;
}
}
}

:focus-visible {
@include bpk-focus-indicator;
}
@layer utility {
/* stylelint-disable-next-line no-duplicate-at-import-rules, no-invalid-position-at-import-rule */
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Had to disable two lint rules here, mixins needs imported twice, each for the two layers.
This could be solved by combining theme and utility into one layer

Copy link
Member

Choose a reason for hiding this comment

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

I was going to say everything in this file should come under one layer that I would see as base as this is core across everything and acts as the base the system then builds on

@import '../bpk-mixins/index.scss';

:global(.hidden),
:global(.hide) {
@include bpk-hidden;
}
:focus-visible {
@include bpk-focus-indicator;
}

:global(.visuallyhidden),
:global(.visually-hidden) {
@include bpk-visually-hidden;
}
:global(.hidden),
:global(.hide) {
@include bpk-hidden;
}

:global(.visuallyhidden.focusable),
:global(.visually-hidden.focusable) {
@include bpk-visually-hidden--focusable;
}
:global(.visuallyhidden),
:global(.visually-hidden) {
@include bpk-visually-hidden;
}

:global(.invisible) {
@include bpk-invisible;
}
:global(.visuallyhidden.focusable),
:global(.visually-hidden.focusable) {
@include bpk-visually-hidden--focusable;
}

:global(.invisible) {
@include bpk-invisible;
}

:global(.clearfix) {
@include bpk-clearfix;
:global(.clearfix) {
@include bpk-clearfix;
}
}

/* stylelint-enable */
Loading