-
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 5e787b2
Showing
27 changed files
with
651 additions
and
488 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; | ||
} |
35 changes: 35 additions & 0 deletions
35
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,35 @@ | ||
<script> | ||
import { Card, Icon, Switch } from "$lib/dusk/components"; | ||
import "./IconHeaderToggleCard.css"; | ||
/** @type {string} */ | ||
export let iconPath; | ||
/** @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}> | ||
<div slot="header" class="card__header"> | ||
<div class="card__header-title"> | ||
<Icon path={iconPath} /> | ||
<h3 class="h4">{heading}</h3> | ||
</div> | ||
{#if isToggled !== undefined} | ||
<Switch onSurface bind:value={isToggled} /> | ||
{/if} | ||
</div> | ||
{#if isToggled || isToggled === undefined} | ||
<slot /> | ||
{/if} | ||
</Card> |
28 changes: 28 additions & 0 deletions
28
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,28 @@ | ||
import { afterEach, describe, expect, it } from "vitest"; | ||
import { cleanup, render } from "@testing-library/svelte"; | ||
import { IconHeaderToggleCard } from ".."; | ||
|
||
describe("IconHeaderToggleCard", () => { | ||
afterEach(cleanup); | ||
|
||
const props = { | ||
heading: "My Card", | ||
iconPath: "M3,3H21V21H3V3M5,5V19H19V5H5Z", | ||
}; | ||
|
||
it("renders the IconHeaderToggleCard component", () => { | ||
const { container } = render(IconHeaderToggleCard, { | ||
props, | ||
}); | ||
|
||
expect(container.firstChild).toMatchSnapshot(); | ||
}); | ||
|
||
it("renders the IconHeaderToggleCard component with a toggle", () => { | ||
const { container } = render(IconHeaderToggleCard, { | ||
props: { ...props, isToggled: true }, | ||
}); | ||
|
||
expect(container.firstChild).toMatchSnapshot(); | ||
}); | ||
}); |
93 changes: 93 additions & 0 deletions
93
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,93 @@ | ||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html | ||
|
||
exports[`IconHeaderToggleCard > renders the IconHeaderToggleCard component 1`] = ` | ||
<div> | ||
<div | ||
class="dusk-card dusk-card--gap-default" | ||
> | ||
<div | ||
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> | ||
</div> | ||
<!--<Card>--> | ||
<!--<IconHeaderToggleCard>--> | ||
</div> | ||
`; | ||
|
||
exports[`IconHeaderToggleCard > renders the IconHeaderToggleCard component with a toggle 1`] = ` | ||
<div> | ||
<div | ||
class="dusk-card dusk-card--gap-default" | ||
> | ||
<div | ||
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>--> | ||
</div> | ||
</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"; |
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.