-
-
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.
- Loading branch information
Showing
3 changed files
with
70 additions
and
17 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 @@ | ||
./packages/astrobook/README.md |
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,69 @@ | ||
# astrobook | ||
|
||
[![NPM version](https://img.shields.io/npm/v/astrobook?color=a1b858&label=)](https://www.npmjs.com/package/astrobook) | ||
|
||
> A minimal and fast [Storybook](https://storybook.js.org/) alternative. Powered by [Astro](https://astro.build/). | ||
![astrobook](https://github.com/user-attachments/assets/dbaa6243-4ce2-45da-b760-44543f59bb63) | ||
|
||
## Quick start | ||
|
||
> [!NOTE] | ||
> Astrobook supports **React**, **Vue**, **Preact**, **Svelte**, **Solid** and **Astro** components out of the box. We use React as an example here. Check the [Astro docs](https://docs.astro.build/en/guides/integrations-guide/#official-integrations) for other integrations. | ||
1. Install the packages | ||
|
||
```bash | ||
npm install astro astrobook @astrojs/react | ||
``` | ||
|
||
2. Create `astro.config.mjs` | ||
|
||
```js | ||
import { defineConfig } from 'astro/config' | ||
import react from '@astrojs/react' | ||
import astrobook from 'astrobook' | ||
|
||
// https://astro.build/config | ||
export default defineConfig({ | ||
integrations: [react(), astrobook()], | ||
}) | ||
``` | ||
|
||
3. Add scripts to your `package.json` | ||
|
||
```json | ||
"scripts": { | ||
"dev": "astro dev", | ||
"build": "astro build" | ||
} | ||
``` | ||
|
||
4. Write stories | ||
|
||
```ts | ||
// components/Button.stories.ts | ||
import { Button, type ButtonProps } from './Button.tsx' | ||
|
||
export default { | ||
component: Button, | ||
} | ||
|
||
export const PrimaryButton = { | ||
args: { | ||
variant: 'primary', | ||
} satisfies ButtonProps, | ||
} | ||
|
||
export const SecondaryButton = { | ||
args: { | ||
variant: 'secondary', | ||
} satisfies ButtonProps, | ||
} | ||
``` | ||
|
||
5. Run `npm run dev` and open `http://localhost:4321` to see your stories. | ||
|
||
## License | ||
|
||
MIT |
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