-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from etchteam/feat/etch-371-loading-skeleton
feat: loading skeleton components
- Loading branch information
Showing
14 changed files
with
442 additions
and
11 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,16 @@ | ||
import { StoryObj } from '@storybook/web-components'; | ||
import { html } from 'lit'; | ||
|
||
import './LoadingButton'; | ||
|
||
export default { | ||
component: 'diamond-loading-button', | ||
}; | ||
|
||
export const LoadingButton: StoryObj = { | ||
render: () => html` | ||
<diamond-button width="full-width"> | ||
<diamond-loading-button>Button text</diamond-loading-button> | ||
</diamond-button> | ||
`, | ||
}; |
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,23 @@ | ||
import { LitElement, html } from 'lit'; | ||
import { customElement, property } from 'lit/decorators.js'; | ||
|
||
import { pulse } from '../../../lib/pulse'; | ||
|
||
@customElement('diamond-loading-button') | ||
export class LoadingButton extends LitElement { | ||
@property({ reflect: true, attribute: 'aria-hidden' }) ariaHidden: | ||
| string | ||
| null = 'true'; | ||
|
||
static readonly styles = [pulse]; | ||
|
||
render() { | ||
return html`<slot></slot>`; | ||
} | ||
} | ||
|
||
declare global { | ||
interface HTMLElementTagNameMap { | ||
'diamond-loading-button': LoadingButton; | ||
} | ||
} |
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,24 @@ | ||
import { StoryObj } from '@storybook/web-components'; | ||
import { html } from 'lit'; | ||
|
||
import './LoadingImg'; | ||
|
||
export default { | ||
component: 'diamond-loading-img', | ||
}; | ||
|
||
export const LoadingImg: StoryObj = { | ||
render: (args) => html` | ||
<diamond-img> | ||
<diamond-loading-img | ||
height="${args.height}" | ||
width="${args.width}" | ||
></diamond-loading-img> | ||
</diamond-img> | ||
`, | ||
}; | ||
|
||
LoadingImg.args = { | ||
width: 400, | ||
height: 300, | ||
}; |
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,39 @@ | ||
import { LitElement, css, html } from 'lit'; | ||
import { customElement, property } from 'lit/decorators.js'; | ||
|
||
import { pulse } from '../../../lib/pulse'; | ||
|
||
@customElement('diamond-loading-img') | ||
export class LoadingImg extends LitElement { | ||
@property({ reflect: true }) width: string = '0'; | ||
@property({ reflect: true }) height: string = '0'; | ||
|
||
static readonly styles = [ | ||
pulse, | ||
css` | ||
:host { | ||
aspect-ratio: var(--diamond-loading-img-width) / | ||
var(--diamond-loading-img-height); | ||
height: calc(var(--diamond-loading-img-height) * 1px); | ||
width: calc(var(--diamond-loading-img-width) * 1px); | ||
} | ||
`, | ||
]; | ||
|
||
render() { | ||
return html` | ||
<style> | ||
:host { | ||
--diamond-loading-img-width: ${this.width}; | ||
--diamond-loading-img-height: ${this.height}; | ||
} | ||
</style> | ||
`; | ||
} | ||
} | ||
|
||
declare global { | ||
interface HTMLElementTagNameMap { | ||
'diamond-loading-img': LoadingImg; | ||
} | ||
} |
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,19 @@ | ||
import { StoryObj } from '@storybook/web-components'; | ||
import { html } from 'lit'; | ||
|
||
import './LoadingText'; | ||
|
||
export default { | ||
component: 'diamond-loading-text', | ||
}; | ||
|
||
export const LoadingText: StoryObj = { | ||
render: () => html` | ||
<h1> | ||
<diamond-loading-text>Loading title</diamond-loading-text> | ||
</h1> | ||
<p> | ||
<diamond-loading-text>Loading text</diamond-loading-text> | ||
</p> | ||
`, | ||
}; |
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 { LitElement, html } from 'lit'; | ||
import { customElement, property } from 'lit/decorators.js'; | ||
|
||
import { pulse } from '../../../lib/pulse'; | ||
|
||
@customElement('diamond-loading-text') | ||
export class LoadingText extends LitElement { | ||
@property({ reflect: true, attribute: 'aria-hidden' }) ariaHidden: | ||
| string | ||
| null = 'true'; | ||
static readonly styles = [pulse]; | ||
|
||
render() { | ||
return html`<slot></slot>`; | ||
} | ||
} | ||
|
||
declare global { | ||
interface HTMLElementTagNameMap { | ||
'diamond-loading-text': LoadingText; | ||
} | ||
} |
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.