Skip to content

Commit

Permalink
Updated storybook (forem#18559)
Browse files Browse the repository at this point in the history
  • Loading branch information
rt4914 authored Oct 11, 2022
1 parent 83fe60c commit 895c40c
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 28 deletions.
2 changes: 1 addition & 1 deletion app/javascript/.storybook/preview.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { h } from 'preact';
import { addDecorator, addParameters } from '@storybook/preact';
import { DocsPage, DocsContainer } from '@storybook/addon-docs/blocks';
import { DocsPage, DocsContainer } from '@storybook/addon-docs';
import { jsxDecorator } from 'storybook-addon-jsx';
import cssVariablesTheme from '@etchteam/storybook-addon-css-variables-theme';
import 'focus-visible';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { h } from 'preact';
import '../../storybook-utilities/designSystem.scss';
import { Meta } from '@storybook/addon-docs/blocks';
import { Meta } from '@storybook/addon-docs';

<Meta title="Component Library" />

Expand Down Expand Up @@ -53,7 +53,7 @@ The same button above that was created with pure HTML using modifying classes is
also a Preact component.

```
import { Button } from '@crayons';
import { Button } from '@crayons';
...
<Button variant="primary" destructive>Hello<Button>
```
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { h } from 'preact';
import '../../storybook-utilities/designSystem.scss';
import { Meta } from '@storybook/addon-docs/blocks';
import { Meta } from '@storybook/addon-docs';

<Meta title="Utility-First CSS" />

Expand All @@ -22,12 +22,12 @@ like this:
This element has several classes applied. Each responsible for different part of
styling:

|**Utility Class**|True CSS|
|---|---|
|**`radius-default`**|`border-radius: 5px;`|
|**`bg-accent-brand`**|`background-color: #3b49df;`|
|**`p-6`**|`padding: 24px;`|
|**`mb-4`**|`margin-bottom: 16px;`|
| **Utility Class** | True CSS |
| --------------------- | ---------------------------- |
| **`radius-default`** | `border-radius: 5px;` |
| **`bg-accent-brand`** | `background-color: #3b49df;` |
| **`p-6`** | `padding: 24px;` |
| **`mb-4`** | `margin-bottom: 16px;` |

Wait, how does `p-6` equate to `24px`? Under the hood, we use lots of
variables like this:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { h } from 'preact';
import '../../storybook-utilities/designSystem.scss';
import { Meta } from '@storybook/addon-docs/blocks';
import { Meta } from '@storybook/addon-docs';

<Meta title="Writing CSS" />

Expand Down Expand Up @@ -47,23 +47,22 @@ helpers as well as breakpoint variables I mentioned earlier.

You can access all of the SCSS files in `app/assets/stylesheets` folder.

|Folder/File|Description|
|---|---|
|`/base`| Contains some fundamental styling for layouts, resets and icons.|
|`/components`| Contains separate SCSS file for each component.
|||
|`/config`| Contains many configuration files.
|`/config/_colors.scss`| Contains all color variables.
|`/config/_generator.scss`| Contains SCSS mixins generating *all* of our utility classes.
|`/config/_import.scss`| Contains helpers for SCSS as well as media breakpoints variables.
|`/config/_variables.scss`| Contains all CSS native variables.

| Folder/File | Description |
| ------------------------- | ----------------------------------------------------------------- |
| `/base` | Contains some fundamental styling for layouts, resets and icons. |
| `/components` | Contains separate SCSS file for each component. |
|||
| `/config` | Contains many configuration files. |
| `/config/_colors.scss` | Contains all color variables. |
| `/config/_generator.scss` | Contains SCSS mixins generating _all_ of our utility classes. |
| `/config/_import.scss` | Contains helpers for SCSS as well as media breakpoints variables. |
| `/config/_variables.scss` | Contains all CSS native variables. |

There are other folders and top level files that we use, but they might be deprecated in the future. They are:

- `crayons.scss` - this is one importing everything Crayons-related like
variables, components styling, utility classes etc.
variables, components styling, utility classes etc.
- `views.scss` - this one contains views-specific styling. It is separated
from Crayons to make Crayons library DEV agnostic.
from Crayons to make Crayons library DEV agnostic.
- `minimal.scss` - this one is actually one of the main stylesheets from
pre-Crayons era. It imports everything basically :).
pre-Crayons era. It imports everything basically :).
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { h } from 'preact';
import '../../storybook-utilities/designSystem.scss';
import { Meta } from '@storybook/addon-docs/blocks';
import { Meta } from '@storybook/addon-docs';

<Meta title="Introduction" />

Expand Down Expand Up @@ -67,4 +67,4 @@ As mentioned earlier, `utility-first CSS classes` let you create even the most
complex components without writing a single line of CSS. **We recommend choosing
to write code using utility-first CSS over creating a new SCSS each time.**
Every additional line of CSS you write translates to more CSS that we have to
maintain, more CSS for our users to download, and more bytes for us to host.
maintain, more CSS for our users to download, and more bytes for us to host.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { h } from 'preact';

import { Meta } from '@storybook/addon-docs/blocks';
import { Meta } from '@storybook/addon-docs';

<Meta title="Fundamentals/Media Queries" />

Expand Down

0 comments on commit 895c40c

Please sign in to comment.