-
Notifications
You must be signed in to change notification settings - Fork 0
Refs/heads/6 accordion #24
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,14 +1,14 @@ | ||
{ | ||
"$schema": "https://shadcn-svelte.com/schema.json", | ||
"style": "default", | ||
"tailwind": { | ||
"config": "tailwind.config.js", | ||
"css": "src/index.css", | ||
"baseColor": "slate" | ||
}, | ||
"aliases": { | ||
"components": "src/lib/shadcnComponents", | ||
"utils": "src/utils" | ||
}, | ||
"typescript": true | ||
} | ||
"$schema": "https://shadcn-svelte.com/schema.json", | ||
"style": "default", | ||
"tailwind": { | ||
"config": "tailwind.config.js", | ||
"css": "src/index.css", | ||
"baseColor": "slate" | ||
}, | ||
"aliases": { | ||
"components": "$src/lib/shadcnComponents", | ||
"utils": "$src/utils" | ||
}, | ||
"typescript": true | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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,20 @@ | ||
<svg | ||
width="10" | ||
height="10" | ||
viewBox="0 0 10 10" | ||
fill="none" | ||
xmlns="http://www.w3.org/2000/svg" | ||
class={$$restProps.class} | ||
> | ||
<g clip-path="url(#clip0_2578_353)"> | ||
<path | ||
d="M9.80685 1.78353L3.65879 9.16121L0.23584 5.64046L1.43083 4.47867L3.56344 6.67221L8.52648 0.716553L9.80685 1.78353Z" | ||
fill="black" | ||
/> | ||
</g> | ||
<defs> | ||
<clipPath id="clip0_2578_353"> | ||
<rect width="10" height="10" fill="black" /> | ||
</clipPath> | ||
</defs> | ||
</svg> |
This file contains hidden or 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,9 @@ | ||
<script lang="ts"> | ||
</script> | ||
|
||
claireclark1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<svg width="12" height="8" viewBox="0 0 12 8" fill="none" xmlns="http://www.w3.org/2000/svg" class={$$restProps.class}> | ||
<path | ||
d="M10.4711 0.229856L6.93879 4.08615L5.99461 5.1117L5.05522 4.08615L1.5325 0.229856C1.15866 -0.0945539 0.617074 -0.0788567 0.276785 0.297878C-0.0922616 0.700774 -0.0922616 1.34959 0.276785 1.75249L5.06001 6.97445L5.9994 8L6.94358 6.97445L11.7268 1.75249C11.9089 1.55366 12 1.2868 12 1.02518C12 0.763563 11.9089 0.49671 11.7268 0.297878C11.3817 -0.0788567 10.8401 -0.0945539 10.4711 0.229856Z" | ||
fill="currentColor" | ||
/> | ||
</svg> |
This file contains hidden or 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 hidden or 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,25 @@ | ||
<script lang="ts"> | ||
import { Meta, Story } from '@storybook/addon-svelte-csf'; | ||
import Check from './Check.svelte'; | ||
import Chevron from './Chevron.svelte'; | ||
import Error from './Error.svelte'; | ||
|
||
const icons = { | ||
Check, | ||
Chevron, | ||
Error, | ||
}; | ||
</script> | ||
|
||
<Meta title="Icons/IconList" /> | ||
|
||
<Story name="IconList"> | ||
<div class="grid grid-cols-1 gap-4 p-4 md:grid-cols-2 lg:grid-cols-4"> | ||
{#each Object.entries(icons) as [name, Icon]} | ||
<div class="p-4"> | ||
<h2 class="mb-2 text-lg font-semibold">{name}</h2> | ||
<svelte:component this={Icon} class="mb-1 h-8 w-8" /> | ||
</div> | ||
{/each} | ||
</div> | ||
</Story> |
This file contains hidden or 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,12 @@ | ||
<script> | ||
import { Meta, Story } from '@storybook/addon-svelte-csf'; | ||
|
||
import Accordion from './Accordion.svelte'; | ||
</script> | ||
|
||
<Meta title="Design System/Features/Accordion" component={Accordion} /> | ||
|
||
<!-- Primary --> | ||
<Story name="Accordion"> | ||
<Accordion trigger="Hello world." content="Hello there." /> | ||
</Story> |
This file contains hidden or 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,13 @@ | ||
<script lang="ts"> | ||
import { Root, Item, Trigger, Content } from '../shadcnComponents/ui/accordion'; | ||
|
||
export let trigger = ''; | ||
export let content = ''; | ||
</script> | ||
|
||
<Root> | ||
<Item value="item-1"> | ||
<Trigger>{trigger}</Trigger> | ||
<Content>{content}</Content> | ||
</Item> | ||
</Root> |
This file contains hidden or 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,18 @@ | ||
<script> | ||
import { Meta, Story } from '@storybook/addon-svelte-csf'; | ||
|
||
import AccordionList from './AccordionList.svelte'; | ||
import Accordion from './Accordion.svelte'; | ||
</script> | ||
|
||
<Meta title="Design System/Features/AccordionList" component={AccordionList} /> | ||
|
||
<!-- Primary --> | ||
<Story name="AccordionList"> | ||
<AccordionList> | ||
<Accordion trigger="Hello world." content="Hello there." /> | ||
</AccordionList> | ||
<AccordionList> | ||
<Accordion trigger="Are you there?" content="Yes I am!" /> | ||
</AccordionList> | ||
</Story> |
This file contains hidden or 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,7 @@ | ||
<script lang="ts"> | ||
import { Root } from '../shadcnComponents/ui/accordion'; | ||
</script> | ||
|
||
<Root> | ||
<slot /> | ||
</Root> |
25 changes: 25 additions & 0 deletions
25
src/lib/shadcnComponents/ui/accordion/accordion-content.svelte
This file contains hidden or 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,25 @@ | ||
<script lang="ts"> | ||
import { Accordion as AccordionPrimitive } from 'bits-ui'; | ||
import { slide } from 'svelte/transition'; | ||
import { cn } from '../../../../utils'; | ||
|
||
type $$Props = AccordionPrimitive.ContentProps; | ||
|
||
let className: $$Props['class'] = undefined; | ||
export let transition: $$Props['transition'] = slide; | ||
export let transitionConfig: $$Props['transitionConfig'] = { | ||
duration: 200, | ||
}; | ||
export { className as class }; | ||
</script> | ||
|
||
<AccordionPrimitive.Content | ||
class={cn('overflow-hidden text-sm transition-all', className)} | ||
{transition} | ||
{transitionConfig} | ||
{...$$restProps} | ||
> | ||
<div class="pb-4 pt-0 text-normal"> | ||
<slot /> | ||
</div> | ||
</AccordionPrimitive.Content> |
14 changes: 14 additions & 0 deletions
14
src/lib/shadcnComponents/ui/accordion/accordion-item.svelte
This file contains hidden or 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,14 @@ | ||
<script lang="ts"> | ||
import { Accordion as AccordionPrimitive } from "bits-ui"; | ||
import { cn } from '../../../../utils'; | ||
|
||
type $$Props = AccordionPrimitive.ItemProps; | ||
|
||
let className: $$Props["class"] = undefined; | ||
export let value: $$Props["value"]; | ||
export { className as class }; | ||
</script> | ||
|
||
<AccordionPrimitive.Item {value} class={cn("border-b", className)} {...$$restProps}> | ||
<slot /> | ||
</AccordionPrimitive.Item> |
26 changes: 26 additions & 0 deletions
26
src/lib/shadcnComponents/ui/accordion/accordion-trigger.svelte
This file contains hidden or 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,26 @@ | ||
<script lang="ts"> | ||
import { Accordion as AccordionPrimitive } from 'bits-ui'; | ||
import Chevron from '../../../../icons/Chevron.svelte'; | ||
import { cn } from '../../../../utils'; | ||
|
||
type $$Props = AccordionPrimitive.TriggerProps; | ||
type $$Events = AccordionPrimitive.TriggerEvents; | ||
|
||
let className: $$Props['class'] = undefined; | ||
export let level: AccordionPrimitive.HeaderProps['level'] = 3; | ||
export { className as class }; | ||
</script> | ||
|
||
<AccordionPrimitive.Header {level} class="flex"> | ||
<AccordionPrimitive.Trigger | ||
class={cn( | ||
'flex flex-1 items-center justify-between py-4 text-md font-bold transition-all [&[data-state=open]>svg]:rotate-180', | ||
className | ||
)} | ||
{...$$restProps} | ||
on:click | ||
> | ||
<slot /> | ||
<Chevron class="h-5 w-5 bg-black p-1 text-white transition-transform duration-200" /> | ||
</AccordionPrimitive.Trigger> | ||
</AccordionPrimitive.Header> |
This file contains hidden or 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,17 @@ | ||
import { Accordion as AccordionPrimitive } from "bits-ui"; | ||
import Content from "./accordion-content.svelte"; | ||
import Item from "./accordion-item.svelte"; | ||
import Trigger from "./accordion-trigger.svelte"; | ||
const Root = AccordionPrimitive.Root; | ||
|
||
export { | ||
Root, | ||
Content, | ||
Item, | ||
Trigger, | ||
// | ||
Root as Accordion, | ||
Content as AccordionContent, | ||
Item as AccordionItem, | ||
Trigger as AccordionTrigger, | ||
}; |
This file contains hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.