-
Notifications
You must be signed in to change notification settings - Fork 60
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
1 parent
1322166
commit b8a8b9f
Showing
31 changed files
with
920 additions
and
367 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.card__header { | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
} | ||
|
||
.card__header-title { | ||
display: flex; | ||
gap: var(--small-gap); | ||
align-items: center; | ||
} |
29 changes: 29 additions & 0 deletions
29
web-wallet/src/lib/containers/Cards/IconHeadingCard.svelte
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,29 @@ | ||
<script> | ||
import { Card, Icon } from "$lib/dusk/components"; | ||
import "./Card.css"; | ||
/** @type {string | undefined} */ | ||
export let iconPath = undefined; | ||
/** @type {string} */ | ||
export let heading; | ||
/** @type {CardGap} */ | ||
export let gap = "default"; | ||
/** @type {boolean} */ | ||
export let onSurface = false; | ||
</script> | ||
|
||
<Card {...$$restProps} {gap} {onSurface}> | ||
<header slot="header" class="card__header"> | ||
<div class="card__header-title"> | ||
{#if iconPath} | ||
<Icon path={iconPath} /> | ||
{/if} | ||
<h3 class="h4">{heading}</h3> | ||
</div> | ||
</header> | ||
<slot /> | ||
</Card> |
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,35 @@ | ||
<script> | ||
import { Card, Icon, Switch } from "$lib/dusk/components"; | ||
import "./Card.css"; | ||
/** @type {string | undefined} */ | ||
export let iconPath = undefined; | ||
/** @type {string} */ | ||
export let heading; | ||
/** @type {CardGap} */ | ||
export let gap = "default"; | ||
/** @type {boolean} */ | ||
export let onSurface = false; | ||
/** @type {boolean} */ | ||
export let isToggled = false; | ||
</script> | ||
|
||
<Card {...$$restProps} {gap} {onSurface}> | ||
<header slot="header" class="card__header"> | ||
<div class="card__header-title"> | ||
{#if iconPath} | ||
<Icon path={iconPath} /> | ||
{/if} | ||
<h3 class="h4">{heading}</h3> | ||
</div> | ||
<Switch onSurface bind:value={isToggled} /> | ||
</header> | ||
{#if isToggled} | ||
<slot /> | ||
{/if} | ||
</Card> |
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,2 @@ | ||
export { default as IconHeadingCard } from "./IconHeadingCard.svelte"; | ||
export { default as ToggleableCard } from "./ToggleableCard.svelte"; |
28 changes: 28 additions & 0 deletions
28
web-wallet/src/lib/containers/__tests__/IconHeadingCard.spec.js
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,28 @@ | ||
import { afterEach, describe, expect, it } from "vitest"; | ||
import { cleanup, render } from "@testing-library/svelte"; | ||
import { IconHeadingCard } from "../Cards"; | ||
|
||
describe("IconHeadingCard", () => { | ||
afterEach(cleanup); | ||
|
||
it("renders the IconHeadingCard component with a heading", () => { | ||
const { container } = render(IconHeadingCard, { | ||
props: { | ||
heading: "My Card", | ||
}, | ||
}); | ||
|
||
expect(container.firstChild).toMatchSnapshot(); | ||
}); | ||
|
||
it("renders the IconHeadingCard component with a heading and an icon", () => { | ||
const { container } = render(IconHeadingCard, { | ||
props: { | ||
heading: "My Card", | ||
iconPath: "M3,3H21V21H3V3M5,5V19H19V5H5Z", | ||
}, | ||
}); | ||
|
||
expect(container.firstChild).toMatchSnapshot(); | ||
}); | ||
}); |
40 changes: 40 additions & 0 deletions
40
web-wallet/src/lib/containers/__tests__/ToggleableCard.spec.js
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,40 @@ | ||
import { afterEach, describe, expect, it } from "vitest"; | ||
import { cleanup, render } from "@testing-library/svelte"; | ||
import { ToggleableCard } from "../Cards"; | ||
|
||
describe("IconHeadingCard", () => { | ||
afterEach(cleanup); | ||
|
||
it("renders the ToggleableCard component with a heading", () => { | ||
const { container } = render(ToggleableCard, { | ||
props: { | ||
heading: "My Card", | ||
}, | ||
}); | ||
|
||
expect(container.firstChild).toMatchSnapshot(); | ||
}); | ||
|
||
it("renders the ToggleableCard component with a heading and an icon", () => { | ||
const { container } = render(ToggleableCard, { | ||
props: { | ||
heading: "My Card", | ||
iconPath: "M3,3H21V21H3V3M5,5V19H19V5H5Z", | ||
}, | ||
}); | ||
|
||
expect(container.firstChild).toMatchSnapshot(); | ||
}); | ||
|
||
it("renders the ToggleableCard component with a toggle", () => { | ||
const { container } = render(ToggleableCard, { | ||
props: { | ||
heading: "My Card", | ||
iconPath: "M3,3H21V21H3V3M5,5V19H19V5H5Z", | ||
isToggled: true, | ||
}, | ||
}); | ||
|
||
expect(container.firstChild).toMatchSnapshot(); | ||
}); | ||
}); |
Oops, something went wrong.