From e44e3cb1b77e5dff4d6c33d4d7c0be26265fb3e7 Mon Sep 17 00:00:00 2001 From: anemne <63043552+anemne@users.noreply.github.com> Date: Tue, 12 Nov 2024 08:31:21 +0100 Subject: [PATCH] deleted backbutton (#869) --- src/components/buttons/BackButton.stories.tsx | 39 ------------------- src/components/buttons/BackButton.tsx | 36 ----------------- 2 files changed, 75 deletions(-) delete mode 100644 src/components/buttons/BackButton.stories.tsx delete mode 100644 src/components/buttons/BackButton.tsx diff --git a/src/components/buttons/BackButton.stories.tsx b/src/components/buttons/BackButton.stories.tsx deleted file mode 100644 index 92218befb..000000000 --- a/src/components/buttons/BackButton.stories.tsx +++ /dev/null @@ -1,39 +0,0 @@ -import type { Meta, StoryObj } from "@storybook/react"; - -import BackButton from "./BackButton"; - -const meta: Meta = { - title: "Components/Buttons/BackButton", - component: BackButton, - parameters: { - a11y: { - element: "button", - config: {}, - options: {}, - manual: false, - }, - }, - argTypes: { - size: { - control: { - type: "select", - options: ["large", "small"], - }, - }, - }, -}; - -export default meta; -type Story = StoryObj; - -export const Small: Story = { - args: { - size: "small", - }, -}; - -export const Large: Story = { - args: { - size: "large", - }, -}; diff --git a/src/components/buttons/BackButton.tsx b/src/components/buttons/BackButton.tsx deleted file mode 100644 index c7bf7435c..000000000 --- a/src/components/buttons/BackButton.tsx +++ /dev/null @@ -1,36 +0,0 @@ -"use client"; -import { useRouter } from "next/navigation"; -import React from "react"; - -import styles from "./button.module.css"; - -type ButtonSize = "large" | "small"; - -interface IButton { - size?: ButtonSize; -} - -const sizeClassMap: { [key in ButtonSize]: string } = { - large: styles.large, - small: styles.small, -}; - -const BackButton = ({ size = "small" }: IButton) => { - const isStorybook = typeof window !== "undefined" && !!window.STORYBOOK_ENV; - const router = useRouter(); - const className = `${styles.button} ${sizeClassMap[size]} ${styles.back}`; - - const handleClick = () => { - if (!isStorybook && router) { - router.back(); - } - }; - - return ( - - ); -}; - -export default BackButton;