Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/improve documentation #85

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/lib/AccordionItem.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
export let activatedOnce = 0;

import Button from '$lib/Button.svelte';
import PanelBody from '$lib/Icon.svelte';

function toggle() {
activatedOnce = 1;
Expand Down
2 changes: 0 additions & 2 deletions src/lib/Alert.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import Button from './Button.svelte';
import Icon from './Icon.svelte';

export let message = "Default message";
export let type = null;
export let closable = null;
export let show = true;
Expand Down Expand Up @@ -32,4 +31,3 @@
{/if}
</div>
{/if}

4 changes: 2 additions & 2 deletions src/lib/Avatar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</script>

{#if imgSrc}
<div class="c-avatar c-avatar--img { size ? 'c-avatar--'+size : ''}"><img src={imgSrc}></div>
<div on:click on:mouseover on:mouseenter on:mouseleave on:focus class="c-avatar c-avatar--img { size ? 'c-avatar--'+size : ''}"><img src={imgSrc}></div>
{:else}
<div class="c-avatar { size ? 'c-avatar--'+size : ''}">{initials}</div>
<div on:click on:mouseover on:mouseenter on:mouseleave on:focus class="c-avatar { size ? 'c-avatar--'+size : ''}">{initials}</div>
{/if}
3 changes: 1 addition & 2 deletions src/lib/Badge.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

</script>


<span class="c-badge {skin ? 'c-badge--'+skin : 'c-badge--default'}">
<span on:click on:mouseover on:mouseenter on:mouseleave class="c-badge {skin ? 'c-badge--'+skin : 'c-badge--default'}">
<slot />
</span>
8 changes: 6 additions & 2 deletions src/lib/Button.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@
class:c-button--icon={layout=="icon"}
class:c-button--disabled={disabled}
class:c-button--active={active}
on:click
on:mouseover
on:mouseenter
on:mouseleave
>
<ButtonInnerLayout {icon} {iconAnimatedClass} {layout}><slot></slot></ButtonInnerLayout>
</a>
Expand All @@ -66,7 +70,7 @@
class:c-button--block={block}
class:c-button--icon={layout=="icon"}
class:c-button--active={active}
on:submit|preventDefault on:click|preventDefault
on:submit|preventDefault on:click|preventDefault on:mouseover on:mouseenter on:mouseleave
>
<ButtonInnerLayout {icon} {iconAnimatedClass} {layout}><slot></slot></ButtonInnerLayout>
</button>
Expand All @@ -78,7 +82,7 @@
{style}
aria-expanded={ariaExpanded}
aria-controls={ariaControls}
on:submit|preventDefault on:click|preventDefault
on:submit|preventDefault on:click|preventDefault on:mouseover on:mouseenter on:mouseleave
class:c-button--block={block}
class:c-button--icon={layout=="icon"}
class:c-button--active={active}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Card.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
export let href = null;
</script>

<div class="c-card {cssClass}" class:c-card--interactive={href}>
<div on:mouseover on:mouseenter on:mouseleave class="c-card {cssClass}" class:c-card--interactive={href}>
{#if href}
<a {href} class="c-card__inner c-card__inner--interactive">
<div class="c-content">
Expand Down
7 changes: 5 additions & 2 deletions src/lib/LinkButton.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<script>

import ButtonInnerLayout from './ButtonInnerLayout.svelte';

// Extra class
export let cssClass = null;

Expand All @@ -27,11 +26,15 @@
</script>

<a
on:click
on:mouseover
on:mouseenter
on:mouseleave
href="{href}"
{style}
class="c-link-button { cssClass } { computedSkinValue }"
class:c-link-button--icon={layout=="icon"}
class:c-link-button--disabled={disabled}
>
<ButtonInnerLayout {icon} {layout}><slot></slot></ButtonInnerLayout>
</a>
</a>
24 changes: 24 additions & 0 deletions src/routes/styleguide/components/accordion.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,30 @@
</StyleguideCard>

<StyleguidePropsTable propsTable={propsTable} />
<br>

<StyleguideCard style="overflow: hidden" title="Component Details">
<ul class="c-bordered-list c-bordered-list--small">
<li>
<span>Forwarded Events</span>
<ul>
<li><span>None</span></li>
</ul>
</li>
<li>
<span>Slots</span>
<ul>
<li><span>Default</span></li>
</ul>
</li>
<li>
<span>Dispatch Events</span>
<ul>
<li><span>None</span></li>
</ul>
</li>
</ul>
</StyleguideCard>

<div class="u-spacer-top">
<h3 class="c-h3">Open issues</h3>
Expand Down
23 changes: 23 additions & 0 deletions src/routes/styleguide/components/alert.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,27 @@
</StyleguideCard>

<StyleguidePropsTable propsTable={propsTable} />
<br>

<StyleguideCard style="overflow: hidden" title="Component Details">
<ul class="c-bordered-list c-bordered-list--small">
<li>
<span>Forwarded Events</span>
<ul>
<li><span>None</span></li>
</ul>
</li>
<li>
<span>Slots</span>
<ul>
<li><span>None</span></li>
</ul>
</li>
<li>
<span>Dispatch Events</span>
<ul>
<li><span>None</span></li>
</ul>
</li>
</ul>
</StyleguideCard>
99 changes: 67 additions & 32 deletions src/routes/styleguide/components/avatar.svelte
Original file line number Diff line number Diff line change
@@ -1,48 +1,46 @@
<script>
import StyleguideIntro from '$lib/StyleguideIntro.svelte';
import StyleguideCard from '$lib/StyleguideCard.svelte';
import StyleguidePropsTable from '$lib/StyleguidePropsTable.svelte';
import StyleguideIntro from "$lib/StyleguideIntro.svelte";
import StyleguideCard from "$lib/StyleguideCard.svelte";
import StyleguidePropsTable from "$lib/StyleguidePropsTable.svelte";

let pageTitle = "Avatar";
import Avatar from "$lib/Avatar.svelte";

let pageTitle = 'Avatar';
import Avatar from '$lib/Avatar.svelte';

let propsTable = [
{
name: 'initials',
description: 'Determines label shown.',
name: "initials",
description: "Determines label shown.",
required: false,
},
{
name: 'imgSrc',
description: 'If set, shows an avatar image.',
name: "imgSrc",
description: "If set, shows an avatar image.",
required: false,
},
{
name: 'size',
description: 'If set, changes avatar size.',
name: "size",
description: "If set, changes avatar size.",
required: false,
options: [
{
name: 'xsmall',
default: false
name: "xsmall",
default: false,
},
{
name: 'small',
default: false
name: "small",
default: false,
},
{
name: 'medium',
default: false
name: "medium",
default: false,
},
{
name: 'large',
default: false
}
]
name: "large",
default: false,
},
],
},

]

];
</script>

