From 450197b948fd186fff0da72105fd68ac1b174fd2 Mon Sep 17 00:00:00 2001 From: Wojciech Date: Wed, 2 Oct 2024 15:56:36 +0200 Subject: [PATCH 1/4] add paragraph component --- .changeset/silent-lamps-yawn.md | 5 +++++ src/components/Paragraph/Paragraph.stories.tsx | 18 ++++++++++++++++++ src/components/Paragraph/Paragraph.tsx | 10 ++++++++++ src/components/Paragraph/index.ts | 1 + 4 files changed, 34 insertions(+) create mode 100644 .changeset/silent-lamps-yawn.md create mode 100644 src/components/Paragraph/Paragraph.stories.tsx create mode 100644 src/components/Paragraph/Paragraph.tsx create mode 100644 src/components/Paragraph/index.ts diff --git a/.changeset/silent-lamps-yawn.md b/.changeset/silent-lamps-yawn.md new file mode 100644 index 00000000..4ffaa57e --- /dev/null +++ b/.changeset/silent-lamps-yawn.md @@ -0,0 +1,5 @@ +--- +"@saleor/macaw-ui": patch +--- + +Macaw-ui now exports new Paragraph component that is Text displayed as block. diff --git a/src/components/Paragraph/Paragraph.stories.tsx b/src/components/Paragraph/Paragraph.stories.tsx new file mode 100644 index 00000000..787d221f --- /dev/null +++ b/src/components/Paragraph/Paragraph.stories.tsx @@ -0,0 +1,18 @@ +import { Meta, StoryObj } from "@storybook/react"; +import { Paragraph } from "./index"; + +const meta: Meta = { + title: "Components / Paragraph", + tags: ["autodocs"], + component: Paragraph, +}; + +export default meta; +type Story = StoryObj; + +export const Default: Story = { + args: { + size: 4, + children: "Some text displayed as block.", + }, +}; diff --git a/src/components/Paragraph/Paragraph.tsx b/src/components/Paragraph/Paragraph.tsx new file mode 100644 index 00000000..32153d6c --- /dev/null +++ b/src/components/Paragraph/Paragraph.tsx @@ -0,0 +1,10 @@ +import { forwardRef } from "react"; +import { TextProps, Text } from "../Text"; + +export const Paragraph = forwardRef( + ({ ...rest }, ref) => { + return ; + } +); + +Paragraph.displayName = "Paragraph"; diff --git a/src/components/Paragraph/index.ts b/src/components/Paragraph/index.ts new file mode 100644 index 00000000..8bf2f8fc --- /dev/null +++ b/src/components/Paragraph/index.ts @@ -0,0 +1 @@ +export * from "./Paragraph"; From af20c8620abfd7230581e54ecd89d0c79612cb4b Mon Sep 17 00:00:00 2001 From: Wojciech Date: Wed, 2 Oct 2024 16:18:27 +0200 Subject: [PATCH 2/4] export paragraph --- src/components/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/index.ts b/src/components/index.ts index a58e6cef..5da55cf9 100644 --- a/src/components/index.ts +++ b/src/components/index.ts @@ -16,6 +16,7 @@ export * from "./Input"; export * from "./List"; export * from "./Modal"; export * from "./Multiselect"; +export * from "./Paragraph"; export * from "./Popover"; export * from "./RadioGroup"; export * from "./RangeInput"; From b4410bfc8f0b696eae2311ec78f7ef8ea2f5cf07 Mon Sep 17 00:00:00 2001 From: Wojciech Date: Thu, 3 Oct 2024 11:30:26 +0200 Subject: [PATCH 3/4] text as td --- src/components/Text/Text.tsx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/components/Text/Text.tsx b/src/components/Text/Text.tsx index 22cea878..c7c53d65 100644 --- a/src/components/Text/Text.tsx +++ b/src/components/Text/Text.tsx @@ -8,7 +8,18 @@ import { text, TextVariants } from "./Text.css"; export type TextProps = PropsWithBox<{ children: ReactNode; - as?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "p" | "span" | "a" | "strong"; + as?: + | "h1" + | "h2" + | "h3" + | "h4" + | "h5" + | "h6" + | "p" + | "span" + | "a" + | "strong" + | "td"; className?: string; size?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11; }> & From 2d4f8436f44ba93ddad4952c900b8682d2028e54 Mon Sep 17 00:00:00 2001 From: Wojciech Date: Thu, 3 Oct 2024 14:05:35 +0200 Subject: [PATCH 4/4] change tag to p --- src/components/Paragraph/Paragraph.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Paragraph/Paragraph.tsx b/src/components/Paragraph/Paragraph.tsx index 32153d6c..08314334 100644 --- a/src/components/Paragraph/Paragraph.tsx +++ b/src/components/Paragraph/Paragraph.tsx @@ -3,7 +3,7 @@ import { TextProps, Text } from "../Text"; export const Paragraph = forwardRef( ({ ...rest }, ref) => { - return ; + return ; } );