-
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(Autocomplete.List.EmptyOption): replaced label prop with default slot docs(accordion): added default slots docs(alert): added default slots docs(autocomplete): updated to show change from label prop to default slot docs(avatar-group): split from avatar docs docs(avatar): moved AvatarGroup to its own page
- Loading branch information
Craig Howell
committed
Oct 11, 2022
1 parent
0d5c681
commit fc8e272
Showing
11 changed files
with
298 additions
and
182 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 |
---|---|---|
@@ -1,13 +1,13 @@ | ||
<script lang="ts"> | ||
import { twMerge } from 'tailwind-merge'; | ||
export let label = 'No Options Available'; | ||
const defaultClass = | ||
'group text-light-content dark:text-dark-content select-none p-0.5 w-full relative py-1.5 pl-2.5 pr-7 w-full rounded-md overflow-hidden'; | ||
const finalClass = twMerge(defaultClass, $$props.class); | ||
$: finalClass = twMerge(defaultClass, $$props.class); | ||
</script> | ||
|
||
<li class={finalClass} role="option" aria-selected="false"> | ||
<span class="font-normal block truncate"> {label} </span> | ||
<li class={finalClass} style={$$props.style} role="option" aria-selected="false"> | ||
<span class="font-normal block truncate"> | ||
{#if $$slots.default}<slot />{:else}No Options Available{/if} | ||
</span> | ||
</li> |
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
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,92 @@ | ||
<script lang="ts"> | ||
import { AvatarGroup, Card, Col } from '../../lib'; | ||
import CodeBlock from '../../docs/components/code-block'; | ||
import { | ||
exampleGroup, | ||
slots, | ||
iconProps, | ||
placeholderSlots, | ||
indicatorProps, | ||
groupProps, | ||
groupSlots, | ||
groupAvatarProps | ||
} from './examples'; | ||
import { PropsTable, SlotsTable } from '../../docs'; | ||
const avatars = [ | ||
'https://images.unsplash.com/photo-1491528323818-fdd1faba62cc?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=2&w=256&h=256&q=80', | ||
'https://images.unsplash.com/photo-1550525811-e5869dd03032?ixlib=rb-1.2.1&auto=format&fit=facearea&facepad=2&w=256&h=256&q=80', | ||
'https://images.unsplash.com/photo-1500648767791-00dcc994a43e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=2.25&w=256&h=256&q=80', | ||
'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-12"> | ||
<Card bordered={false}> | ||
<Card.Header slot="header">Avatar Group</Card.Header> | ||
<Card.Content slot="content" class="p-4"> | ||
<AvatarGroup size="xs"> | ||
{#each avatars as avatar} | ||
<AvatarGroup.Avatar src={avatar} /> | ||
{/each} | ||
</AvatarGroup> | ||
<br /> | ||
<AvatarGroup size="sm"> | ||
{#each avatars as avatar} | ||
<AvatarGroup.Avatar src={avatar} /> | ||
{/each} | ||
</AvatarGroup> | ||
<br /> | ||
<AvatarGroup> | ||
{#each avatars as avatar} | ||
<AvatarGroup.Avatar src={avatar} /> | ||
{/each} | ||
</AvatarGroup> | ||
<br /> | ||
<AvatarGroup size="lg"> | ||
{#each avatars as avatar} | ||
<AvatarGroup.Avatar src={avatar} class="ring-primary dark:ring-primary" /> | ||
{/each} | ||
</AvatarGroup> | ||
<br /> | ||
<AvatarGroup size="xl"> | ||
{#each avatars as avatar} | ||
<AvatarGroup.Avatar src={avatar} /> | ||
{/each} | ||
</AvatarGroup> | ||
|
||
<br /> | ||
<br /> | ||
|
||
<CodeBlock language="svelte" code={exampleGroup} /> | ||
</Card.Content> | ||
</Card> | ||
</Col> | ||
|
||
<Col class="col-24"> | ||
<PropsTable component="AvatarGroup" props={groupProps} /> | ||
</Col> | ||
|
||
<Col class="col-24"> | ||
<SlotsTable component="AvatarGroup" slots={groupSlots} /> | ||
</Col> | ||
|
||
<Col class="col-24"> | ||
<PropsTable component="AvatarGroup.Avatar" props={groupAvatarProps} /> | ||
</Col> | ||
|
||
<Col class="col-24"> | ||
<SlotsTable component="AvatarGroup.Avatar" {slots} /> | ||
</Col> | ||
|
||
<Col class="col-24"> | ||
<SlotsTable component="AvatarGroup.Avatar.Placeholder" slots={placeholderSlots} /> | ||
</Col> | ||
|
||
<Col class="col-24"> | ||
<PropsTable component="AvatarGroup.Avatar.Placeholder.Icon" props={iconProps} /> | ||
</Col> | ||
|
||
<Col class="col-24"> | ||
<PropsTable component="AvatarGroup.Avatar.Indicator" props={indicatorProps} /> | ||
</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,164 @@ | ||
import type { Slot, Prop } from '../../docs'; | ||
|
||
export const props: Prop[] = [ | ||
{ | ||
id: '1', | ||
prop: 'src', | ||
type: 'string', | ||
default: '' | ||
}, | ||
{ | ||
id: '2', | ||
prop: 'alt', | ||
type: 'string', | ||
default: 'avatar' | ||
}, | ||
{ | ||
id: '3', | ||
prop: 'shape', | ||
type: "'circle' | 'rounded' | 'square'", | ||
default: 'circle' | ||
}, | ||
{ | ||
id: '4', | ||
prop: 'size', | ||
type: "'xs' | 'sm' | 'md' | 'lg' | 'xl'", | ||
default: 'md' | ||
}, | ||
{ | ||
id: '5', | ||
prop: 'initials', | ||
type: 'string', | ||
default: '' | ||
} | ||
]; | ||
|
||
export const slots: Slot[] = [ | ||
{ | ||
id: '1', | ||
slot: 'placeholder', | ||
component: '<Avatar.Placeholder slot="placeholder" />' | ||
}, | ||
{ | ||
id: '2', | ||
slot: 'indicator', | ||
component: '<Avatar.Indicator slot="indicator" />' | ||
} | ||
]; | ||
|
||
export const placeholderSlots: Slot[] = [ | ||
{ | ||
id: '1', | ||
slot: 'icon', | ||
component: '<Avatar.Placeholder.Icon slot="icon" />' | ||
}, | ||
{ | ||
id: '2', | ||
slot: 'default', | ||
component: '' | ||
} | ||
]; | ||
|
||
export const iconProps: Prop[] = [ | ||
{ | ||
id: '1', | ||
prop: 'icon', | ||
type: '<a class="link" href="/types#MaterialIcon">MaterialIcon</a>', | ||
default: '' | ||
} | ||
]; | ||
|
||
export const indicatorProps: Prop[] = [ | ||
{ | ||
id: '1', | ||
prop: 'placement', | ||
type: "'top-right' | 'bottom-right' | 'top-left' | 'bottom-left'", | ||
default: 'top-right' | ||
} | ||
]; | ||
|
||
export const groupProps: Prop[] = [ | ||
{ | ||
id: '1', | ||
prop: 'shape', | ||
type: "'circle' | 'rounded' | 'square'", | ||
default: 'circle' | ||
}, | ||
{ | ||
id: '2', | ||
prop: 'size', | ||
type: "'xs' | 'sm' | 'md' | 'lg' | 'xl'", | ||
default: 'md' | ||
} | ||
]; | ||
|
||
export const groupSlots: Slot[] = [ | ||
{ | ||
id: '1', | ||
slot: 'default', | ||
component: '<AvatarGroup.Avatar />' | ||
} | ||
]; | ||
|
||
export const groupAvatarProps: Prop[] = [ | ||
{ | ||
id: '1', | ||
prop: 'src', | ||
type: 'string', | ||
default: '' | ||
}, | ||
{ | ||
id: '2', | ||
prop: 'alt', | ||
type: 'string', | ||
default: 'avatar' | ||
}, | ||
{ | ||
id: '3', | ||
prop: 'initials', | ||
type: 'string', | ||
default: '' | ||
} | ||
]; | ||
|
||
export const exampleGroup = ` | ||
<script lang="ts"> | ||
import { AvatarGroup } from 'stwui'; | ||
const avatars = [ | ||
'https://images.unsplash.com/photo-1491528323818-fdd1faba62cc?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=2&w=256&h=256&q=80', | ||
'https://images.unsplash.com/photo-1550525811-e5869dd03032?ixlib=rb-1.2.1&auto=format&fit=facearea&facepad=2&w=256&h=256&q=80', | ||
'https://images.unsplash.com/photo-1500648767791-00dcc994a43e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=2.25&w=256&h=256&q=80', | ||
'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> | ||
<AvatarGroup size="xs"> | ||
{#each avatars as avatar} | ||
<AvatarGroup.Avatar src={avatar} /> | ||
{/each} | ||
</AvatarGroup> | ||
<br /> | ||
<AvatarGroup size="sm"> | ||
{#each avatars as avatar} | ||
<AvatarGroup.Avatar src={avatar} /> | ||
{/each} | ||
</AvatarGroup> | ||
<br /> | ||
<AvatarGroup> | ||
{#each avatars as avatar} | ||
<AvatarGroup.Avatar src={avatar} /> | ||
{/each} | ||
</AvatarGroup> | ||
<br /> | ||
<AvatarGroup size="lg"> | ||
{#each avatars as avatar} | ||
<AvatarGroup.Avatar src={avatar} class="ring-primary dark:ring-primary" /> | ||
{/each} | ||
</AvatarGroup> | ||
<br /> | ||
<AvatarGroup size="xl"> | ||
{#each avatars as avatar} | ||
<AvatarGroup.Avatar src={avatar} /> | ||
{/each} | ||
</AvatarGroup>`; |
Oops, something went wrong.