-
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
36e1946
commit 7902c55
Showing
27 changed files
with
720 additions
and
399 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
11 changes: 11 additions & 0 deletions
11
web-wallet/src/lib/containers/IconHeaderToggleCard/IconHeaderToggleCard.css
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; | ||
} |
37 changes: 37 additions & 0 deletions
37
web-wallet/src/lib/containers/IconHeaderToggleCard/IconHeaderToggleCard.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,37 @@ | ||
<script> | ||
import { Card, Icon, Switch } from "$lib/dusk/components"; | ||
import "./IconHeaderToggleCard.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 | undefined} */ | ||
export let isToggled = undefined; | ||
</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> | ||
{#if isToggled !== undefined} | ||
<Switch onSurface bind:value={isToggled} /> | ||
{/if} | ||
</header> | ||
{#if isToggled || isToggled === undefined} | ||
<slot /> | ||
{/if} | ||
</Card> |
40 changes: 40 additions & 0 deletions
40
web-wallet/src/lib/containers/__tests__/IconHeaderToggleCard.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 { IconHeaderToggleCard } from ".."; | ||
|
||
describe("IconHeaderToggleCard", () => { | ||
afterEach(cleanup); | ||
|
||
it("renders the IconHeaderToggleCard component with a heading", () => { | ||
const { container } = render(IconHeaderToggleCard, { | ||
props: { | ||
heading: "My Card", | ||
}, | ||
}); | ||
|
||
expect(container.firstChild).toMatchSnapshot(); | ||
}); | ||
|
||
it("renders the IconHeaderToggleCard component with a heading and an icon", () => { | ||
const { container } = render(IconHeaderToggleCard, { | ||
props: { | ||
heading: "My Card", | ||
iconPath: "M3,3H21V21H3V3M5,5V19H19V5H5Z", | ||
}, | ||
}); | ||
|
||
expect(container.firstChild).toMatchSnapshot(); | ||
}); | ||
|
||
it("renders the IconHeaderToggleCard component with a toggle", () => { | ||
const { container } = render(IconHeaderToggleCard, { | ||
props: { | ||
heading: "My Card", | ||
iconPath: "M3,3H21V21H3V3M5,5V19H19V5H5Z", | ||
isToggled: true, | ||
}, | ||
}); | ||
|
||
expect(container.firstChild).toMatchSnapshot(); | ||
}); | ||
}); |
124 changes: 124 additions & 0 deletions
124
web-wallet/src/lib/containers/__tests__/__snapshots__/IconHeaderToggleCard.spec.js.snap
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,124 @@ | ||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html | ||
|
||
exports[`IconHeaderToggleCard > renders the IconHeaderToggleCard component with a heading 1`] = ` | ||
<div> | ||
<div | ||
class="dusk-card dusk-card--gap-default" | ||
> | ||
<header | ||
class="card__header" | ||
slot="header" | ||
> | ||
<div | ||
class="card__header-title" | ||
> | ||
<h3 | ||
class="h4" | ||
> | ||
My Card | ||
</h3> | ||
</div> | ||
</header> | ||
</div> | ||
<!--<Card>--> | ||
<!--<IconHeaderToggleCard>--> | ||
</div> | ||
`; | ||
|
||
exports[`IconHeaderToggleCard > renders the IconHeaderToggleCard component with a heading and an icon 1`] = ` | ||
<div> | ||
<div | ||
class="dusk-card dusk-card--gap-default" | ||
> | ||
<header | ||
class="card__header" | ||
slot="header" | ||
> | ||
<div | ||
class="card__header-title" | ||
> | ||
<svg | ||
class="dusk-icon dusk-icon--size--normal" | ||
role="graphics-symbol" | ||
viewBox="0 0 24 24" | ||
> | ||
<path | ||
d="M3,3H21V21H3V3M5,5V19H19V5H5Z" | ||
/> | ||
</svg> | ||
<!--<Icon>--> | ||
<h3 | ||
class="h4" | ||
> | ||
My Card | ||
</h3> | ||
</div> | ||
</header> | ||
</div> | ||
<!--<Card>--> | ||
<!--<IconHeaderToggleCard>--> | ||
</div> | ||
`; | ||
|
||
exports[`IconHeaderToggleCard > renders the IconHeaderToggleCard component with a toggle 1`] = ` | ||
<div> | ||
<div | ||
class="dusk-card dusk-card--gap-default" | ||
> | ||
<header | ||
class="card__header" | ||
slot="header" | ||
> | ||
<div | ||
class="card__header-title" | ||
> | ||
<svg | ||
class="dusk-icon dusk-icon--size--normal" | ||
role="graphics-symbol" | ||
viewBox="0 0 24 24" | ||
> | ||
<path | ||
d="M3,3H21V21H3V3M5,5V19H19V5H5Z" | ||
/> | ||
</svg> | ||
<!--<Icon>--> | ||
<h3 | ||
class="h4" | ||
> | ||
My Card | ||
</h3> | ||
</div> | ||
<div | ||
aria-checked="true" | ||
aria-disabled="false" | ||
class="dusk-switch dusk-switch--on-surface" | ||
role="switch" | ||
tabindex="0" | ||
/> | ||
<!--<Switch>--> | ||
</header> | ||
</div> | ||
<!--<Card>--> | ||
<!--<IconHeaderToggleCard>--> | ||
</div> | ||
`; |
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,2 +1,3 @@ | ||
export { default as StakeContract } from "./StakeContract/StakeContract.svelte"; | ||
export { default as TransferContract } from "./TransferContract/TransferContract.svelte"; | ||
export { default as IconHeaderToggleCard } from "./IconHeaderToggleCard/IconHeaderToggleCard.svelte"; |
Oops, something went wrong.