-
-
Notifications
You must be signed in to change notification settings - Fork 6
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 #30 from kampsy/dev
Dev
- Loading branch information
Showing
9 changed files
with
192 additions
and
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export const showMoreDefault = ` | ||
import { ShowMore } from 'kampsy-ui'; | ||
let isActive = $state(false); | ||
<div class="w-full"> | ||
<ShowMore bind:isActive /> | ||
</div>`; |
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,70 @@ | ||
<script lang="ts"> | ||
import { ChevronDownSmall } from '$lib/icons/index.js'; | ||
type propsT = { | ||
isActive: boolean; | ||
}; | ||
let { isActive = $bindable(false)}: propsT = $props(); | ||
const onclick = () => { | ||
isActive = !isActive; | ||
}; | ||
let rotate = $derived.by(() => { | ||
if (isActive) { | ||
return 'rotate-180'; | ||
} | ||
return ''; | ||
}); | ||
let ariaLabel = $derived.by(() => { | ||
if (isActive) { | ||
return 'Show less content'; | ||
} | ||
return 'Show more content'; | ||
}); | ||
let buttonText = $derived.by(() => { | ||
if (isActive) { | ||
return 'show less'; | ||
} | ||
return 'Show more'; | ||
}); | ||
</script> | ||
|
||
{#snippet suffixSnip()} | ||
<div class="w-4 h-4"> | ||
<div | ||
class="rounded-full w-4 h-4 {rotate} transform-gpu duration-200 flex items-center justify-center" | ||
> | ||
<ChevronDownSmall /> | ||
</div> | ||
</div> | ||
{/snippet} | ||
|
||
<div class="w-full"> | ||
<div class="flex items-center box-border"> | ||
<div class="grow border-t border-kui-light-gray-400 dark:border-kui-dark-gray-400"> | ||
<!--line--> | ||
</div> | ||
<div class="grow-0"> | ||
<button | ||
{onclick} | ||
aria-label={ariaLabel} | ||
type="button" | ||
class="rounded-full p-1.5 border border-kui-light-gray-400 dark:border-kui-dark-gray-400 | ||
hover:border-kui-light-gray-500 dark:hover:border-kui-dark-gray-500 hover:bg-kui-light-gray-200 | ||
dark:hover:bg-kui-dark-gray-200 transition duration-300" | ||
> | ||
<div class="px-1.5 w-full flex items-center gap-1 justify-center"> | ||
<div class="font-medium capitalize text-sm">{buttonText}</div> | ||
{@render suffixSnip()} | ||
</div> | ||
</button> | ||
</div> | ||
<div class="grow border-t border-kui-light-gray-400 dark:border-kui-dark-gray-400"> | ||
<!--second line--> | ||
</div> | ||
</div> | ||
</div> |
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,86 @@ | ||
<script lang="ts"> | ||
import Aside from '$lib/../docs/ui/aside.svelte'; | ||
import Row from '$lib/../docs/ui/row.svelte'; | ||
import Shell from '$lib/../docs/ui/shell.svelte'; | ||
import { asideData } from '$lib/../docs/utils/data.js'; | ||
import CollapseCode from '$lib/collapse/collapseCode.svelte'; | ||
import type { Snippet } from 'svelte'; | ||
import Pagination from '$lib/pagination/pagination.svelte'; | ||
import { ShowMore } from '$lib/index.js'; | ||
import { showMoreDefault } from '../../docs/data/showMore.js'; | ||
let isActive = $state(false); | ||
$inspect(isActive); | ||
</script> | ||
|
||
<svelte:head> | ||
<title>Show More</title> | ||
</svelte:head> | ||
|
||
{#snippet error()} | ||
<Row> | ||
<h1 | ||
class="first-letter:capitalize text-kui-light-gray-1000 dark:text-kui-dark-gray-1000 text-[24px] lg:text-[40px] font-semibold leading-[32px] lg:leading-[48px] tracking-[-0.96px] lg:tracking-[-2.4px] mb-3" | ||
> | ||
Show more | ||
</h1> | ||
<p | ||
class="first-letter:capitalize text-kui-light-gray-900 dark:text-kui-dark-gray-900 text-[16px] lg:text-[20px] font-normal leading-[24px] lg:leading-[30px] tracking-normal lg:tracking-[-0.33px]" | ||
> | ||
Styling component to show expanded or collapsed content. | ||
</p> | ||
</Row> | ||
{/snippet} | ||
|
||
{#snippet demoAndCode(demo: Snippet, code: string)} | ||
<div | ||
class="bg-kui-light-bg dark:bg-kui-dark-bg border border-kui-light-gray-200 dark:border-kui-dark-gray-400 rounded-xl overflow-hidden" | ||
> | ||
<div class="w-full p-4 lg:p-6 overflow-x-auto"> | ||
<div class="w-full flex flex-wrap gap-4"> | ||
{@render demo()} | ||
</div> | ||
</div> | ||
<CollapseCode {code} /> | ||
</div> | ||
{/snippet} | ||
|
||
{#snippet defaultShowMore()} | ||
<Row> | ||
<h2 | ||
class="first-letter:capitalize text-kui-light-gray-1000 dark:text-kui-dark-gray-1000 text-[24px] font-semibold leading-[32px] tracking-[-0.96px] mb-3" | ||
> | ||
<a href="#default" id="default">default</a> | ||
</h2> | ||
<div class="mt-4 xl:mt-7"> | ||
{#snippet demo()} | ||
<div class="w-full"> | ||
<ShowMore bind:isActive /> | ||
</div> | ||
{/snippet} | ||
{@render demoAndCode(demo, showMoreDefault)} | ||
</div> | ||
</Row> | ||
{/snippet} | ||
|
||
{#snippet prevAndNext()} | ||
<Row bottomLine={false}> | ||
<Pagination | ||
previous={{ title: 'select', href: '/select' }} | ||
next={{ title: 'spinner', href: '/spinner' }} | ||
/> | ||
</Row> | ||
{/snippet} | ||
|
||
{#snippet cont()} | ||
{@render error()} | ||
{@render defaultShowMore()} | ||
{@render prevAndNext()} | ||
{/snippet} | ||
|
||
{#snippet aside()} | ||
<Aside asideDataList={asideData} /> | ||
{/snippet} | ||
|
||
<Shell asideSlot={aside} contSlot={cont} /> |
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