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

fix(ffe-header): remove button dependencies #2317

Merged
merged 1 commit into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
133 changes: 44 additions & 89 deletions packages/ffe-header/less/ffe-header.less
Original file line number Diff line number Diff line change
Expand Up @@ -148,31 +148,32 @@
border: none;
}

&__logout-button,
&__icon-button {
.ffe-inline-button();

color: var(--ffe-v-primary-color);

&:active:extend(.ffe-inline-button:active) {
}

&:focus:extend(.ffe-inline-button:focus) {
}

/* stylelint-disable declaration-block-no-duplicate-properties */
&:extend(.ffe-inline-button--tertiary);
border: none;
margin: 0;
padding: 0;
width: auto;
overflow: visible;
background: transparent;
color: inherit;
font: inherit;
line-height: normal;
text-align: inherit;
cursor: pointer;
border-radius: 6em;

@media (hover: hover) and (pointer: fine) {
&:hover:extend(.ffe-inline-button--tertiary:hover) {
}
&:active {
transform: scale(0.97);
}
}

/* stylelint-enable declaration-block-no-duplicate-properties */

&::after {
&:extend(.ffe-inline-button--tertiary::after);
&__icon-button {
color: var(--ffe-v-header-icon-button-color);

border: none;
&:focus-visible {
outline: 2px solid var(--ffe-v-header-icon-button-color);
outline-offset: 2px;
}

&--user-nav {
Expand All @@ -188,82 +189,35 @@
}

&__logout-button {
&:extend(.ffe-button);
&:extend(.ffe-button--secondary);

margin: var(--ffe-spacing-xs) 0;
border-radius: 20px;
padding: var(--ffe-spacing-xs) var(--ffe-spacing-sm);

&::after:extend(.ffe-button::after) {
}

&:focus::after:extend(.ffe-button:focus::after) {
}

&:focus:not(:focus-visible)::after:extend(
.ffe-button:focus:not(:focus-visible)::after
) {
}

&:focus:extend(.ffe-button:focus) {
}

&:focus:extend(.ffe-button--secondary:focus) {
--color: var(--ffe-v-header-logout-color);
--color-hover: var(--ffe-v-header-logout-color-hover);
--background-color: var(--ffe-v-header-logout-background-color);
--background-color-hover: var(
--ffe-v-header-logout-background-color-hover
);
--border-color: var(--ffe-v-header-logout-border-color);
--border-color-hover: var(--ffe-v-header-logout-border-color-hover);

color: var(--color);
background: var(--background-color);
border: 2px solid var(--border-color);
line-height: 1.2;
padding: calc(var(--ffe-spacing-xs) + 2px) var(--ffe-spacing-md); // The + 2px is ensure button is 44px after we made a change to line-height.

&:focus-visible {
outline: 2px solid var(--border-color);
outline-offset: 2px;
}

@media (hover: hover) and (pointer: fine) {
&:hover:extend(.ffe-button--secondary:hover) {
}
}

&:active:extend(.ffe-button:active) {
}

&:active:extend(.ffe-button--secondary:active) {
}

&--loading {
&:extend(.ffe-button--loading);
}

&--loading &-label {
&:extend(.ffe-button--loading .ffe-button__label);
}

&--loading &-spinner {
&:extend(.ffe-button--loading .ffe-button__spinner);
}
}

&__logout-button-spinner {
&:extend(.ffe-button__spinner);

padding: 4px 16px;

&::after {
&:extend(.ffe-button__spinner::after);

animation-name: logout-button-loading-spin;
}

@keyframes logout-button-loading-spin {
from {
transform: none;
}

to {
transform: rotate(360deg);
&:hover {
--background-color: var(--background-color-hover);
--border-color: var(--border-color-hover);
--color: var(--color-hover);
}
}
}

&__logout-button-label {
&:extend(.ffe-button__label);

color: var(--ffe-v-logout-button-label-color-text);
}

&__user-icon,
&__user-chevron-icon,
&__site-nav-icon {
Expand All @@ -280,6 +234,7 @@
margin-left: var(--ffe-spacing-xs);
transition: transform var(--ffe-transition-duration)
var(--ffe-ease-in-out-back);
color: var(--ffe-v-header-icon-button-color);
}

&__user-chevron--expanded &__user-chevron-icon {
Expand Down
18 changes: 16 additions & 2 deletions packages/ffe-header/less/theme.less
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@
--ffe-v-usernav-link-hover-background-color: var(--ffe-farge-frost-30);
--ffe-v-usernav-link-focus-background-color: var(--ffe-farge-frost-30);
--ffe-v-usernav-list-border-color: var(--ffe-farge-vann);
--ffe-v-logout-button-label-color-text: var(--ffe-farge-vann);
--ffe-v-header-icon-button-color: var(--ffe-farge-vann);
--ffe-v-header-logout-color: var(--ffe-farge-vann);
--ffe-v-header-logout-color-hover: var(--ffe-farge-hvit);
--ffe-v-header-logout-border-color: var(--ffe-farge-vann);
--ffe-v-header-logout-border-color-hover: var(--ffe-farge-vann);
--ffe-v-header-logout-background-color: var(--ffe-farge-hvit);
--ffe-v-header-logout-background-color-hover: var(--ffe-farge-vann);

@media (prefers-color-scheme: dark) {
.regard-color-scheme-preference {
Expand All @@ -38,7 +44,15 @@
--ffe-v-usernav-header-link-hover-focus-color: var(
--ffe-farge-svart
);
--ffe-v-logout-button-label-color-text: var(--ffe-farge-vann-30);
--ffe-v-header-icon-button-color: var(--ffe-farge-vann-30);
--ffe-v-header-logout-color: var(--ffe-farge-vann-30);
--ffe-v-header-logout-color-hover: var(--ffe-farge-svart);
--ffe-v-header-logout-border-color: var(--ffe-farge-vann-70);
--ffe-v-header-logout-border-color-hover: var(--ffe-farge-vann-30);
--ffe-v-header-logout-background-color: var(--ffe-farge-svart);
--ffe-v-header-logout-background-color-hover: var(
--ffe-farge-vann-30
);
}
}
}
1 change: 0 additions & 1 deletion packages/ffe-header/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
},
"devDependencies": {
"@sb1/ffe-buildtool": "^0.9.0",
"@sb1/ffe-buttons": "^19.0.8",
"@sb1/ffe-core": "^29.1.3",
"@sb1/ffe-webfonts": "^5.0.13",
"less": "^4.1.2",
Expand Down
Loading