Skip to content

Commit

Permalink
Layout stories
Browse files Browse the repository at this point in the history
  • Loading branch information
riccardo-forina committed Dec 5, 2023
1 parent 344f877 commit 2a5cf30
Show file tree
Hide file tree
Showing 12 changed files with 707 additions and 175 deletions.
5 changes: 5 additions & 0 deletions ui/.storybook/preview-head.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<style>
html, body, #storybook-root {
height: 100%;
}
</style>
19 changes: 0 additions & 19 deletions ui/.storybook/preview.ts

This file was deleted.

32 changes: 32 additions & 0 deletions ui/.storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import NextIntlProvider from "@/app/[locale]/NextIntlProvider";
import { Page } from "@patternfly/react-core";
import type { Preview } from "@storybook/react";
import "../app/globals.css";
import messages from "../messages/en.json";

const preview: Preview = {
parameters: {
nextjs: {
appDirectory: true,
},
actions: { argTypesRegex: "^on[A-Z].*" },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},
layout: "fullscreen",
},
decorators: [
(Story) => (
<NextIntlProvider locale={"en"} messages={messages}>
<Page>
<Story />
</Page>
</NextIntlProvider>
),
],
};

export default preview;
81 changes: 81 additions & 0 deletions ui/app/[locale]/kafka/[kafkaId]/overview/ClusterCard.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import type { Meta, StoryObj } from "@storybook/react";

import { ClusterCard } from "./ClusterCard";

const meta: Meta<typeof ClusterCard> = {
component: ClusterCard,
};

export default meta;
type Story = StoryObj<typeof ClusterCard>;

export const WithData: Story = {
args: {
isLoading: false,
name: "my-kafka-cluster",
status: "ready",
brokersTotal: 9999,
brokersOnline: 9999,
consumerGroups: 9999,
kafkaVersion: "3.5.6",
messages: [
{
variant: "danger",
subject: { type: "broker", name: "Broker 1", id: "1" },
message:
"Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ab, accusantium amet consequuntur delectus dolor excepturi hic illum iure labore magnam nemo nobis non obcaecati odit officia qui quo saepe sapiente",
date: "2023-12-09T13:54:17.687Z",
},
{
variant: "warning",
subject: { type: "topic", name: "Pet-sales", id: "1" },
message:
"Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ab, accusantium amet consequuntur delectus dolor excepturi hic illum iure labore magnam nemo nobis non obcaecati odit officia qui quo saepe sapiente",
date: "2023-12-10T13:54:17.687Z",
},
{
variant: "warning",
subject: { type: "topic", name: "night-orders", id: "1" },
message:
"Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ab, accusantium amet consequuntur delectus dolor excepturi hic illum iure labore magnam nemo nobis non obcaecati odit officia qui quo saepe sapiente",
date: "2023-12-11T13:54:17.687Z",
},
{
variant: "danger",
subject: { type: "topic", name: "night-orders", id: "1" },
message:
"Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ab, accusantium amet consequuntur delectus dolor excepturi hic illum iure labore magnam nemo nobis non obcaecati odit officia qui quo saepe sapiente",
date: "2023-12-12T13:54:17.687Z",
},
{
variant: "danger",
subject: {
type: "topic",
name: "very-very-very-long-name-that-will-cause-problems",
id: "1",
},
message:
"Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ab, accusantium amet consequuntur delectus dolor excepturi hic illum iure labore magnam nemo nobis non obcaecati odit officia qui quo saepe sapiente",
date: "2023-12-13T13:54:17.687Z",
},
],
},
};

export const NoMessages: Story = {
args: {
isLoading: false,
name: "my-kafka-cluster",
status: "ready",
brokersTotal: 9999,
brokersOnline: 9999,
consumerGroups: 9999,
kafkaVersion: "3.5.6",
messages: [],
},
};
export const Loading: Story = {
args: {
isLoading: true,
},
};
Loading

0 comments on commit 2a5cf30

Please sign in to comment.