-
Notifications
You must be signed in to change notification settings - Fork 42
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
[Darkside] ReadMore CSS update #3372
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
4ae2d93
:sparkles: Added brandvolume support in theme-component
KenAJoh 890f44c
:memo: Added brandvolume story to readmore
KenAJoh 25d3732
:sparkles: Added large size to readmore
KenAJoh 5bb555b
:sparkles: Added darkmode support for Readmore
KenAJoh 9f06d7e
:refactor: Updated CSS syntax
KenAJoh 253aa37
:bug: Fixed brandvolume stories
KenAJoh bf800da
:sparkles: Implemented brandvolume in ReadMore
KenAJoh b35647e
:sparkles: Added large-variant of readmore to OG readmore
KenAJoh 3591774
:refactor: Use tokens and calc to handle volume
KenAJoh 9a78e34
:bug: Added text-accent-strong on hover to high brandvolume
KenAJoh f3bd043
:bug: Avoid adjusting readmore body when size is large
KenAJoh 22a9ed8
Merge branch 'main' into darkside-readmore-css
KenAJoh eaa326f
:memo: CHangeset
KenAJoh 0ddb32d
Update @navikt/core/react/src/provider/theme/AkselTheme.tsx
KenAJoh 70b58a8
Update @navikt/core/react/src/provider/theme/AkselTheme.tsx
KenAJoh ac00991
Merge branch 'main' into darkside-readmore-css
KenAJoh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the current implementation no, but it's nice to see the current state in the DOM when testing.