Skip to content

Commit

Permalink
chore: relocate stories folder into lib
Browse files Browse the repository at this point in the history
  • Loading branch information
skinread committed Dec 4, 2024
1 parent 33bf312 commit 0a69d60
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 29 deletions.
10 changes: 1 addition & 9 deletions lib/stories/borders.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,15 @@ import React from 'react';

import { Box } from '../components/Box';
import { Heading } from '../components/Heading';
import { stack, type RecipeStackProps } from '../styles/stack.css';
import { tokens } from '../themes/base/tokens';
import { BorderWidthScale } from '../themes/tokens';

import { Stack } from './helpers';
import { labels, swatch, titles } from './styles.css';

const widthItems = Object.keys(tokens.border.width);
const radiusItems = Object.keys(tokens.border.radius);

// TODO: find a home for new recipe components
const Stack = ({
children,
...props
}: RecipeStackProps & { children: React.ReactNode }) => (
<div className={stack(props)}>{children}</div>
);

const Widths = () => {
return (
<Stack>
Expand Down
10 changes: 10 additions & 0 deletions lib/stories/helpers/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React from 'react';

import { stack, type RecipeStackProps } from '../../styles/stack.css';

export const Stack = ({
children,
...props
}: RecipeStackProps & { children: React.ReactNode }) => (
<div className={stack(props)}>{children}</div>
);
10 changes: 1 addition & 9 deletions lib/stories/palette.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,12 @@ import React from 'react';

import { Heading } from '../components/Heading';
import { sprinkles } from '../styles/sprinkles.css';
import { stack, type RecipeStackProps } from '../styles/stack.css';
import { baseThemeColours } from '../themes/base/tokens';
import type { ColourGamut, ColourValue } from '../themes/tokens';

import { Stack } from './helpers';
import { labels, hexPill, swatch } from './styles.css';

// TODO: find a home for new recipe components
const Stack = ({
children,
...props
}: RecipeStackProps & { children: React.ReactNode }) => (
<div className={stack(props)}>{children}</div>
);

interface SwatchProps {
colour: ColourGamut;
hex?: string;
Expand Down
10 changes: 1 addition & 9 deletions lib/stories/theme.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,11 @@ import type { Meta, StoryObj } from '@storybook/react';
import React from 'react';

import { Heading } from '../components/Heading';
import { stack, type RecipeStackProps } from '../styles/stack.css';
import { themeContractVars } from '../themes/theme.css';

import { Stack } from './helpers';
import { labels, swatch } from './styles.css';

// TODO: find a home for new recipe components
const Stack = ({
children,
...props
}: RecipeStackProps & { children: React.ReactNode }) => (
<div className={stack(props)}>{children}</div>
);

const ThemeSwatch = ({ label, cssVar }) => (
<div
key={label}
Expand Down
2 changes: 1 addition & 1 deletion lib/stories/welcome.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Markdown, Meta } from '@storybook/blocks';

import Readme from '../readme.md?raw';
import Readme from '../../readme.md?raw';

<Meta title="Overdrive" />

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"access": "public"
},
"scripts": {
"build": "babel lib --out-dir dist --extensions '.ts,.tsx,.css' --ignore 'lib/**/*.stories.tsx'",
"build": "babel lib --out-dir dist --extensions '.ts,.tsx,.css' --ignore 'lib/**/*.stories.tsx,lib/stories'",
"chromatic": "chromatic test --exit-zero-on-changes --build-script-name storybook:build",
"copy:public": "node scripts/copyPublic.js",
"check-deps": "npx npm-check-updates@latest --interactive --format group",
Expand Down

0 comments on commit 0a69d60

Please sign in to comment.