Skip to content

Commit

Permalink
docs: update
Browse files Browse the repository at this point in the history
  • Loading branch information
typicode committed Apr 28, 2024
1 parent 9dd9dd4 commit b681420
Show file tree
Hide file tree
Showing 7 changed files with 130 additions and 58 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const App = () => (
)
```

_You can create React, Astro and Hono components. You can also use Tailwind CSS._
MistCSS can generate ⚛️ __React__, 🚀 __Astro__ and 🔥 __Hono__ components. You can use 🍃 __Tailwind CSS__ to style them.

## Documentation

Expand All @@ -45,6 +45,7 @@ https://typicode.github.io/mistcss

- [Next.js](https://nextjs.org/)
- [Remix](https://remix.run/)
- [Astro](https://astro.build/)
- [React](https://react.dev/)
- [Hono](https://hono.dev/)
- [Tailwind CSS](https://tailwindcss.com/)
- [Astro](https://astro.build/)
- [Tailwind CSS](https://tailwindcss.com/)
13 changes: 9 additions & 4 deletions docs/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineConfig } from 'astro/config';
import starlight from '@astrojs/starlight';
import { defineConfig } from 'astro/config'
import starlight from '@astrojs/starlight'

// https://astro.build/config
export default defineConfig({
Expand All @@ -18,10 +18,15 @@ export default defineConfig({
},
sidebar: [
{
label: 'Basics',
label: 'Getting Started',
items: [
{ label: 'Introduction', link: '/intro' },
{ label: 'Installation', link: '/install' },
{ label: 'Quick Start', link: '/start' },
],
},
{
label: 'Essentials',
items: [
{ label: 'Writing Components', link: '/component' },
{ label: 'Ignoring Generated Files', link: '/ignore' },
],
Expand Down
40 changes: 33 additions & 7 deletions docs/src/content/docs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ hero:
background: black;
color: white;

&[data-variant="primary"] {
&[data-variant='primary'] {
background: blue;
}

&[data-variant="secondary"] {
&[data-variant='secondary'] {
background: gray;
}
}
Expand All @@ -41,11 +41,37 @@ hero:
```jsx title="App.tsx"
import { CustomButton } from './Button.mist'

export const App = () => (
<CustomButton variant="primary">Save</CustomButton>
)
export const App = () => <CustomButton variant="primary">Save</CustomButton>
```

Read [docs](/intro)
</div>
MistCSS can generate ⚛️ __React__, 🚀 __Astro__ and 🔥 __Hono__ components. You can use 🍃 __Tailwind CSS__ to style them.

### What they say

<iframe
width="560"
height="315"
src="https://www.youtube.com/embed/9jrNwmj73F4?si=UsM9k8XXSl_1rc_c"
title="YouTube video player"
frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
referrerpolicy="strict-origin-when-cross-origin"
allowfullscreen
></iframe>

<iframe
width="560"
height="315"
src="https://www.youtube.com/embed/zSlORhjh5DQ?si=aXBk_CV2tgspMaBT"
title="YouTube video player"
frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
referrerpolicy="strict-origin-when-cross-origin"
allowfullscreen
></iframe>

## Learn more

__Read [docs](/intro)__

</div>
22 changes: 0 additions & 22 deletions docs/src/content/docs/install.mdx

This file was deleted.

22 changes: 0 additions & 22 deletions docs/src/content/docs/start.md

This file was deleted.

80 changes: 80 additions & 0 deletions docs/src/content/docs/start.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
---
title: Quick Start
---

## Install

```sh
npm install --save-dev mistcss
```

Assuming your components are in `./components`:

```json title="package.json" copy
{
"scripts": {
"mistcss:dev": "mistcss ./components --watch",
"mistcss:build": "mistcss ./components"
}
}
```

You may want to use [concurrently](https://github.com/open-cli-tools/concurrently) to run `mistcss:dev` in parallel with your dev server.

When building, `mistcss:build` must be run first.

## Write

Let's say you want to write a button component. It should have a default style and accept variants:

```css title="./components/Button.mist.css"
@scope (button.custom-button) {
:scope {
background: black;
color: white;

&[data-variant='primary'] {
background: blue;
}

&[data-variant='secondary'] {
background: gray;
}
}
}
```

:::note

The above code is 100% valid CSS and natively supported by browsers.

:::

:::note

MistCSS components support enum, boolean and string props. See [Writing Components](components).

:::

## Build

```shell
npm run mistcss:dev
# MistCSS will create ./components/Button.mist.tsx
```

## Use

Use it in your app. No JS/TS were written ✨

```jsx title="App.tsx"
import { CustomButton } from './Button.mist'

export const App = () => <CustomButton variant="primary">Save</CustomButton>
```

:::note

MistCSS supports creating React, Astro and Hono components. See [frameworks](frameworks).

:::
4 changes: 4 additions & 0 deletions docs/src/styles/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,8 @@
--sl-color-gray-6: #e4effe;
--sl-color-gray-7: #f1f7fe;
--sl-color-black: #ffffff;
}

.sl-markdown-content :is(iframe):not(:where(.not-content *)) {
height: 315px;
}

0 comments on commit b681420

Please sign in to comment.