-
Notifications
You must be signed in to change notification settings - Fork 38
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
feat(card): css changes and data attrs #2398
Merged
Changes from 4 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
8506dbf
feat(card): css changes and data attrs
Barsnes 0bcd207
Create witty-clouds-judge.md
Barsnes 821027a
nest more css
Barsnes 9533618
Merge branch 'next' into css/card
Barsnes 7f2c489
Merge branch 'next' into css/card
eirikbacker 2f0294e
media hover
Barsnes e4ebd5e
:any-link
Barsnes 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 @@ | ||
--- | ||
"@digdir/designsystemet-css": patch | ||
"@digdir/designsystemet-react": patch | ||
--- | ||
|
||
Card: Use data attrs |
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,6 +1,6 @@ | ||
.ds-card { | ||
--dsc-card-border-color: var(--ds-color-neutral-border-subtle); | ||
--dsc-card-backround: var(--ds-color-neutral-surface-default); | ||
--dsc-card-backround: var(--ds-color-neutral-background-default); | ||
--dsc-card-color: var(--ds-color-neutral-text-default); | ||
|
||
display: flex; | ||
|
@@ -13,178 +13,176 @@ | |
border-radius: min(1rem, var(--ds-border-radius-md)); | ||
border: 1px solid var(--dsc-card-border-color); | ||
background: var(--dsc-card-backround); | ||
} | ||
|
||
.ds-card a, | ||
.ds-card a:visited { | ||
color: var(--ds-color-neutral-text-default); | ||
} | ||
|
||
.ds-card > hr { | ||
width: 100%; | ||
margin: var(--ds-spacing-3) 0; | ||
} | ||
|
||
.ds-card__media { | ||
width: auto; | ||
} | ||
|
||
.ds-card__media > * { | ||
display: flex; | ||
flex-direction: column; | ||
width: 100%; | ||
border: 0; | ||
} | ||
|
||
.ds-card > *:not(.ds-card__media, hr) { | ||
padding-left: var(--ds-spacing-6); | ||
padding-right: var(--ds-spacing-6); | ||
} | ||
|
||
.ds-card > *:not(.ds-card__media):first-child { | ||
padding-top: var(--ds-spacing-6); | ||
} | ||
|
||
.ds-card > *:not(.ds-card__media):last-child { | ||
padding-bottom: var(--ds-spacing-6); | ||
} | ||
|
||
.ds-card__media:first-child { | ||
padding-bottom: var(--ds-spacing-4); | ||
} | ||
|
||
.ds-card__media:last-child { | ||
padding-top: var(--ds-spacing-6); | ||
} | ||
|
||
.ds-card--link { | ||
--dsc-card-border-color: var(--ds-color-neutral-border-default); | ||
|
||
text-decoration: none; | ||
} | ||
|
||
.ds-card__footer, | ||
.ds-card__content { | ||
display: flex; | ||
justify-content: flex-start; | ||
gap: var(--ds-spacing-4); | ||
flex-wrap: wrap; | ||
word-wrap: break-word; | ||
padding: var(--ds-spacing-2) 0; | ||
color: inherit; | ||
} | ||
|
||
.ds-card__content { | ||
flex-direction: column; | ||
} | ||
|
||
.ds-card__header { | ||
display: flex; | ||
flex-direction: column; | ||
flex-wrap: wrap; | ||
word-wrap: break-word; | ||
font-family: inherit; | ||
padding: var(--ds-spacing-2) 0; | ||
} | ||
|
||
.ds-card__header h1, | ||
.ds-card__header h2, | ||
.ds-card__header h3, | ||
.ds-card__header h4, | ||
.ds-card__header h5, | ||
.ds-card__header h6 { | ||
color: inherit; | ||
} | ||
|
||
.ds-card--link h1, | ||
.ds-card--link h2, | ||
.ds-card--link h3, | ||
.ds-card--link h4, | ||
.ds-card--link h5, | ||
.ds-card--link h6 { | ||
text-decoration: underline; | ||
text-decoration-thickness: max(1px, 0.0625rem, 0.1025em); | ||
text-underline-offset: max(6px, 0.25rem, 0.22em); | ||
} | ||
|
||
.ds-card--neutral { | ||
--dsc-card-border-color: var(--ds-color-neutral-border-subtle); | ||
--dsc-card-backround: var(--ds-color-neutral-background-default); | ||
} | ||
|
||
.ds-card--neutral.ds-card--link:hover { | ||
--dsc-card-border-color: var(--ds-color-neutral-border-subtle); | ||
--dsc-card-backround: var(--ds-color-neutral-background-subtle); | ||
} | ||
|
||
.ds-card--neutral.ds-card--link:active { | ||
--dsc-card-backround: var(--ds-color-neutral-surface-default); | ||
} | ||
|
||
.ds-card--subtle { | ||
--dsc-card-border-color: var(--ds-color-neutral-border-subtle); | ||
--dsc-card-backround: var(--ds-color-neutral-background-subtle); | ||
} | ||
|
||
.ds-card--subtle.ds-card--link:hover { | ||
--dsc-card-border-color: var(--ds-color-neutral-border-default); | ||
--dsc-card-backround: var(--ds-color-neutral-surface-default); | ||
} | ||
|
||
.ds-card--subtle.ds-card--link:active { | ||
--dsc-card-backround: var(--ds-color-neutral-surface-hover); | ||
} | ||
|
||
.ds-card--brand1 { | ||
--dsc-card-border-color: var(--ds-color-brand1-border-subtle); | ||
--dsc-card-backround: var(--ds-color-brand1-surface-default); | ||
--dsc-card-color: var(--ds-color-brand1-text-default); | ||
} | ||
|
||
.ds-card--brand1.ds-card--link { | ||
--dsc-card-border-color: var(--ds-color-brand1-border-default); | ||
} | ||
|
||
.ds-card--brand1.ds-card--link:hover { | ||
--dsc-card-backround: var(--ds-color-brand1-surface-hover); | ||
} | ||
|
||
.ds-card--brand1.ds-card--link:active { | ||
--dsc-card-backround: var(--ds-color-brand1-surface-active); | ||
} | ||
|
||
.ds-card--brand2 { | ||
--dsc-card-border-color: var(--ds-color-brand2-border-subtle); | ||
--dsc-card-backround: var(--ds-color-brand2-surface-default); | ||
--dsc-card-color: var(--ds-color-brand2-text-default); | ||
} | ||
|
||
.ds-card--brand2.ds-card--link { | ||
--dsc-card-border-color: var(--ds-color-brand2-border-default); | ||
} | ||
|
||
.ds-card--brand2.ds-card--link:hover { | ||
--dsc-card-backround: var(--ds-color-brand2-surface-hover); | ||
} | ||
|
||
.ds-card--brand2.ds-card--link:active { | ||
--dsc-card-backround: var(--ds-color-brand2-surface-active); | ||
} | ||
|
||
.ds-card--brand3 { | ||
--dsc-card-border-color: var(--ds-color-brand3-border-subtle); | ||
--dsc-card-backround: var(--ds-color-brand3-surface-default); | ||
--dsc-card-color: var(--ds-color-brand3-text-default); | ||
} | ||
|
||
.ds-card--brand3.ds-card--link { | ||
--dsc-card-border-color: var(--ds-color-brand3-border-default); | ||
} | ||
|
||
.ds-card--brand3.ds-card--link:hover { | ||
--dsc-card-backround: var(--ds-color-brand3-surface-hover); | ||
} | ||
|
||
.ds-card--brand3.ds-card--link:active { | ||
--dsc-card-backround: var(--ds-color-brand3-surface-active); | ||
&[data-link] { | ||
--dsc-card-border-color: var(--ds-color-neutral-border-default); | ||
|
||
text-decoration: none; | ||
|
||
& h1, | ||
& h2, | ||
& h3, | ||
& h4, | ||
& h5, | ||
& h6 { | ||
color: var(--dsc-card-color); | ||
text-decoration: underline; | ||
text-decoration-thickness: max(1px, 0.0625rem, 0.1025em); | ||
text-underline-offset: max(6px, 0.25rem, 0.22em); | ||
} | ||
|
||
&:hover { | ||
--dsc-card-backround: var(--ds-color-neutral-background-subtle); | ||
} | ||
|
||
&:active { | ||
--dsc-card-backround: var(--ds-color-neutral-surface-default); | ||
} | ||
} | ||
|
||
&[data-color='subtle'] { | ||
--dsc-card-border-color: var(--ds-color-neutral-border-subtle); | ||
--dsc-card-backround: var(--ds-color-neutral-background-subtle); | ||
|
||
&[data-link] { | ||
--dsc-card-border-color: var(--ds-color-neutral-border-default); | ||
|
||
&:hover { | ||
--dsc-card-backround: var(--ds-color-neutral-surface-default); | ||
} | ||
|
||
&:active { | ||
--dsc-card-backround: var(--ds-color-neutral-surface-hover); | ||
} | ||
} | ||
} | ||
|
||
&[data-color='brand1'] { | ||
--dsc-card-border-color: var(--ds-color-brand1-border-subtle); | ||
--dsc-card-backround: var(--ds-color-brand1-surface-default); | ||
--dsc-card-color: var(--ds-color-brand1-text-default); | ||
|
||
&[data-link] { | ||
--dsc-card-border-color: var(--ds-color-brand1-border-default); | ||
|
||
&:hover { | ||
--dsc-card-backround: var(--ds-color-brand1-surface-hover); | ||
} | ||
|
||
&:active { | ||
--dsc-card-backround: var(--ds-color-brand1-surface-active); | ||
} | ||
} | ||
} | ||
|
||
&[data-color='brand2'] { | ||
--dsc-card-border-color: var(--ds-color-brand2-border-subtle); | ||
--dsc-card-backround: var(--ds-color-brand2-surface-default); | ||
--dsc-card-color: var(--ds-color-brand2-text-default); | ||
|
||
&[data-link] { | ||
--dsc-card-border-color: var(--ds-color-brand2-border-default); | ||
|
||
&:hover { | ||
Barsnes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
--dsc-card-backround: var(--ds-color-brand2-surface-hover); | ||
} | ||
|
||
&:active { | ||
--dsc-card-backround: var(--ds-color-brand2-surface-active); | ||
} | ||
} | ||
} | ||
|
||
&[data-color='brand3'] { | ||
--dsc-card-border-color: var(--ds-color-brand3-border-subtle); | ||
--dsc-card-backround: var(--ds-color-brand3-surface-default); | ||
--dsc-card-color: var(--ds-color-brand3-text-default); | ||
|
||
&[data-link] { | ||
--dsc-card-border-color: var(--ds-color-brand3-border-default); | ||
|
||
&:hover { | ||
--dsc-card-backround: var(--ds-color-brand3-surface-hover); | ||
} | ||
|
||
&:active { | ||
--dsc-card-backround: var(--ds-color-brand3-surface-active); | ||
} | ||
} | ||
} | ||
|
||
.ds-card__header h1, | ||
.ds-card__header h2, | ||
.ds-card__header h3, | ||
.ds-card__header h4, | ||
.ds-card__header h5, | ||
.ds-card__header h6 { | ||
color: inherit; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Kanskje noen jeg ikke har fått med meg - hvorfor trenger vi å sette There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sjå kommentar under for svar. #2398 (comment) |
||
} | ||
|
||
.ds-card__media > * { | ||
display: flex; | ||
flex-direction: column; | ||
width: 100%; | ||
border: 0; | ||
} | ||
|
||
.ds-card__media { | ||
width: auto; | ||
} | ||
|
||
.ds-card__media:first-child { | ||
padding-bottom: var(--ds-spacing-4); | ||
} | ||
|
||
.ds-card__media:last-child { | ||
padding-top: var(--ds-spacing-6); | ||
} | ||
|
||
.ds-card__footer, | ||
.ds-card__content { | ||
display: flex; | ||
justify-content: flex-start; | ||
gap: var(--ds-spacing-4); | ||
flex-wrap: wrap; | ||
word-wrap: break-word; | ||
padding: var(--ds-spacing-2) 0; | ||
color: inherit; | ||
} | ||
|
||
.ds-card__content { | ||
flex-direction: column; | ||
} | ||
|
||
.ds-card__header { | ||
display: flex; | ||
flex-direction: column; | ||
flex-wrap: wrap; | ||
word-wrap: break-word; | ||
font-family: inherit; | ||
padding: var(--ds-spacing-2) 0; | ||
} | ||
|
||
& a, | ||
& a:visited { | ||
Barsnes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
color: var(--ds-color-neutral-text-default); | ||
} | ||
|
||
& > hr { | ||
width: 100%; | ||
margin: var(--ds-spacing-3) 0; | ||
} | ||
|
||
& > *:not(.ds-card__media, hr) { | ||
padding-left: var(--ds-spacing-6); | ||
padding-right: var(--ds-spacing-6); | ||
} | ||
|
||
& > *:not(.ds-card__media):first-child { | ||
padding-top: var(--ds-spacing-6); | ||
} | ||
|
||
& > *:not(.ds-card__media):last-child { | ||
padding-bottom: var(--ds-spacing-6); | ||
} | ||
} |
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.
Skulle vi heller gjort
& :is(h1,h2,h3,h4,h5,h6)
? 😊og hvorfor setter vi
color
på heading - arver ikke den farge? 😇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.
Me setter farge slik at den blir konsekvent rett i forhold til fargen kortet har. Jo den arver farge, men vår
Heading
komponent setter også farge til--ds-color-neutral-text-default
, som då blir satt om me ikkje setter farge her.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.
Ah, hvorfor setter Heading farge? Kan det være litt vanskelig å sette en heading på en flate også arver den ikke currentcolor? Burde vi snakke med design om dette? :)
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.
Gjerne ta det med design, føler ikkje det er eit valg me i kode skal ta.
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.
Tenker det har litt med kode å gjøre fordi det setter føringer for å kunne gjenbrukbare komponenter inni flater - jeg poster en diskusjon om dette her: https://designsystemet.slack.com/archives/C05U1MNKYCX/p1726480465469179
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.
Okei. Avventer endringa til me får svar der.
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.
Tenker vi kan endre på det senere - kanskje bare merge denne nå først så lager jeg eget issue med color: inherit på typografi-komponenter☺️