From 36257a0c57121bb04d9bad9166f1d3d94f8e340e Mon Sep 17 00:00:00 2001 From: vladimir-cucu Date: Fri, 26 Apr 2024 13:03:02 +0300 Subject: [PATCH 1/4] fix: make EmptyState implementation consistent with Vanilla Framework --- src/components/EmptyState/EmptyState.stories.mdx | 4 ++-- src/components/EmptyState/EmptyState.test.tsx | 5 ++--- src/components/EmptyState/EmptyState.tsx | 13 +++++++++---- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/components/EmptyState/EmptyState.stories.mdx b/src/components/EmptyState/EmptyState.stories.mdx index bbbc13e98..0897c1baa 100644 --- a/src/components/EmptyState/EmptyState.stories.mdx +++ b/src/components/EmptyState/EmptyState.stories.mdx @@ -54,8 +54,8 @@ export const doNothing = () => {}; name="containers" style={{ opacity: 0.25, - height: "2.5rem", - width: "2.5rem", + height: "10rem", + width: "10rem", marginBottom: "1rem", }} /> diff --git a/src/components/EmptyState/EmptyState.test.tsx b/src/components/EmptyState/EmptyState.test.tsx index 3348b440e..28cf5fae1 100644 --- a/src/components/EmptyState/EmptyState.test.tsx +++ b/src/components/EmptyState/EmptyState.test.tsx @@ -6,9 +6,8 @@ import EmptyState from "./EmptyState"; describe("EmptyState ", () => { it("renders the title", () => { render(} />); - expect( - screen.getByRole("heading", { name: "Test title" }) - ).toBeInTheDocument(); + const title = screen.getByText("Test title"); + expect(title).toHaveClass("p-heading--4"); }); it("renders the image", () => { diff --git a/src/components/EmptyState/EmptyState.tsx b/src/components/EmptyState/EmptyState.tsx index 84a90c660..d1da06a2a 100644 --- a/src/components/EmptyState/EmptyState.tsx +++ b/src/components/EmptyState/EmptyState.tsx @@ -1,3 +1,4 @@ +import classNames from "classnames"; import React, { ReactNode, HTMLProps, ReactElement } from "react"; import { PropsWithSpread } from "types"; @@ -31,10 +32,14 @@ export const EmptyState = ({ ...props }: Props): ReactElement => { return ( -
- {image} -

{title}

- {children} +
+
+ {image} +
+
+

{title}

+ {children} +
); }; From a412239580a22fa11a24e00d5801711b65b35ff9 Mon Sep 17 00:00:00 2001 From: vladimir-cucu Date: Fri, 26 Apr 2024 17:48:04 +0300 Subject: [PATCH 2/4] fix: use image from assets in EmptyState storybook --- .../EmptyState/EmptyState.stories.mdx | 39 ++++++------------- 1 file changed, 12 insertions(+), 27 deletions(-) diff --git a/src/components/EmptyState/EmptyState.stories.mdx b/src/components/EmptyState/EmptyState.stories.mdx index 0897c1baa..fcd82d83b 100644 --- a/src/components/EmptyState/EmptyState.stories.mdx +++ b/src/components/EmptyState/EmptyState.stories.mdx @@ -6,6 +6,17 @@ import Button from "../Button"; +export const boxImage = ( + empty state +); + ### EmptyState This is a [React](https://reactjs.org/) component to represent an empty state. @@ -16,22 +27,6 @@ This is a [React](https://reactjs.org/) component to represent an empty state. ### Default -export const boxImage = ( - - - - - - - - - -); - {}; {() => ( - } + image={boxImage} title="No instances found" >

From 1668ab563c706e68f5a9b8436d398827fb243f53 Mon Sep 17 00:00:00 2001 From: vladimir-cucu Date: Fri, 26 Apr 2024 23:32:09 +0300 Subject: [PATCH 3/4] ci: test percy --- src/components/EmptyState/EmptyState.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/EmptyState/EmptyState.tsx b/src/components/EmptyState/EmptyState.tsx index d1da06a2a..e8b28e61c 100644 --- a/src/components/EmptyState/EmptyState.tsx +++ b/src/components/EmptyState/EmptyState.tsx @@ -24,6 +24,7 @@ export type Props = PropsWithSpread< HTMLProps >; +// test percy export const EmptyState = ({ children, className, From d2b2401d3d21bf700ace9fa71bee9a0501f9d514 Mon Sep 17 00:00:00 2001 From: vladimir-cucu Date: Fri, 26 Apr 2024 23:39:32 +0300 Subject: [PATCH 4/4] ci: test percy --- src/components/EmptyState/EmptyState.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/EmptyState/EmptyState.tsx b/src/components/EmptyState/EmptyState.tsx index e8b28e61c..d1da06a2a 100644 --- a/src/components/EmptyState/EmptyState.tsx +++ b/src/components/EmptyState/EmptyState.tsx @@ -24,7 +24,6 @@ export type Props = PropsWithSpread< HTMLProps >; -// test percy export const EmptyState = ({ children, className,