diff --git a/dashboard/components/card-primary/CardPrimary.mock.tsx b/dashboard/components/card-primary/CardPrimary.mock.tsx new file mode 100644 index 000000000..9b6a9386e --- /dev/null +++ b/dashboard/components/card-primary/CardPrimary.mock.tsx @@ -0,0 +1,14 @@ +import { CardPrimaryProps } from './CardPrimary'; + +const base: CardPrimaryProps = { + title: 'Introducing Tailwarden', + description: + 'Tailwarden is the cloud version of Komiser, which offers more features and insights', + type: 'shadow' +}; + +const mockCardPrimaryProps = { + base +}; + +export default mockCardPrimaryProps; diff --git a/dashboard/components/card-primary/CardPrimary.stories.tsx b/dashboard/components/card-primary/CardPrimary.stories.tsx new file mode 100644 index 000000000..15cf34e37 --- /dev/null +++ b/dashboard/components/card-primary/CardPrimary.stories.tsx @@ -0,0 +1,33 @@ +import type { Meta, StoryObj } from '@storybook/react'; +import CardPrimary from './CardPrimary'; +import mockCardPrimaryProps from './CardPrimary.mock'; + +// More on how to set up stories at: https://storybook.js.org/docs/7.0/react/writing-stories/introduction +const meta: Meta = { + title: 'Komiser/Card Primary', + component: CardPrimary, + tags: ['autodocs'], + argTypes: { + type: { + control: { + type: 'inline-radio' + } + }, + showButton: { + control: 'boolean' + }, + showAvatar: { + control: 'boolean' + } + } +}; + +export default meta; +type Story = StoryObj; + +// More on writing stories with args: https://storybook.js.org/docs/7.0/react/writing-stories/args +export const Primary: Story = { + args: { + ...mockCardPrimaryProps.base + } +}; diff --git a/dashboard/components/card-primary/CardPrimary.test.tsx b/dashboard/components/card-primary/CardPrimary.test.tsx new file mode 100644 index 000000000..d998a1912 --- /dev/null +++ b/dashboard/components/card-primary/CardPrimary.test.tsx @@ -0,0 +1,14 @@ +import { render, screen } from '@testing-library/react'; +import CardPrimary from './CardPrimary'; + +describe('Card', () => { + it('should render cta component without crashing', () => { + render( + + ); + }); +}); diff --git a/dashboard/components/card-primary/CardPrimary.tsx b/dashboard/components/card-primary/CardPrimary.tsx new file mode 100644 index 000000000..7d0ba6d55 --- /dev/null +++ b/dashboard/components/card-primary/CardPrimary.tsx @@ -0,0 +1,47 @@ +import React from 'react'; +import Image from 'next/image'; +import platform from '@utils/providerHelper'; +import { ChevronRightIcon } from '@components/icons'; + +export type CardPrimaryProps = { + title: string; + description: string; + showButton?: boolean; + showAvatar?: boolean; + type: 'shadow' | 'stroke'; +}; + +function CardPrimary({ + title, + description, + showButton = true, + showAvatar = true, + type = 'stroke' +}: CardPrimaryProps) { + const base = `flex items-center justify-between gap-2 rounded-lg bg-white p-6 border-gray-200 ${ + type === 'shadow' ? 'border-b ' : 'border`' + }`; + + return ( +
+
+ {showAvatar && ( + Purplin thinking + )} + +
+

{title}

+

{description}

+
+
+ {showButton && } +
+ ); +} + +export default CardPrimary; diff --git a/dashboard/components/card/Card.mocks.tsx b/dashboard/components/card/Card.mocks.tsx index e012a56ec..ed8dbad5d 100644 --- a/dashboard/components/card/Card.mocks.tsx +++ b/dashboard/components/card/Card.mocks.tsx @@ -1,4 +1,5 @@ import { CardProps } from './Card'; +import { CtaProps } from '../cta/Cta'; const base: CardProps = { label: 'Blop', diff --git a/dashboard/components/cta/Cta.mock.tsx b/dashboard/components/cta/Cta.mock.tsx new file mode 100644 index 000000000..e92fea82c --- /dev/null +++ b/dashboard/components/cta/Cta.mock.tsx @@ -0,0 +1,33 @@ +import { CtaProps } from './Cta'; + +const base: CtaProps = { + title: 'Introducing Tailwarden', + description: + 'Tailwarden is the cloud version of Komiser, which offers more features and insights', + action: ( + + ) +}; + +const mockCTaProps = { + base +}; + +export default mockCTaProps; diff --git a/dashboard/components/cta/Cta.stories.tsx b/dashboard/components/cta/Cta.stories.tsx new file mode 100644 index 000000000..0f996857a --- /dev/null +++ b/dashboard/components/cta/Cta.stories.tsx @@ -0,0 +1,25 @@ +import type { Meta, StoryObj } from '@storybook/react'; +import mockCtaProps from './Cta.mock'; +import Cta from './Cta'; + +// More on how to set up stories at: https://storybook.js.org/docs/7.0/react/writing-stories/introduction +const meta: Meta = { + title: 'Komiser/Cta', + component: Cta, + tags: ['autodocs'], + argTypes: { + action: { + control: 'hidden' + } + } +}; + +export default meta; +type Story = StoryObj; + +// More on writing stories with args: https://storybook.js.org/docs/7.0/react/writing-stories/args +export const Primary: Story = { + args: { + ...mockCtaProps.base + } +}; diff --git a/dashboard/components/cta/Cta.test.tsx b/dashboard/components/cta/Cta.test.tsx new file mode 100644 index 000000000..04177f9f4 --- /dev/null +++ b/dashboard/components/cta/Cta.test.tsx @@ -0,0 +1,27 @@ +import { render, screen } from '@testing-library/react'; +import { RefreshIcon } from '@components/icons'; +import Cta from './Cta'; + +describe('Card', () => { + it('should render cta component without crashing', () => { + render( + } + /> + ); + }); + + it('should render the action', () => { + render( + } + /> + ); + const action = screen.getByTestId('action'); + expect(action).toBeInTheDocument(); + }); +}); diff --git a/dashboard/components/cta/Cta.tsx b/dashboard/components/cta/Cta.tsx new file mode 100644 index 000000000..9ee0fe8d3 --- /dev/null +++ b/dashboard/components/cta/Cta.tsx @@ -0,0 +1,31 @@ +import React from 'react'; +import Image from 'next/image'; + +export type CtaProps = { + title: string; + description: string; + action: React.ReactNode; +}; + +function Cta({ title, description, action }: CtaProps) { + return ( +
+
+
+

{title}

+

{description}

+
+ {action} +
+ Purplin thinking +
+ ); +} + +export default Cta; diff --git a/dashboard/styles/globals.css b/dashboard/styles/globals.css index 1578917f7..183a948a0 100644 --- a/dashboard/styles/globals.css +++ b/dashboard/styles/globals.css @@ -75,3 +75,10 @@ padding-right: 16px; padding-left: 16px; } + +.gradient-border:hover { + background: + linear-gradient(white, white) padding-box, + linear-gradient(to top right, #a107ea, #5000b5) border-box; + border-color: transparent; +}