From bd5b1d29d3304fbdb5b7cc3c4132bc0613a7d91f Mon Sep 17 00:00:00 2001 From: Kyrylo Shmidt Date: Wed, 28 Feb 2024 11:18:05 +0100 Subject: [PATCH] Add InsightCard list item and pagination components Improve styles --- .../InsightCard/InsightCard.stories.tsx | 4 +- .../InsightCard/InsightFooter/index.tsx | 0 .../AsyncTag/AsyncTag.stories.tsx | 2 +- .../InsightHeader}/AsyncTag/index.tsx | 0 .../InsightHeader}/AsyncTag/styles.ts | 4 +- .../InsightHeader/InisghtHeader.stories.tsx | 2 +- .../InsightCard}/InsightHeader/index.tsx | 14 +-- .../InsightCard}/InsightHeader/styles.ts | 0 .../InsightCard}/InsightHeader/types.ts | 0 .../KeyValue/KeyValue.stories.tsx | 2 +- .../KeyValueContainer/KeyValue/index.tsx | 0 .../KeyValueContainer/KeyValue/styles.ts | 0 .../KeyValueContainer/KeyValue/types.ts | 0 .../KeyValueContainer.stories.tsx | 2 +- .../KeyValueContainer/KeyValueContainer.tsx | 0 .../InsightCard}/KeyValueContainer/index.tsx | 0 .../InsightCard}/KeyValueContainer/styles.ts | 0 .../InsightCard}/KeyValueContainer/types.ts | 0 .../InsightCard/ListItem/ListItem.stories.tsx | 35 +++++++ .../common/InsightCard/ListItem/index.tsx | 27 ++++++ .../common/InsightCard/ListItem/styles.ts | 29 ++++++ .../common/InsightCard/ListItem/types.ts | 8 ++ .../common}/InsightCard/index.tsx | 26 ++--- .../common}/InsightCard/styles.ts | 0 .../common}/InsightCard/types.ts | 2 +- .../HighNumberOfQueriesInsight.stories.tsx | 2 +- .../HighNumberOfQueriesInsight/index.tsx | 10 +- .../insights/SpanNexusInsight/index.tsx | 6 +- src/components/common/App/themes/darkTheme.ts | 3 +- .../common/App/themes/lightTheme.ts | 3 +- src/components/common/App/typographies.ts | 61 +++++++++--- .../common/icons/12px/ChevronIcon.tsx | 40 ++++++++ .../v3/Pagination/Pagination.stories.tsx | 50 ++++++++++ src/components/common/v3/Pagination/index.tsx | 95 +++++++++++++++++++ src/components/common/v3/Pagination/styles.ts | 44 +++++++++ src/components/common/v3/Pagination/types.ts | 8 ++ src/components/common/v3/Tooltip/index.tsx | 2 +- src/components/common/v3/Tooltip/styles.ts | 9 +- src/styled.d.ts | 7 +- 39 files changed, 432 insertions(+), 65 deletions(-) rename src/components/{common/v3 => Insights/common}/InsightCard/InsightCard.stories.tsx (83%) rename src/components/{common/v3 => Insights/common}/InsightCard/InsightFooter/index.tsx (100%) rename src/components/{common/v3 => Insights/common/InsightCard/InsightHeader}/AsyncTag/AsyncTag.stories.tsx (88%) rename src/components/{common/v3 => Insights/common/InsightCard/InsightHeader}/AsyncTag/index.tsx (100%) rename src/components/{common/v3 => Insights/common/InsightCard/InsightHeader}/AsyncTag/styles.ts (55%) rename src/components/{common/v3 => Insights/common/InsightCard}/InsightHeader/InisghtHeader.stories.tsx (92%) rename src/components/{common/v3 => Insights/common/InsightCard}/InsightHeader/index.tsx (75%) rename src/components/{common/v3 => Insights/common/InsightCard}/InsightHeader/styles.ts (100%) rename src/components/{common/v3 => Insights/common/InsightCard}/InsightHeader/types.ts (100%) rename src/components/{common/v3 => Insights/common/InsightCard}/KeyValueContainer/KeyValue/KeyValue.stories.tsx (89%) rename src/components/{common/v3 => Insights/common/InsightCard}/KeyValueContainer/KeyValue/index.tsx (100%) rename src/components/{common/v3 => Insights/common/InsightCard}/KeyValueContainer/KeyValue/styles.ts (100%) rename src/components/{common/v3 => Insights/common/InsightCard}/KeyValueContainer/KeyValue/types.ts (100%) rename src/components/{common/v3 => Insights/common/InsightCard}/KeyValueContainer/KeyValueContainer.stories.tsx (92%) rename src/components/{common/v3 => Insights/common/InsightCard}/KeyValueContainer/KeyValueContainer.tsx (100%) rename src/components/{common/v3 => Insights/common/InsightCard}/KeyValueContainer/index.tsx (100%) rename src/components/{common/v3 => Insights/common/InsightCard}/KeyValueContainer/styles.ts (100%) rename src/components/{common/v3 => Insights/common/InsightCard}/KeyValueContainer/types.ts (100%) create mode 100644 src/components/Insights/common/InsightCard/ListItem/ListItem.stories.tsx create mode 100644 src/components/Insights/common/InsightCard/ListItem/index.tsx create mode 100644 src/components/Insights/common/InsightCard/ListItem/styles.ts create mode 100644 src/components/Insights/common/InsightCard/ListItem/types.ts rename src/components/{common/v3 => Insights/common}/InsightCard/index.tsx (84%) rename src/components/{common/v3 => Insights/common}/InsightCard/styles.ts (100%) rename src/components/{common/v3 => Insights/common}/InsightCard/types.ts (91%) create mode 100644 src/components/common/icons/12px/ChevronIcon.tsx create mode 100644 src/components/common/v3/Pagination/Pagination.stories.tsx create mode 100644 src/components/common/v3/Pagination/index.tsx create mode 100644 src/components/common/v3/Pagination/styles.ts create mode 100644 src/components/common/v3/Pagination/types.ts diff --git a/src/components/common/v3/InsightCard/InsightCard.stories.tsx b/src/components/Insights/common/InsightCard/InsightCard.stories.tsx similarity index 83% rename from src/components/common/v3/InsightCard/InsightCard.stories.tsx rename to src/components/Insights/common/InsightCard/InsightCard.stories.tsx index 6e90721f2..ab6039315 100644 --- a/src/components/common/v3/InsightCard/InsightCard.stories.tsx +++ b/src/components/Insights/common/InsightCard/InsightCard.stories.tsx @@ -1,10 +1,10 @@ import { Meta, StoryObj } from "@storybook/react"; import { InsightCard } from "."; -import { mockedEndpointNPlusOneInsight } from "../../../Insights/EndpointNPlusOneInsight/mockData"; +import { mockedEndpointNPlusOneInsight } from "../../EndpointNPlusOneInsight/mockData"; // More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction const meta: Meta = { - title: "Common/v3/InsightCard", + title: "Insights/common/InsightCard", component: InsightCard, parameters: { // More on how to position stories at: https://storybook.js.org/docs/react/configure/story-layout diff --git a/src/components/common/v3/InsightCard/InsightFooter/index.tsx b/src/components/Insights/common/InsightCard/InsightFooter/index.tsx similarity index 100% rename from src/components/common/v3/InsightCard/InsightFooter/index.tsx rename to src/components/Insights/common/InsightCard/InsightFooter/index.tsx diff --git a/src/components/common/v3/AsyncTag/AsyncTag.stories.tsx b/src/components/Insights/common/InsightCard/InsightHeader/AsyncTag/AsyncTag.stories.tsx similarity index 88% rename from src/components/common/v3/AsyncTag/AsyncTag.stories.tsx rename to src/components/Insights/common/InsightCard/InsightHeader/AsyncTag/AsyncTag.stories.tsx index 5a508ea73..053010ece 100644 --- a/src/components/common/v3/AsyncTag/AsyncTag.stories.tsx +++ b/src/components/Insights/common/InsightCard/InsightHeader/AsyncTag/AsyncTag.stories.tsx @@ -3,7 +3,7 @@ import { AsyncTag } from "."; // More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction const meta: Meta = { - title: "common/v3/AsyncTag", + title: "Insights/common/InsightCard/InsightHeader/AsyncTag", component: AsyncTag, parameters: { // More on how to position stories at: https://storybook.js.org/docs/react/configure/story-layout diff --git a/src/components/common/v3/AsyncTag/index.tsx b/src/components/Insights/common/InsightCard/InsightHeader/AsyncTag/index.tsx similarity index 100% rename from src/components/common/v3/AsyncTag/index.tsx rename to src/components/Insights/common/InsightCard/InsightHeader/AsyncTag/index.tsx diff --git a/src/components/common/v3/AsyncTag/styles.ts b/src/components/Insights/common/InsightCard/InsightHeader/AsyncTag/styles.ts similarity index 55% rename from src/components/common/v3/AsyncTag/styles.ts rename to src/components/Insights/common/InsightCard/InsightHeader/AsyncTag/styles.ts index 507738aa6..c557d044a 100644 --- a/src/components/common/v3/AsyncTag/styles.ts +++ b/src/components/Insights/common/InsightCard/InsightHeader/AsyncTag/styles.ts @@ -1,8 +1,8 @@ import styled from "styled-components"; -import { Tag as TagCommon } from "../Tag"; +import { Tag as TagCommon } from "../../../../../common/v3/Tag"; export const AsyncTag = styled(TagCommon)` color: ${({ theme }) => theme.colors.v3.text.primary}; - background: ${({ theme }) => theme.colors.v3.surface.asyncTag}; + background: ${({ theme }) => theme.colors.v3.surface.brandDark}; font-size: 12px; `; diff --git a/src/components/common/v3/InsightHeader/InisghtHeader.stories.tsx b/src/components/Insights/common/InsightCard/InsightHeader/InisghtHeader.stories.tsx similarity index 92% rename from src/components/common/v3/InsightHeader/InisghtHeader.stories.tsx rename to src/components/Insights/common/InsightCard/InsightHeader/InisghtHeader.stories.tsx index bb9884162..a20987bf2 100644 --- a/src/components/common/v3/InsightHeader/InisghtHeader.stories.tsx +++ b/src/components/Insights/common/InsightCard/InsightHeader/InisghtHeader.stories.tsx @@ -3,7 +3,7 @@ import { InsightHeader } from "."; // More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction const meta: Meta = { - title: "Common/v3/InsightsHeader", + title: "Insights/common/InsightCard/InsightHeader", component: InsightHeader, parameters: { // More on how to position stories at: https://storybook.js.org/docs/react/configure/story-layout diff --git a/src/components/common/v3/InsightHeader/index.tsx b/src/components/Insights/common/InsightCard/InsightHeader/index.tsx similarity index 75% rename from src/components/common/v3/InsightHeader/index.tsx rename to src/components/Insights/common/InsightCard/InsightHeader/index.tsx index 2e215aed0..99577dbd3 100644 --- a/src/components/common/v3/InsightHeader/index.tsx +++ b/src/components/Insights/common/InsightCard/InsightHeader/index.tsx @@ -1,10 +1,10 @@ -import { getInsightTypeInfo } from "../../../../utils/getInsightTypeInfo"; -import { InfoCircleIcon } from "../../icons/InfoCircleIcon"; -import { AsyncTag } from "../AsyncTag"; -import { NewTag } from "../NewTag"; -import { Tag } from "../Tag"; -import { TagType } from "../Tag/types"; -import { Tooltip } from "../Tooltip"; +import { getInsightTypeInfo } from "../../../../../utils/getInsightTypeInfo"; +import { InfoCircleIcon } from "../../../../common/icons/InfoCircleIcon"; +import { NewTag } from "../../../../common/v3/NewTag"; +import { Tag } from "../../../../common/v3/Tag"; +import { TagType } from "../../../../common/v3/Tag/types"; +import { Tooltip } from "../../../../common/v3/Tooltip"; +import { AsyncTag } from "./AsyncTag"; import * as s from "./styles"; import { InsightHeaderProps } from "./types"; diff --git a/src/components/common/v3/InsightHeader/styles.ts b/src/components/Insights/common/InsightCard/InsightHeader/styles.ts similarity index 100% rename from src/components/common/v3/InsightHeader/styles.ts rename to src/components/Insights/common/InsightCard/InsightHeader/styles.ts diff --git a/src/components/common/v3/InsightHeader/types.ts b/src/components/Insights/common/InsightCard/InsightHeader/types.ts similarity index 100% rename from src/components/common/v3/InsightHeader/types.ts rename to src/components/Insights/common/InsightCard/InsightHeader/types.ts diff --git a/src/components/common/v3/KeyValueContainer/KeyValue/KeyValue.stories.tsx b/src/components/Insights/common/InsightCard/KeyValueContainer/KeyValue/KeyValue.stories.tsx similarity index 89% rename from src/components/common/v3/KeyValueContainer/KeyValue/KeyValue.stories.tsx rename to src/components/Insights/common/InsightCard/KeyValueContainer/KeyValue/KeyValue.stories.tsx index 3a56b7ea6..c80dfdfdc 100644 --- a/src/components/common/v3/KeyValueContainer/KeyValue/KeyValue.stories.tsx +++ b/src/components/Insights/common/InsightCard/KeyValueContainer/KeyValue/KeyValue.stories.tsx @@ -3,7 +3,7 @@ import { KeyValue } from "."; // More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction const meta: Meta = { - title: "common/v3/KeyValue", + title: "Insights/common/InsightCard/KeyValueContainer/KeyValue", component: KeyValue, parameters: { // More on how to position stories at: https://storybook.js.org/docs/react/configure/story-layout diff --git a/src/components/common/v3/KeyValueContainer/KeyValue/index.tsx b/src/components/Insights/common/InsightCard/KeyValueContainer/KeyValue/index.tsx similarity index 100% rename from src/components/common/v3/KeyValueContainer/KeyValue/index.tsx rename to src/components/Insights/common/InsightCard/KeyValueContainer/KeyValue/index.tsx diff --git a/src/components/common/v3/KeyValueContainer/KeyValue/styles.ts b/src/components/Insights/common/InsightCard/KeyValueContainer/KeyValue/styles.ts similarity index 100% rename from src/components/common/v3/KeyValueContainer/KeyValue/styles.ts rename to src/components/Insights/common/InsightCard/KeyValueContainer/KeyValue/styles.ts diff --git a/src/components/common/v3/KeyValueContainer/KeyValue/types.ts b/src/components/Insights/common/InsightCard/KeyValueContainer/KeyValue/types.ts similarity index 100% rename from src/components/common/v3/KeyValueContainer/KeyValue/types.ts rename to src/components/Insights/common/InsightCard/KeyValueContainer/KeyValue/types.ts diff --git a/src/components/common/v3/KeyValueContainer/KeyValueContainer.stories.tsx b/src/components/Insights/common/InsightCard/KeyValueContainer/KeyValueContainer.stories.tsx similarity index 92% rename from src/components/common/v3/KeyValueContainer/KeyValueContainer.stories.tsx rename to src/components/Insights/common/InsightCard/KeyValueContainer/KeyValueContainer.stories.tsx index ef2fe80f4..b8d7599f8 100644 --- a/src/components/common/v3/KeyValueContainer/KeyValueContainer.stories.tsx +++ b/src/components/Insights/common/InsightCard/KeyValueContainer/KeyValueContainer.stories.tsx @@ -3,7 +3,7 @@ import { KeyValue, KeyValueContainer } from "."; // More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction const meta: Meta = { - title: "common/v3/KeyValueContainer", + title: "Insights/common/InsightCard/KeyValueContainer", component: KeyValueContainer, parameters: { // More on how to position stories at: https://storybook.js.org/docs/react/configure/story-layout diff --git a/src/components/common/v3/KeyValueContainer/KeyValueContainer.tsx b/src/components/Insights/common/InsightCard/KeyValueContainer/KeyValueContainer.tsx similarity index 100% rename from src/components/common/v3/KeyValueContainer/KeyValueContainer.tsx rename to src/components/Insights/common/InsightCard/KeyValueContainer/KeyValueContainer.tsx diff --git a/src/components/common/v3/KeyValueContainer/index.tsx b/src/components/Insights/common/InsightCard/KeyValueContainer/index.tsx similarity index 100% rename from src/components/common/v3/KeyValueContainer/index.tsx rename to src/components/Insights/common/InsightCard/KeyValueContainer/index.tsx diff --git a/src/components/common/v3/KeyValueContainer/styles.ts b/src/components/Insights/common/InsightCard/KeyValueContainer/styles.ts similarity index 100% rename from src/components/common/v3/KeyValueContainer/styles.ts rename to src/components/Insights/common/InsightCard/KeyValueContainer/styles.ts diff --git a/src/components/common/v3/KeyValueContainer/types.ts b/src/components/Insights/common/InsightCard/KeyValueContainer/types.ts similarity index 100% rename from src/components/common/v3/KeyValueContainer/types.ts rename to src/components/Insights/common/InsightCard/KeyValueContainer/types.ts diff --git a/src/components/Insights/common/InsightCard/ListItem/ListItem.stories.tsx b/src/components/Insights/common/InsightCard/ListItem/ListItem.stories.tsx new file mode 100644 index 000000000..4600d0e24 --- /dev/null +++ b/src/components/Insights/common/InsightCard/ListItem/ListItem.stories.tsx @@ -0,0 +1,35 @@ +import { Meta, StoryObj } from "@storybook/react"; +import { ListItem } from "."; +import { Button } from "../../../../common/Button"; +import { JiraLogoIcon } from "../../../../common/icons/12px/JiraLogoIcon"; +import { TargetIcon } from "../../../../common/icons/12px/TargetIcon"; + +// More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction +const meta: Meta = { + title: "Insights/common/InsightCard/ListItem", + component: ListItem, + parameters: { + // More on how to position stories at: https://storybook.js.org/docs/react/configure/story-layout + layout: "fullscreen" + } +}; + +export default meta; + +type Story = StoryObj; + +export const Default: Story = { + args: { + name: "Very very very very very very very very long text" + } +}; + +export const WithButtons: Story = { + args: { + name: "Very very very very very very very very long text", + buttons: [ +