-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(Media): class is reactive including child components
docs(media): added including examples, props, and slots tables
- Loading branch information
Craig Howell
committed
Oct 12, 2022
1 parent
5157958
commit da3111d
Showing
6 changed files
with
203 additions
and
5 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
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,76 @@ | ||
<script lang="ts"> | ||
import { Card, Col, Media } from '../../lib'; | ||
import CodeBlock from '../../docs/components/code-block'; | ||
import { | ||
example, | ||
noAvatarExample, | ||
slots, | ||
avatarProps, | ||
contentSlots, | ||
titleSlots, | ||
descriptionSlots | ||
} from './examples'; | ||
import { PropsTable, SlotsTable } from '../../docs'; | ||
const avatar = | ||
'https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=2&w=256&h=256&q=80'; | ||
</script> | ||
|
||
<Col class="col-24 md:col-8"> | ||
<Card bordered={false} elevation="none" class="bg-transparent dark:bg-transparent"> | ||
<Card bordered={false}> | ||
<Card.Content slot="content"> | ||
<Media> | ||
<Media.Avatar src={avatar} /> | ||
<Media.Content> | ||
<Media.Content.Title>Europe Street beat</Media.Content.Title> | ||
<Media.Content.Description>www.instagram.com</Media.Content.Description> | ||
</Media.Content> | ||
</Media> | ||
</Card.Content> | ||
</Card> | ||
|
||
<br /> | ||
|
||
<CodeBlock language="svelte" code={example} /> | ||
</Card> | ||
</Col> | ||
|
||
<Col class="col-24 md:col-8"> | ||
<Card bordered={false} elevation="none" class="bg-transparent dark:bg-transparent"> | ||
<Card bordered={false}> | ||
<Card.Content slot="content"> | ||
<Media> | ||
<Media.Content> | ||
<Media.Content.Title>Europe Street beat</Media.Content.Title> | ||
<Media.Content.Description>www.instagram.com</Media.Content.Description> | ||
</Media.Content> | ||
</Media> | ||
</Card.Content> | ||
</Card> | ||
|
||
<br /> | ||
|
||
<CodeBlock language="svelte" code={noAvatarExample} /> | ||
</Card> | ||
</Col> | ||
|
||
<Col class="col-24"> | ||
<SlotsTable component="Media" {slots} /> | ||
</Col> | ||
|
||
<Col class="col-24"> | ||
<PropsTable component="Media.Avatar" props={avatarProps} /> | ||
</Col> | ||
|
||
<Col class="col-24"> | ||
<SlotsTable component="Media.Content" slots={contentSlots} /> | ||
</Col> | ||
|
||
<Col class="col-24"> | ||
<SlotsTable component="Medai.Content.Title" slots={titleSlots} /> | ||
</Col> | ||
|
||
<Col class="col-24"> | ||
<SlotsTable component="Medai.Content.Description" slots={descriptionSlots} /> | ||
</Col> |
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,113 @@ | ||
import type { Slot, Prop } from '../../docs'; | ||
|
||
export const slots: Slot[] = [ | ||
{ | ||
id: '1', | ||
slot: 'avatar', | ||
component: '<Media.Avatar slot="avatar" />' | ||
}, | ||
{ | ||
id: '2', | ||
slot: 'content', | ||
component: '<Media.Content slot="content" />' | ||
}, | ||
{ | ||
id: '3', | ||
slot: 'default', | ||
component: '' | ||
} | ||
]; | ||
|
||
export const avatarProps: Prop[] = [ | ||
{ | ||
id: '1', | ||
prop: 'align', | ||
type: "'top' | 'center' | 'bottom'", | ||
default: 'top' | ||
}, | ||
{ | ||
id: '2', | ||
prop: 'src', | ||
type: 'string', | ||
default: '' | ||
}, | ||
{ | ||
id: '3', | ||
prop: 'alt', | ||
type: 'string', | ||
default: 'avatar' | ||
}, | ||
{ | ||
id: '4', | ||
prop: 'size', | ||
type: "'xs' | 'sm' | 'md' | 'lg' | 'xl'", | ||
default: 'md' | ||
} | ||
]; | ||
|
||
export const contentSlots: Slot[] = [ | ||
{ | ||
id: '1', | ||
slot: 'title', | ||
component: '<Media.Content.Title slot="title" />' | ||
}, | ||
{ | ||
id: '2', | ||
slot: 'description', | ||
component: '<Media.Content.Description slot="description" />' | ||
}, | ||
{ | ||
id: '3', | ||
slot: 'default', | ||
component: '' | ||
} | ||
]; | ||
|
||
export const titleSlots: Slot[] = [ | ||
{ | ||
id: '1', | ||
slot: 'default', | ||
component: '' | ||
} | ||
]; | ||
|
||
export const descriptionSlots: Slot[] = [ | ||
{ | ||
id: '1', | ||
slot: 'default', | ||
component: '' | ||
} | ||
]; | ||
|
||
export const example = ` | ||
<script lang="ts"> | ||
import { Card, Media } from 'stwui'; | ||
</script> | ||
<Card bordered={false}> | ||
<Card.Content slot="content"> | ||
<Media> | ||
<Media.Avatar src={avatar} /> | ||
<Media.Content> | ||
<Media.Content.Title>Europe Street beat</Media.Content.Title> | ||
<Media.Content.Description>www.instagram.com</Media.Content.Description> | ||
</Media.Content> | ||
</Media> | ||
</Card.Content> | ||
</Card>`; | ||
|
||
export const noAvatarExample = ` | ||
<script lang="ts"> | ||
import { Card, Media } from 'stwui'; | ||
</script> | ||
<Card bordered={false}> | ||
<Card.Content slot="content"> | ||
<Media> | ||
<Media.Content> | ||
<Media.Content.Title>Europe Street beat</Media.Content.Title> | ||
<Media.Content.Description>www.instagram.com</Media.Content.Description> | ||
</Media.Content> | ||
</Media> | ||
</Card.Content> | ||
</Card>`; |