From 9d8d19d789d19b54cd36253eee16a849a2158f40 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 14 Jul 2024 00:08:53 -0300 Subject: [PATCH 1/3] feat: create componente dead --- .../DeadComponent/DeadComponent.stories.tsx | 13 +++++++++++++ src/components/DeadComponent/DeadComponent.test.tsx | 8 ++++++++ src/components/DeadComponent/DeadComponent.tsx | 12 ++++++++++++ src/components/DeadComponent/index.ts | 3 +++ 4 files changed, 36 insertions(+) create mode 100644 src/components/DeadComponent/DeadComponent.stories.tsx create mode 100644 src/components/DeadComponent/DeadComponent.test.tsx create mode 100644 src/components/DeadComponent/DeadComponent.tsx create mode 100644 src/components/DeadComponent/index.ts diff --git a/src/components/DeadComponent/DeadComponent.stories.tsx b/src/components/DeadComponent/DeadComponent.stories.tsx new file mode 100644 index 0000000..3bbcbb0 --- /dev/null +++ b/src/components/DeadComponent/DeadComponent.stories.tsx @@ -0,0 +1,13 @@ +import type { Meta, StoryObj } from '@storybook/react'; +import { DeadComponent } from "./DeadComponent" + +export type Story = StoryObj + +const meta: Meta = { + title: 'Components/DeadComponent', + component: DeadComponent, +} satisfies Meta + +export default meta; + +export const Default: Story = {} \ No newline at end of file diff --git a/src/components/DeadComponent/DeadComponent.test.tsx b/src/components/DeadComponent/DeadComponent.test.tsx new file mode 100644 index 0000000..a53ff64 --- /dev/null +++ b/src/components/DeadComponent/DeadComponent.test.tsx @@ -0,0 +1,8 @@ +import { render } from '@testing-library/react'; +import { DeadComponent } from './DeadComponent'; + +test('renders DeadComponent', () => { + const { getByText } = render(); + const element = getByText(/DeadComponent/i); + expect(element).toBeInTheDocument(); +}); \ No newline at end of file diff --git a/src/components/DeadComponent/DeadComponent.tsx b/src/components/DeadComponent/DeadComponent.tsx new file mode 100644 index 0000000..1ea1e1c --- /dev/null +++ b/src/components/DeadComponent/DeadComponent.tsx @@ -0,0 +1,12 @@ +export const DeadComponent = () => { + return ( +
+
+
+ 08:00 +

Abertura

+
+
+
+ ); +}; diff --git a/src/components/DeadComponent/index.ts b/src/components/DeadComponent/index.ts new file mode 100644 index 0000000..fea5110 --- /dev/null +++ b/src/components/DeadComponent/index.ts @@ -0,0 +1,3 @@ +import { DeadComponent } from "./DeadComponent" + +export { DeadComponent } \ No newline at end of file From 4d8bec81acc84bf70d2c912a52507ea3da2947b7 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 14 Jul 2024 02:10:00 -0300 Subject: [PATCH 2/3] feat: add props --- .../DeadComponent/DeadComponent.stories.tsx | 19 ++++++++++++++++++- .../DeadComponent/DeadComponent.test.tsx | 2 +- .../DeadComponent/DeadComponent.tsx | 10 +++++++--- src/components/DeadComponent/types.ts | 4 ++++ 4 files changed, 30 insertions(+), 5 deletions(-) create mode 100644 src/components/DeadComponent/types.ts diff --git a/src/components/DeadComponent/DeadComponent.stories.tsx b/src/components/DeadComponent/DeadComponent.stories.tsx index 3bbcbb0..6284166 100644 --- a/src/components/DeadComponent/DeadComponent.stories.tsx +++ b/src/components/DeadComponent/DeadComponent.stories.tsx @@ -6,8 +6,25 @@ export type Story = StoryObj const meta: Meta = { title: 'Components/DeadComponent', component: DeadComponent, + argTypes: { + title: { + control: { + type: 'text', + }, + }, + hours: { + control: { + type: 'text', + }, + }, + }, } satisfies Meta export default meta; -export const Default: Story = {} \ No newline at end of file +export const Default: Story = { + args: { + title: 'Dead Component', + hours: '12', + }, +} \ No newline at end of file diff --git a/src/components/DeadComponent/DeadComponent.test.tsx b/src/components/DeadComponent/DeadComponent.test.tsx index a53ff64..df86eda 100644 --- a/src/components/DeadComponent/DeadComponent.test.tsx +++ b/src/components/DeadComponent/DeadComponent.test.tsx @@ -2,7 +2,7 @@ import { render } from '@testing-library/react'; import { DeadComponent } from './DeadComponent'; test('renders DeadComponent', () => { - const { getByText } = render(); + const { getByText } = render(); const element = getByText(/DeadComponent/i); expect(element).toBeInTheDocument(); }); \ No newline at end of file diff --git a/src/components/DeadComponent/DeadComponent.tsx b/src/components/DeadComponent/DeadComponent.tsx index 1ea1e1c..0d1b008 100644 --- a/src/components/DeadComponent/DeadComponent.tsx +++ b/src/components/DeadComponent/DeadComponent.tsx @@ -1,10 +1,14 @@ -export const DeadComponent = () => { +import { DeadComponentProps } from "./types"; + +export const DeadComponent = ({title, hours}: DeadComponentProps) => { + + return (
- 08:00 -

Abertura

+ {hours} +

{title}

diff --git a/src/components/DeadComponent/types.ts b/src/components/DeadComponent/types.ts new file mode 100644 index 0000000..637af6b --- /dev/null +++ b/src/components/DeadComponent/types.ts @@ -0,0 +1,4 @@ +export interface DeadComponentProps { + title: string; + hours: string; +} \ No newline at end of file From 64d6229575d3aeaa3f1779e35def54033a698b9d Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 14 Jul 2024 02:17:58 -0300 Subject: [PATCH 3/3] fix: Correcting props --- src/components/DeadComponent/DeadComponent.test.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/DeadComponent/DeadComponent.test.tsx b/src/components/DeadComponent/DeadComponent.test.tsx index df86eda..f0b51c9 100644 --- a/src/components/DeadComponent/DeadComponent.test.tsx +++ b/src/components/DeadComponent/DeadComponent.test.tsx @@ -3,6 +3,6 @@ import { DeadComponent } from './DeadComponent'; test('renders DeadComponent', () => { const { getByText } = render(); - const element = getByText(/DeadComponent/i); + const element = getByText(/Abertura/i); expect(element).toBeInTheDocument(); }); \ No newline at end of file