-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
160 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@navikt/ds-react": minor | ||
"@navikt/ds-css": minor | ||
--- | ||
|
||
ReadMore: Added size 'large'. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,91 +1,102 @@ | ||
.navds-read-more { | ||
--__axc-read-more-icon-size: 1.5rem; | ||
--__axc-read-more-pi-start: 0px; | ||
--__axc-read-more-pi-end: var(--ax-spacing-1); | ||
--__axc-read-more-pb: var(--ax-spacing-1); | ||
} | ||
|
||
/* ----------------------------- ReadMore Button ---------------------------- */ | ||
.navds-read-more__button { | ||
cursor: pointer; | ||
margin: 0; | ||
border: none; | ||
background: none; | ||
display: flex; | ||
align-items: flex-start; | ||
gap: var(--a-spacing-05); | ||
color: var(--ac-read-more-text, var(--a-text-action)); | ||
border-radius: var(--a-border-radius-small); | ||
padding: var(--a-spacing-1) var(--a-spacing-2) var(--a-spacing-1) var(--a-spacing-05); | ||
gap: var(--ax-spacing-1); | ||
color: var(--ax-text-accent); | ||
padding-inline: var(--__axc-read-more-pi-start) var(--__axc-read-more-pi-end); | ||
padding-block: var(--__axc-read-more-pb); | ||
text-align: start; | ||
} | ||
|
||
.navds-read-more--small .navds-read-more__button { | ||
padding: var(--a-spacing-05) var(--a-spacing-1-alt) var(--a-spacing-05) var(--a-spacing-05); | ||
} | ||
|
||
@media (forced-colors: active) { | ||
.navds-read-more__button { | ||
background-color: ButtonFace; | ||
border: solid 1px ButtonText; | ||
color: ButtonText; | ||
&:focus-visible { | ||
outline: 2px solid var(--ax-border-focus); | ||
outline-offset: 2px; | ||
} | ||
|
||
.navds-read-more__button.navds-read-more__button:focus-visible { | ||
box-shadow: none; | ||
outline: 2px solid highlight; | ||
outline-offset: 2px; | ||
&[data-state="open"] .navds-read-more__expand-icon { | ||
transform: rotateX(-180deg); | ||
} | ||
} | ||
|
||
.navds-read-more__button:hover { | ||
background-color: var(--ac-read-more-hover-bg, var(--a-surface-hover)); | ||
color: var(--ac-read-more-hover-text, var(--a-text-action-hover)); | ||
} | ||
.navds-read-more:is([data-volume="low"], :not([data-volume])) { | ||
& .navds-read-more__button { | ||
border-radius: var(--ax-border-radius-medium); | ||
|
||
.navds-read-more__button:active { | ||
background-color: var(--ac-read-more-active-bg, var(--a-surface-active)); | ||
&:hover { | ||
background-color: var(--ax-bg-neutral-hoverA); | ||
color: var(--ax-text-accent-strong); | ||
} | ||
} | ||
} | ||
|
||
.navds-read-more__button:focus-visible { | ||
outline: none; | ||
box-shadow: var(--a-shadow-focus); | ||
} | ||
.navds-read-more[data-volume="high"] { | ||
& .navds-read-more__button { | ||
background-color: var(--ax-bg-accent-moderate); | ||
border-radius: var(--ax-border-radius-full); | ||
|
||
@supports not selector(:focus-visible) { | ||
.navds-read-more__button:focus { | ||
outline: none; | ||
box-shadow: var(--a-shadow-focus); | ||
&:hover { | ||
background-color: var(--ax-bg-accent-moderate-hoverA); | ||
color: var(--ax-text-accent-strong); | ||
} | ||
} | ||
} | ||
|
||
.navds-read-more__content { | ||
margin-top: var(--a-spacing-1); | ||
border-left: 2px solid var(--ac-read-more-line, var(--a-border-divider)); | ||
margin-left: 0.8125rem; | ||
padding-left: 0.8125rem; | ||
color: var(--a-text-default); | ||
} | ||
&.navds-read-more--large { | ||
--__axc-read-more-pi-start: var(--ax-spacing-3); | ||
--__axc-read-more-pi-end: var(--ax-spacing-6); | ||
} | ||
|
||
.navds-read-more--small .navds-read-more__content { | ||
margin-left: 0.6875rem; | ||
padding-left: 0.6875rem; | ||
&.navds-read-more--small, | ||
&.navds-read-more--medium { | ||
--__axc-read-more-pi-start: var(--ax-spacing-2); | ||
--__axc-read-more-pi-end: var(--ax-spacing-4); | ||
} | ||
} | ||
|
||
.navds-read-more__content--closed { | ||
display: none; | ||
/* ---------------------------- ReadMore Content ---------------------------- */ | ||
.navds-read-more__content { | ||
margin-top: var(--ax-spacing-2); | ||
border-left: 2px solid var(--ax-border-neutral-subtleA); | ||
color: var(--ax-text-default); | ||
margin-left: calc(var(--__axc-read-more-pi-start) + var(--__axc-read-more-icon-size) / 2 - 1px); | ||
padding-left: calc(var(--__axc-read-more-icon-size) / 2 - 1px + var(--ax-spacing-1)); | ||
|
||
&[data-state="closed"] { | ||
display: none; | ||
} | ||
} | ||
|
||
.navds-read-more__expand-icon { | ||
font-size: 1.5rem; | ||
font-size: var(--__axc-read-more-icon-size); | ||
flex-shrink: 0; | ||
transition: transform 100ms cubic-bezier(0.2, 0, 0, 1); | ||
} | ||
|
||
.navds-read-more--small .navds-read-more__expand-icon { | ||
font-size: 1.25rem; | ||
/* ----------------------------- ReadMore Sizes ----------------------------- */ | ||
.navds-read-more--large { | ||
--__axc-read-more-pb: var(--ax-spacing-3); | ||
} | ||
|
||
.navds-read-more__button:hover > .navds-read-more__expand-icon { | ||
position: relative; | ||
top: 1px; | ||
.navds-read-more--small { | ||
--__axc-read-more-icon-size: 1.25rem; | ||
--__axc-read-more-pb: var(--ax-spacing-05); | ||
} | ||
|
||
.navds-read-more--open > .navds-read-more__button > .navds-read-more__expand-icon { | ||
transform: rotate(-180deg); | ||
} | ||
|
||
.navds-read-more--open > .navds-read-more__button:hover > .navds-read-more__expand-icon { | ||
top: -1px; | ||
/* ------------------------- ReadMore high-contrast ------------------------- */ | ||
@media (forced-colors: active) { | ||
.navds-read-more__button { | ||
background-color: ButtonFace; | ||
border: solid 1px ButtonText; | ||
color: ButtonText; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters