Skip to content

Commit

Permalink
feat(Card): add style for nested cards
Browse files Browse the repository at this point in the history
  • Loading branch information
tujoworker committed Nov 7, 2024
1 parent 88443d2 commit a4d884e
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,22 @@ export const Default = () => {
)
}

export const NestedCards = () => {
return (
<ComponentBox data-visual-test="layout-card-nested">
<Card>
<P>First Card</P>
<Card top>
<P>Second Card</P>
<Card top>
<P>Third Card (for edge cases only)</P>
</Card>
</Card>
</Card>
</ComponentBox>
)
}

export const WithTable = () => {
return (
<ComponentBox data-visual-test="layout-card-table">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ import * as Examples from './Examples'

<Examples.Default />

### Nested Cards

<Examples.NestedCards />

### Vertical fields

<Examples.VerticalFields />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ describe.each(['ui', 'sbanken'])('Card for %s', (themeName) => {
})
expect(screenshot).toMatchImageSnapshot()
})

it.only('have to match nested cards', async () => {

Check failure on line 61 in packages/dnb-eufemia/src/components/card/__tests__/Card.screenshot.test.ts

View workflow job for this annotation

GitHub Actions / Run tests and checks

Unexpected focused test

Check failure on line 61 in packages/dnb-eufemia/src/components/card/__tests__/Card.screenshot.test.ts

View workflow job for this annotation

GitHub Actions / Run tests and checks

Unexpected focused test
const screenshot = await makeScreenshot({
selector: '[data-visual-test="layout-card-nested"]',
})
expect(screenshot).toMatchImageSnapshot()
})
})

describe.each(['ui', 'sbanken'])(
Expand All @@ -69,6 +76,7 @@ describe.each(['ui', 'sbanken'])(
},
url: '/uilib/components/card/demos',
}

it('have to match border', async () => {
const screenshot = await makeScreenshot({
...params,
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,9 @@
--card-outline-color: var(--border-color, var(--sb-color-gray-light));
--card-outline-width: 0.0625rem;
--card-background-color: var(--sb-color-white);

// Nested Cards
& .dnb-card {
--rounded-corner: 0.375rem;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,10 @@
--card-outline-color: var(--border-color, var(--color-lavender));
--card-outline-width: 0.25rem;
--card-background-color: var(--color-white);

// Nested Cards
& .dnb-card {
--outline-width: 0.125rem;
--rounded-corner: 0.375rem;
}
}

0 comments on commit a4d884e

Please sign in to comment.