-
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.
* feat: info led * test: fix info led test
- Loading branch information
1 parent
6bd5f88
commit 8ae022e
Showing
7 changed files
with
123 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
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,22 @@ | ||
import { Component, Host, Prop, h } from '@stencil/core'; | ||
|
||
@Component({ | ||
tag: 'd-info-led', | ||
styleUrl: 'd-info-led.css', | ||
shadow: true, | ||
}) | ||
export class DInfoLed { | ||
@Prop() type: 'success' | 'warning' | 'error' = 'success'; | ||
|
||
render() { | ||
return ( | ||
<Host> | ||
<div class={{'h-[5px] w-[5px] shrink-0 rounded-full border border-solid':true, | ||
'bg-success border-success': this.type === 'success', | ||
'bg-warning border-warning': this.type === 'warning', | ||
'bg-error border-error': this.type === 'error', | ||
}} /> | ||
</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,37 @@ | ||
import { DInfoLed } from './d-info-led'; | ||
import { Meta, StoryObj } from '@storybook/html'; | ||
|
||
const meta = { | ||
title: 'Design System/Atoms/InfoLed', | ||
render: args => | ||
`<d-info-led | ||
type="${args.type}" | ||
</d-info-led>`, | ||
} satisfies Meta<DInfoLed>; | ||
|
||
export default meta; | ||
type Story = StoryObj<DInfoLed>; | ||
|
||
export const Default: Story = { | ||
args: { | ||
type: 'success', | ||
}, | ||
parameters: { | ||
design: { | ||
type: 'figma', | ||
url: 'https://www.figma.com/file/pdwfO3dMKtaCAQakht0JE6/DIDRoom-%2B-Signroom---WF-and-GUI---Dyne.org?node-id=3449%3A48602&mode=dev', | ||
}, | ||
}, | ||
}; | ||
|
||
export const Warning: Story = { | ||
args: { | ||
type: 'warning', | ||
}, | ||
}; | ||
|
||
export const Error: Story = { | ||
args: { | ||
type: 'error', | ||
}, | ||
}; |
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,17 @@ | ||
# d-info-led | ||
|
||
|
||
|
||
<!-- Auto Generated Below --> | ||
|
||
|
||
## Properties | ||
|
||
| Property | Attribute | Description | Type | Default | | ||
| -------- | --------- | ----------- | ----------------------------------- | ----------- | | ||
| `type` | `type` | | `"error" \| "success" \| "warning"` | `'success'` | | ||
|
||
|
||
---------------------------------------------- | ||
|
||
*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-info-led', () => { | ||
it('renders', async () => { | ||
const page = await newE2EPage(); | ||
await page.setContent('<d-info-led></d-info-led>'); | ||
|
||
const element = await page.find('d-info-led'); | ||
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,18 @@ | ||
import { newSpecPage } from '@stencil/core/testing'; | ||
import { DInfoLed } from '../d-info-led'; | ||
|
||
describe('d-info-led', () => { | ||
it('renders', async () => { | ||
const page = await newSpecPage({ | ||
components: [DInfoLed], | ||
html: `<d-info-led></d-info-led>`, | ||
}); | ||
expect(page.root).toEqualHtml(` | ||
<d-info-led> | ||
<mock:shadow-root> | ||
<div class="bg-success border border-solid border-success h-[5px] rounded-full shrink-0 w-[5px]"></div> | ||
</mock:shadow-root> | ||
</d-info-led> | ||
`); | ||
}); | ||
}); |