-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Puria Nafisi Azizi <[email protected]>
- Loading branch information
1 parent
200983b
commit 8887bc2
Showing
10 changed files
with
216 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
:host { | ||
display: block; | ||
} |
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,41 @@ | ||
import { Component, Host, Prop, h } from '@stencil/core'; | ||
|
||
@Component({ | ||
tag: 'd-empty-state', | ||
styleUrl: 'd-empty-state.css', | ||
shadow: true, | ||
}) | ||
export class DEmptyState { | ||
@Prop() heading: string; | ||
@Prop() text: string; | ||
@Prop() buttonText: string | undefined = undefined; | ||
@Prop() href: string | undefined = undefined; | ||
|
||
render() { | ||
return ( | ||
<Host> | ||
<div class="flex flex-col items-center justify-center gap-4"> | ||
<div> | ||
<slot /> | ||
</div> | ||
<div class="flex flex-col gap-1"> | ||
<d-heading size="s">{this.heading}</d-heading> | ||
<d-text size="l" class=""> | ||
{this.text} | ||
</d-text> | ||
</div> | ||
{this.buttonText && ( | ||
<d-button expand color="outline" href={this.href} class="w-full"> | ||
{this.buttonText}{' '} | ||
<div slot="end"> | ||
<svg xmlns="http://www.w3.org/2000/svg" class="w-6 h-6" viewBox="0 0 512 512" stroke="currentColor"> | ||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="48" d="M268 112l144 144-144 144M392 256H100" class="w-6 h-6" fill="none"></path> | ||
</svg> | ||
</div> | ||
</d-button> | ||
)} | ||
</div> | ||
</Host> | ||
); | ||
} | ||
} |
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,69 @@ | ||
import { DEmptyState } from './d-empty-state'; | ||
import { Meta, StoryObj } from '@storybook/html'; | ||
|
||
const meta = { | ||
title: 'Design System/Molecules/EmptyState', | ||
render: args => | ||
`<d-empty-state | ||
heading="${args.heading}" | ||
text="${args.text}" | ||
button-text="${args.buttonText}" | ||
> | ||
<svg | ||
width="255" | ||
height="152" | ||
viewBox="0 0 255 152" | ||
fill="none" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<path | ||
d="M114.035 5.30018L8.58937 75.0889C4.30582 77.9239 3.13259 83.6931 5.96888 87.9748L43.2436 144.245C46.0799 148.526 51.8517 149.699 56.1352 146.864L161.581 77.0754C165.864 74.2403 167.037 68.4711 164.201 64.1894L126.926 7.91952C124.09 3.63785 118.318 2.46513 114.035 5.30018Z" | ||
fill="var(--surface)" | ||
/> | ||
<path | ||
d="M114.035 5.30018L8.58937 75.0889C4.30582 77.9239 3.13259 83.6931 5.96888 87.9748L43.2436 144.245C46.0799 148.526 51.8517 149.699 56.1352 146.864L161.581 77.0754C165.864 74.2403 167.037 68.4711 164.201 64.1894L126.926 7.91952C124.09 3.63785 118.318 2.46513 114.035 5.30018Z" | ||
stroke="var(--on-alt)" | ||
stroke-width="1.5" | ||
stroke-miterlimit="10" | ||
stroke-dasharray="5 5" | ||
/> | ||
<path | ||
d="M101.61 41.9879L92.0199 113.296C91.3355 118.385 94.9083 123.065 100 123.748L232.805 141.563C237.897 142.246 242.58 138.674 243.264 133.585L252.854 62.2765C253.539 57.1871 249.966 52.5076 244.874 51.8246L112.069 34.0094C106.977 33.3264 102.295 36.8985 101.61 41.9879Z" | ||
fill="var(--primary)" | ||
/> | ||
<path | ||
d="M101.61 41.9879L92.0199 113.296C91.3355 118.385 94.9083 123.065 100 123.748L232.805 141.563C237.897 142.246 242.58 138.674 243.264 133.585L252.854 62.2765C253.539 57.1871 249.966 52.5076 244.874 51.8246L112.069 34.0094C106.977 33.3264 102.295 36.8985 101.61 41.9879Z" | ||
stroke="var(--on-alt)" | ||
stroke-width="1.5" | ||
stroke-miterlimit="10" | ||
stroke-dasharray="5 5" | ||
/> | ||
<path | ||
d="M189.204 89.3054L175.495 87.4644L177.337 73.7736L176.579 73.6687L174.738 87.3595L161.041 85.5185L160.936 86.2875L174.644 88.1169L172.802 101.819L173.56 101.913L175.402 88.2217L189.099 90.0627L189.204 89.3054Z" | ||
fill="var(--on-alt)" | ||
stroke="var(--on-alt)" | ||
stroke-width="1.5" | ||
stroke-miterlimit="10" | ||
/> | ||
</svg> | ||
</d-empty-state> | ||
`, | ||
} satisfies Meta<DEmptyState>; | ||
|
||
export default meta; | ||
type Story = StoryObj<DEmptyState>; | ||
|
||
export const Default: Story = { | ||
args: { | ||
heading: 'Nothing in your wallet', | ||
text: 'Start getting your first credential', | ||
buttonText: 'Go to Home', | ||
href: '#', | ||
}, | ||
parameters: { | ||
design: { | ||
type: 'figma', | ||
url: 'https://www.figma.com/file/Uxc5APvp9BsY9r71rF8HhQ/DIDWallet-UI-Trial?node-id=100%3A1839&mode=dev', | ||
}, | ||
}, | ||
}; |
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 @@ | ||
# d-empty-state | ||
|
||
|
||
|
||
<!-- Auto Generated Below --> | ||
|
||
|
||
## Properties | ||
|
||
| Property | Attribute | Description | Type | Default | | ||
| ------------ | ------------- | ----------- | -------- | ----------- | | ||
| `buttonText` | `button-text` | | `string` | `undefined` | | ||
| `heading` | `heading` | | `string` | `undefined` | | ||
| `href` | `href` | | `string` | `undefined` | | ||
| `text` | `text` | | `string` | `undefined` | | ||
|
||
|
||
## Dependencies | ||
|
||
### Depends on | ||
|
||
- [d-heading](../heading) | ||
- [d-text](../text) | ||
- [d-button](../button) | ||
|
||
### Graph | ||
```mermaid | ||
graph TD; | ||
d-empty-state --> d-heading | ||
d-empty-state --> d-text | ||
d-empty-state --> d-button | ||
style d-empty-state fill:#f9f,stroke:#333,stroke-width:4px | ||
``` | ||
|
||
---------------------------------------------- | ||
|
||
*Built with [StencilJS](https://stenciljs.com/)* |
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 @@ | ||
import { newE2EPage } from '@stencil/core/testing'; | ||
|
||
describe('d-empty-state', () => { | ||
it('renders', async () => { | ||
const page = await newE2EPage(); | ||
await page.setContent('<d-empty-state></d-empty-state>'); | ||
|
||
const element = await page.find('d-empty-state'); | ||
expect(element).toHaveClass('hydrated'); | ||
}); | ||
}); |
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,26 @@ | ||
import { newSpecPage } from '@stencil/core/testing'; | ||
import { DEmptyState } from '../d-empty-state'; | ||
|
||
describe('d-empty-state', () => { | ||
it('renders', async () => { | ||
const page = await newSpecPage({ | ||
components: [DEmptyState], | ||
html: `<d-empty-state></d-empty-state>`, | ||
}); | ||
expect(page.root).toEqualHtml(` | ||
<d-empty-state> | ||
<mock:shadow-root> | ||
<div class="flex flex-col gap-4 items-center justify-center"> | ||
<div> | ||
<slot></slot> | ||
</div> | ||
<div class="flex flex-col gap-1"> | ||
<d-heading size="s"></d-heading> | ||
<d-text size="l"></d-text> | ||
</div> | ||
</div> | ||
</mock:shadow-root> | ||
</d-empty-state> | ||
`); | ||
}); | ||
}); |
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