diff --git a/components/Common/Banner/index.module.scss b/components/Common/Banner/index.module.scss new file mode 100644 index 0000000000000..44d51be49180e --- /dev/null +++ b/components/Common/Banner/index.module.scss @@ -0,0 +1,23 @@ +.banner { + @apply text-sm text-white flex flex-row items-center justify-center gap-2 py-3 w-full; + + a { + @apply underline; + } + + svg { + @apply h-4 w-4; + } +} + +.default { + @apply bg-green-600; +} + +.error { + @apply bg-danger-600; +} + +.warning { + @apply bg-warning-600; +} diff --git a/components/Common/Banner/index.stories.tsx b/components/Common/Banner/index.stories.tsx new file mode 100644 index 0000000000000..745ab943274e2 --- /dev/null +++ b/components/Common/Banner/index.stories.tsx @@ -0,0 +1,45 @@ +import type { Meta as MetaObj, StoryObj } from '@storybook/react'; +import Banner from './'; + +type Story = StoryObj; +type Meta = MetaObj; + +export const Default: Story = { + args: { + text: 'Nodejs collaborator summitNode.js Collaborator Summit 2023 - Bilbao, Spain (OpenJS World EU) 2023', + type: 'default', + url: 'https://github.com/openjs-foundation/summit/issues/360', + }, +}; + +export const Error: Story = { + args: { + text: 'STOP creating issue for error 500 on download', + type: 'error', + url: 'https://github.com/nodejs/nodejs.org/issues/4495', + }, +}; + +export const Warning: Story = { + args: { + text: 'STOP creating issue for error 500 on download', + type: 'warning', + url: 'https://github.com/nodejs/nodejs.org/issues/4495', + }, +}; + +export const NoLink: Story = { + args: { + text: 'Claudio is the best maintainer', + type: 'default', + }, +}; + +export const NoType: Story = { + args: { + text: 'Claudio is the best maintainer', + url: 'https://github.com/ovflowd', + }, +}; + +export default { component: Banner } as Meta; diff --git a/components/Common/Banner/index.tsx b/components/Common/Banner/index.tsx new file mode 100644 index 0000000000000..655747f3e33a5 --- /dev/null +++ b/components/Common/Banner/index.tsx @@ -0,0 +1,20 @@ +import LocalizedLink from '@/components/LocalizedLink'; +import { ArrowUpRightIcon } from '@heroicons/react/24/outline'; +import styles from './index.module.scss'; +import type { FC } from 'react'; + +type BannerProps = { + type: 'default' | 'error' | 'warning'; + text: string; + url?: string; +}; + +const Banner: FC = ({ type, text, url = '' }) => ( +
+ {(url.length > 0 && {text}) || + text} + {url.length > 0 && } +
+); + +export default Banner;