<svelte:head>
Expand All @@ -51,26 +49,63 @@

<StyleguideIntro title={pageTitle} content="<p>A profile picture.</p>" />

<StyleguideCard title={pageTitle}
code="&lt;Avatar initials=&quot;JC&quot; /&gt;">
<StyleguideCard
title={pageTitle}
code="&lt;Avatar initials=&quot;JC&quot; /&gt;"
>
<Avatar initials="JC" />
</StyleguideCard>

<StyleguideCard title="Avatar with image" code="&lt;Avatar imgSrc=&quot;http://placekitten.com/500/500&quot; /&gt;">
<StyleguideCard
title="Avatar with image"
code="&lt;Avatar imgSrc=&quot;http://placekitten.com/500/500&quot; /&gt;"
>
<Avatar imgSrc="http://placekitten.com/500/500" />
</StyleguideCard>

<StyleguideCard title="Avatar sizes" code="&lt;Avatar initials=&quot;DK&quot; size=&quot;xsmall&quot; /&gt;
<StyleguideCard
title="Avatar sizes"
code="&lt;Avatar initials=&quot;DK&quot; size=&quot;xsmall&quot; /&gt;
&lt;Avatar initials=&quot;DK&quot; size=&quot;small&quot; /&gt;
&lt;Avatar initials=&quot;DK&quot; /&gt;
&lt;Avatar initials=&quot;DK&quot; size=&quot;medium&quot; /&gt;
&lt;Avatar initials=&quot;DK&quot; size=&quot;large&quot; /&gt;
">
"
>
<Avatar initials="DK" size="xsmall" />
<Avatar initials="DK" size="small" />
<Avatar initials="DK" />
<Avatar initials="DK" />
<Avatar initials="DK" size="medium" />
<Avatar initials="DK" size="large" />
</StyleguideCard>

