Skip to content

Commit

Permalink
Started working on new website documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
DaveKeehl committed Apr 10, 2024
1 parent e001d96 commit de2aa00
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 39 deletions.
19 changes: 3 additions & 16 deletions www/astro.config.mjs
Expand Up @@ -5,23 +5,10 @@ import starlight from '@astrojs/starlight';
export default defineConfig({
integrations: [
starlight({
title: 'My Docs',
title: 'Svelte Reveal',
social: {
github: 'https://github.com/withastro/starlight'
},
sidebar: [
{
label: 'Guides',
items: [
// Each item here is one entry in the navigation menu.
{ label: 'Example Guide', link: '/guides/example/' }
]
},
{
label: 'Reference',
autogenerate: { directory: 'reference' }
}
]
github: 'https://github.com/davekeehl/svelte-reveal'
}
})
]
});
11 changes: 0 additions & 11 deletions www/src/content/docs/guides/example.md

This file was deleted.

2 changes: 1 addition & 1 deletion www/src/content/docs/index.mdx
Expand Up @@ -8,7 +8,7 @@ hero:
file: ../../assets/houston.webp
actions:
- text: Example Guide
link: /guides/example/
link: /usage/
icon: right-arrow
variant: primary
- text: Read the Starlight docs
Expand Down
11 changes: 0 additions & 11 deletions www/src/content/docs/reference/example.md

This file was deleted.

91 changes: 91 additions & 0 deletions www/src/content/docs/usage.mdx
@@ -0,0 +1,91 @@
---
title: Usage
---

import { Steps, Tabs, TabItem, Aside } from '@astrojs/starlight/components';

<Steps>

1. Install the library:

<Tabs>

<TabItem label="npm">

```sh
npm i -D svelte-reveal
```

</TabItem>

<TabItem label="pnpm">

```sh
pnpm i -D svelte-reveal
```

</TabItem>

<TabItem label="Yarn">

```sh
yarn add -D svelte-reveal
```

</TabItem>

<TabItem label="Bun">

```sh
bun add -D svelte-reveal
```

</TabItem>

</Tabs>

2. Import the library in your Svelte component:

```svelte
<script>
// App.svelte
import { reveal } from 'svelte-reveal';
</script>
```

3. Add the imported `reveal` action to the DOM element you want to transition:

```svelte
// App.svelte
<h1 use:reveal>Hello world</h1>
<p use:reveal={{ transition: 'slide' }}>A paragraph</p>
```

If you want to use the action on a Svelte component, you need to pass the reveal options via props:

```svelte
<script>
// App.svelte
import Heading from './Heading.svelte';
</script>
<Heading useReveal={{ transition: 'slide' }}>Hello world</Heading>
```

```svelte
<script lang="ts">
// Heading.svelte
import { reveal, type RevealOptions } from 'svelte-reveal';
export let useReveal: RevealOptions;
</script>
<h1 use:reveal={useReveal}>
<slot />
</h1>
```

<Aside type="caution" title="Watch out!">
Using [SvelteKit](https://kit.svelte.dev/)? Please refer to the ["SvelteKit"](#sveltekit) section.
</Aside>

</Steps>

0 comments on commit de2aa00

Please sign in to comment.