Skip to content

Commit

Permalink
storybook: fix imports and required types
Browse files Browse the repository at this point in the history
- update import of main styles to use in storybook;
- update components with required types in stories;
  • Loading branch information
koorosh committed Apr 25, 2024
1 parent 980f786 commit ae43d39
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,13 @@ package | source
[@cockroachlabs/design-tokens](https://www.npmjs.com/package/@cockroachlabs/design-tokens) | [`/packages/design-tokens`](https://github.com/cockroachdb/ui/tree/master/packages/design-tokens)
[@cockroachlabs/icons](https://www.npmjs.com/package/@cockroachlabs/icons) | [`/packages/icons`](https://github.com/cockroachdb/ui/tree/master/packages/icons)
[@cockroachlabs/ui-components](https://www.npmjs.com/package/@cockroachlabs/ui-components) | [`/packages/ui-components`](https://github.com/cockroachdb/ui/tree/master/packages/ui-components)

## storybook-ui-components
To run storybook locally, it's required to build all dependent packages and then run Storybook itself:
```
pnpm install # install dependencies
pnpm build # run `build` scrips for all workspaces
pnpm --dir packages/storybook-ui-components start # run storybooks
# -or-
pnpm --dir packages/storybook-ui-components build-storybook # build a static version of storybooks
```
2 changes: 1 addition & 1 deletion packages/storybook-ui-components/.storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// .storybook/preview.ts
import "@cockroachlabs/ui-components/dist/main.css"
import "@cockroachlabs/ui-components/dist/cjs/index.css"

const preview = {
parameters: {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default {

export const Default = () => (
<div style={{ width: divWidth }}>
<ExpandableText text={fourLinetext} />
<ExpandableText text={fourLinetext} maxLine={4} />
</div>
);

Expand Down
6 changes: 4 additions & 2 deletions packages/storybook-ui-components/stories/Input.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const Number = () => {
<h1>Number Input</h1>

<NumberInput
initialValue={number("Initial value", 0)}
defaultValue={number("Initial value", 0)}
value={value}
disabled={boolean("disabled", false)}
invalid={boolean("invalid", false)}
Expand All @@ -40,7 +40,7 @@ export const Text = () => {
</StoryDescription>

<TextInput
initialValue={text("Initial value", "some text")}
defaultValue={text("Initial value", "some text")}
disabled={boolean("disabled", false)}
invalid={boolean("invalid", false)}
/>
Expand Down Expand Up @@ -77,6 +77,7 @@ export const Email = () => {
</StoryDescription>

<EmailInput
validatorLabel={text("validatorLabel", "validate email")}
disabled={boolean("disabled", false)}
invalid={boolean("invalid", false)}
/>
Expand All @@ -94,6 +95,7 @@ export const NewPassword = () => {
</StoryDescription>

<NewPasswordInput
validatorLabel={text("validatorLabel", "validate password")}
disabled={boolean("disabled", false)}
invalid={boolean("invalid", false)}
required={boolean("required", true)}
Expand Down

0 comments on commit ae43d39

Please sign in to comment.