<StyleguidePropsTable propsTable={propsTable} />
<StyleguidePropsTable {propsTable} />

<br />

<StyleguideCard style="overflow: hidden" title="Component Details">
<ul class="c-bordered-list c-bordered-list--small">
<li>
<span>Forwarded Events</span>
<ul>
<li><span>on:click</span></li>
<li><span>on:mouseover</span></li>
<li><span>on:mouseenter</span></li>
<li><span>on:mouseleave</span></li>
<li><span>on:focus</span></li>
</ul>
</li>
<li>
<span>Slots</span>
<ul>
<li><span>None</span></li>
</ul>
</li>
<li>
<span>Dispatch Events</span>
<ul>
<li><span>None</span></li>
</ul>
</li>
</ul>
</StyleguideCard>
30 changes: 30 additions & 0 deletions src/routes/styleguide/components/badge.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<script>
import StyleguideIntro from '$lib/StyleguideIntro.svelte';
import StyleguideCard from '$lib/StyleguideCard.svelte';
import SideMenu from "$lib/SideMenu.svelte";
import SideMenuItem from "$lib/SideMenuItem.svelte";
import SideMenuSectionHeader from "$lib/SideMenuSectionHeader.svelte";

let pageTitle = 'Badge';

Expand Down Expand Up @@ -55,3 +58,30 @@ code="&lt;Badge&gt;Default&lt;/Badge&gt;
</StyleguideCard>

<StyleguidePropsTable propsTable={propsTable} />
<br />

<StyleguideCard style="overflow: hidden" title="Component Details">
<ul class="c-bordered-list c-bordered-list--small">
<li>
<span>Forwarded Events</span>
<ul>
<li><span>on:click</span></li>
<li><span>on:mouseover</span></li>
<li><span>on:mouseenter</span></li>
<li><span>on:mouseleave</span></li>
</ul>
</li>
<li>
<span>Slots</span>
<ul>
<li><span>Default</span></li>
</ul>
</li>
<li>
<span>Dispatch Events</span>
<ul>
<li><span>None</span></li>
</ul>
</li>
</ul>
</StyleguideCard>
28 changes: 27 additions & 1 deletion src/routes/styleguide/components/button-link.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,30 @@
<LinkButton icon="add">Test</LinkButton>
</StyleguideCard>

<StyleguidePropsTable propsTable={propsTable} />
<StyleguidePropsTable propsTable={propsTable} />
<br>
<StyleguideCard style="overflow: hidden" title="Component Details">
<ul class="c-bordered-list c-bordered-list--small">
<li>
<span>Forwarded Events</span>
<ul>
<li><span>on:click</span></li>
<li><span>on:mouseover</span></li>
<li><span>on:mouseenter</span></li>
<li><span>on:mouseleave</span></li>
</ul>
</li>
<li>
<span>Slots</span>
<ul>
<li><span>Default</span></li>
</ul>
</li>
<li>
<span>Dispatched Events</span>
<ul>
<li><span>None</span></li>
</ul>
</li>
</ul>
</StyleguideCard>
Loading