diff --git a/packages/components/src/CloseButton/CloseButton.module.css b/packages/components/src/CloseButton/CloseButton.module.css deleted file mode 100644 index 6b8fc7c62..000000000 --- a/packages/components/src/CloseButton/CloseButton.module.css +++ /dev/null @@ -1,30 +0,0 @@ -.button { - @apply w-12 h-12 justify-center rounded-full; -} - -/* The hover transition is inherited from the ClickableStyle component */ -.button:hover { - @apply text-white; - - background-color: var(--close-hover-color); -} - -.colorBrand { - --close-hover-color: var(--eds-color-brand-600); -} - -.colorNeutral { - --close-hover-color: var(--eds-color-neutral-600); -} - -.colorSuccess { - --close-hover-color: var(--eds-color-success-600); -} - -.colorWarning { - --close-hover-color: var(--eds-color-warning-600); -} - -.colorAlert { - --close-hover-color: var(--eds-color-alert-600); -} diff --git a/packages/components/src/CloseButton/CloseButton.spec.tsx b/packages/components/src/CloseButton/CloseButton.spec.tsx deleted file mode 100644 index b22d2a336..000000000 --- a/packages/components/src/CloseButton/CloseButton.spec.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import { generateSnapshots } from "@chanzuckerberg/story-utils"; -import { render, screen } from "@testing-library/react"; -import React from "react"; -import CloseButton from "./CloseButton"; -import * as CloseButtonStoryFile from "./CloseButton.stories"; - -describe("", () => { - generateSnapshots(CloseButtonStoryFile); - - it("forwards refs", () => { - const ref = React.createRef(); - render( console.log("closing...")} />); - - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - ref.current!.focus(); - - const button = screen.getByRole("button"); - expect(button).toHaveFocus(); - }); -}); diff --git a/packages/components/src/CloseButton/CloseButton.stories.tsx b/packages/components/src/CloseButton/CloseButton.stories.tsx deleted file mode 100644 index 50e348341..000000000 --- a/packages/components/src/CloseButton/CloseButton.stories.tsx +++ /dev/null @@ -1,42 +0,0 @@ -import { StoryObj } from "@storybook/react"; -import React from "react"; -import CloseButton from "./CloseButton"; - -export default { - title: "CloseButton", - component: CloseButton, - args: { - color: "brand", - }, -}; - -type Args = React.ComponentProps; - -export const Default: StoryObj = {}; - -export const SmallerSize: StoryObj = { - ...Default, - args: { - size: "1rem", - }, -}; - -export const DifferentColor: StoryObj = { - ...Default, - args: { - color: "alert", - }, -}; - -export const CustomAriaLabel: StoryObj = { - ...Default, - args: { - "aria-label": "close modal", - }, - parameters: { - chromatic: { - // This story is just for jest snapshot tests. - disableSnapshot: true, - }, - }, -}; diff --git a/packages/components/src/CloseButton/CloseButton.tsx b/packages/components/src/CloseButton/CloseButton.tsx deleted file mode 100644 index d719594c5..000000000 --- a/packages/components/src/CloseButton/CloseButton.tsx +++ /dev/null @@ -1,73 +0,0 @@ -import clsx from "clsx"; -import React, { forwardRef } from "react"; -import Button from "../Button"; -import CloseRoundedIcon from "../Icons/CloseRounded"; -import styles from "./CloseButton.module.css"; - -export type Variant = "brand" | "neutral" | "success" | "warning" | "alert"; - -type CloseButtonProps = { - /** - * The color theme of the icon. Also affects the hover state. - */ - color?: Variant; - /** - * Size of the icon. Does not affect actual button size. The button is larger than the - * icon to ensure the hit box is large enough (for accessibility). - * - * The string should be some number + px, rem, em, vh, etc. Ex: 2rem. - * Recommendation: use "EdsSizeLineHeight" tokens from - * @chanzuckerberg/eds-tokens/json/variables.json - */ - size?: string; - /** - * Custom aria-label. If undefined, "close" will be used. - */ - "aria-label"?: string; - onClose: () => void; - className?: string; -}; - -/** - * ```ts - * import {CloseButton} from "@chanzuckerberg/eds-components"; - * ``` - * - * Generic close button. - */ -const CloseButton = forwardRef( - ( - { - className, - color = "neutral", - onClose, - size = "2rem", - "aria-label": ariaLabel = "close", - ...rest - }, - ref, - ) => ( - - ), -); -CloseButton.displayName = "CloseButton"; - -export default CloseButton; diff --git a/packages/components/src/CloseButton/__snapshots__/CloseButton.spec.tsx.snap b/packages/components/src/CloseButton/__snapshots__/CloseButton.spec.tsx.snap deleted file mode 100644 index 256bb042b..000000000 --- a/packages/components/src/CloseButton/__snapshots__/CloseButton.spec.tsx.snap +++ /dev/null @@ -1,101 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[` CustomAriaLabel story renders snapshot 1`] = ` - -`; - -exports[` Default story renders snapshot 1`] = ` - -`; - -exports[` DifferentColor story renders snapshot 1`] = ` - -`; - -exports[` SmallerSize story renders snapshot 1`] = ` - -`; diff --git a/packages/components/src/CloseButton/index.ts b/packages/components/src/CloseButton/index.ts deleted file mode 100644 index 36de885f1..000000000 --- a/packages/components/src/CloseButton/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from "./CloseButton"; diff --git a/packages/components/src/index.ts b/packages/components/src/index.ts index ae605267f..94f633fbf 100644 --- a/packages/components/src/index.ts +++ b/packages/components/src/index.ts @@ -2,7 +2,6 @@ export { default as Banner } from "./Banner"; export { default as Button } from "./Button"; export { default as ButtonGroup } from "./ButtonGroup"; export { default as Checkbox } from "./Checkbox"; -export { default as CloseButton } from "./CloseButton"; export { default as ClickableStyle } from "./ClickableStyle"; export { default as Dropdown } from "./Dropdown"; export { default as DropdownButton } from "./DropdownButton";