From 72d29962d9a3dc5b030a285cc848c1693100d009 Mon Sep 17 00:00:00 2001 From: Francis Anthony Date: Tue, 16 Jul 2024 19:15:21 +0800 Subject: [PATCH] Create button icon text component refs #49 --- app/listings/page.tsx | 24 +++++++++++--- components/buttons/icon-text.tsx | 26 +++++++++++++++ public/icons/filter_list.svg | 4 +++ .../ButtonIconText.stories.tsx | 32 +++++++++++++++++++ 4 files changed, 82 insertions(+), 4 deletions(-) create mode 100644 components/buttons/icon-text.tsx create mode 100644 public/icons/filter_list.svg create mode 100644 stories/button-icon-text/ButtonIconText.stories.tsx diff --git a/app/listings/page.tsx b/app/listings/page.tsx index a4fd7a01..4421ab8d 100644 --- a/app/listings/page.tsx +++ b/app/listings/page.tsx @@ -1,12 +1,28 @@ +import ButtonIconTextOutlined from "@/components/buttons/icon-text"; import Search from "@/components/search"; export default function Home() { return ( -
+
{/* TODO: TOP */} -
- - {/* TODO: Filter button */} +
+
+ +
+ + + + + + {/* TODO: Price */} + {/* TODO: Beds/Baths */} + {/* TODO: Area */}
); diff --git a/components/buttons/icon-text.tsx b/components/buttons/icon-text.tsx new file mode 100644 index 00000000..55161042 --- /dev/null +++ b/components/buttons/icon-text.tsx @@ -0,0 +1,26 @@ +import { MouseEventHandler } from "react"; + +export interface ButtonIconTextOutlinedProps { + text: string; + onClick?: MouseEventHandler; + dataCy?: string; +} + +export default function ButtonIconTextOutlined({ children, props }: { children: React.ReactNode, props: ButtonIconTextOutlinedProps }) { + return ( + + ); +} diff --git a/public/icons/filter_list.svg b/public/icons/filter_list.svg new file mode 100644 index 00000000..ee6e3be2 --- /dev/null +++ b/public/icons/filter_list.svg @@ -0,0 +1,4 @@ + + + \ No newline at end of file diff --git a/stories/button-icon-text/ButtonIconText.stories.tsx b/stories/button-icon-text/ButtonIconText.stories.tsx new file mode 100644 index 00000000..b490d1c5 --- /dev/null +++ b/stories/button-icon-text/ButtonIconText.stories.tsx @@ -0,0 +1,32 @@ +import ButtonIconTextOutlined from "@/components/buttons/icon-text"; +import type { Meta, StoryObj } from "@storybook/react"; + +const meta: Meta = { + title: "Buttons/Icon Text/Outlined", + component: ButtonIconTextOutlined, + tags: ["autodocs"], +} satisfies Meta; + +export default meta; +type Story = StoryObj; + +export const Example: Story = { + args: { + props: { + text: "Filter", + onClick: () => { + console.log("Added to favorites 💗"); + }, + }, + }, + render: (args) => ( + + + + + + ), +};