Skip to content

Commit

Permalink
bugfix([DST-627]): replace useState import from storybook (#4336)
Browse files Browse the repository at this point in the history
* DST-627: replace useState import from storybook

* Create new-paws-carry.md

* Update .changeset/new-paws-carry.md
  • Loading branch information
aromko authored Dec 12, 2024
1 parent 1cf8f0d commit d326823
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 8 deletions.
16 changes: 16 additions & 0 deletions .changeset/new-paws-carry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
"@marigold/components": patch
---

bugfix([DST-627]): replace useState import from storybook

Some controlled stories in Storybook were incorrect because the useState import from react was used, resulting in an error.

The stories of the following component were affected:

- Calendar
- DateField
- DatePicker
- Dialog
- HelpText
- SearchField
2 changes: 1 addition & 1 deletion packages/components/src/Calendar/Calendar.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable react-hooks/rules-of-hooks */
import { CalendarDate } from '@internationalized/date';
import { useState } from '@storybook/preview-api';
import type { Meta, StoryObj } from '@storybook/react';
import { useState } from 'react';
import { DateValue } from 'react-aria-components';
import { Calendar } from './Calendar';

Expand Down
6 changes: 3 additions & 3 deletions packages/components/src/DateField/DateField.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable react-hooks/rules-of-hooks */
import { DateValue } from '@internationalized/date';
import { CalendarDate, DateValue } from '@internationalized/date';
import { useState } from '@storybook/preview-api';
import type { Meta, StoryObj } from '@storybook/react';
import { useState } from 'react';
import { I18nProvider } from '@react-aria/i18n';
import { DateField, DateFieldProps } from './DateField';

Expand Down Expand Up @@ -109,7 +109,7 @@ export const Basic: Story = {

export const ControlledDateField: Story = {
render: args => {
const [value, setValue] = useState<DateValue>();
const [value, setValue] = useState<DateValue>(new CalendarDate(1970, 1, 1));
return (
<I18nProvider locale="de-DE">
<DateField
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/DatePicker/DatePicker.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable react-hooks/rules-of-hooks */
import { CalendarDate, getLocalTimeZone, today } from '@internationalized/date';
import { useState } from '@storybook/preview-api';
import type { Meta, StoryObj } from '@storybook/react';
import { useState } from 'react';
import { DateValue } from 'react-aria-components';
import { I18nProvider } from '@react-aria/i18n';
import { Stack } from '../Stack';
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/Dialog/Dialog.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable react-hooks/rules-of-hooks */
import { useState } from '@storybook/preview-api';
import type { Meta, StoryObj } from '@storybook/react';
import { useState } from 'react';
import { Button } from '../Button';
import { Checkbox, CheckboxGroup } from '../Checkbox';
import { Menu } from '../Menu';
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/HelpText/HelpText.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useState } from '@storybook/preview-api';
import type { Meta, StoryObj } from '@storybook/react';
import { useState } from 'react';
import { Form, TextField } from 'react-aria-components';
import { Button } from '../Button';
import { Input } from '../Input';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable react-hooks/rules-of-hooks */
import { useState } from '@storybook/preview-api';
import { Meta, StoryObj } from '@storybook/react';
import { useState } from 'react';
import { SearchField } from './SearchField';

const meta = {
Expand Down

0 comments on commit d326823

Please sign in to comment.