Skip to content
Closed
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
62 changes: 62 additions & 0 deletions docs/src/lib/components/PackageManager.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<script lang="ts">
import Code from './Code.svelte';
import { Tabs } from 'svelte-ux';

interface Props {
packageName?: string;
options?: {
value: number;
label: string;
command: string;
}[];
}

let {
packageName = 'layerchart',
options = [
{
value: 0,
label: 'pnpm',
command: 'pnpm i'
},
{
value: 1,
label: 'npm',
command: 'npm i'
},
{
value: 2,
label: 'bun',
command: 'bun add'
},
{
value: 3,
label: 'deno',
command: 'deno add'
},
{
value: 4,
label: 'yarn',
command: 'yarn add'
}
]
}: Props = $props();

let value = $state(0);
</script>

<div class="grid grid-cols-2 gap-4 pt-4 w-full">
<Tabs
{options}
placement="top"
bind:value
classes={{
content: 'w-full border rounded-b rounded-tr w-full',
tab: { root: 'rounded-t' }
}}
>
<svelte:fragment slot="content" let:value>
<Code source={`${options[value].command} ${packageName}`} language="sh" />
</svelte:fragment>
</Tabs>
</div>
10 changes: 4 additions & 6 deletions docs/src/routes/docs/getting-started/+page.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<script lang="ts">
import { Button } from 'svelte-ux';
import Example from '$lib/components/Example.svelte';
import PackageManager from '$lib/components/PackageManager.svelte';

import {
a as A,
ul as Ul,
Expand Down Expand Up @@ -73,15 +75,11 @@ or checkout out the **standlone** {@render githubButton('standalone')} {@render

## Manual setup

To manually setup LayerChart in a new project (such as one ceated with [sv create](https://svelte.dev/docs/cli/sv-create)) or in an existing project.
To manually setup LayerChart in a new project (such as one created with [sv create](https://svelte.dev/docs/cli/sv-create)) or in an existing project.

First import `layerchart` with your package manager of choice:

```sh
npm install layerchart
# or
pnpm install layerchart
```
<PackageManager />

then import the components from `layerchart`:

Expand Down
Loading