diff --git a/apps/site/components/Common/AlertBox/index.module.css b/apps/site/components/Common/AlertBox/index.module.css new file mode 100644 index 0000000000000..3714979473e5d --- /dev/null +++ b/apps/site/components/Common/AlertBox/index.module.css @@ -0,0 +1,73 @@ +.alertBox { + @apply flex + flex-row + items-center + gap-2 + rounded + px-4 + py-3 + text-sm + text-white; + + a { + @apply font-ibm-plex-mono + text-white + underline; + + &:hover { + @apply no-underline; + } + } + + &.small { + @apply gap-1 + py-2 + text-xs; + + .title { + @apply px-1; + } + } + + .title { + @apply rounded-sm + px-1.5; + } + + svg { + @apply inline + size-5; + } + + &.info { + @apply bg-info-600; + + .title { + @apply bg-info-700; + } + } + + &.success { + @apply bg-green-600; + + .title { + @apply bg-green-700; + } + } + + &.warning { + @apply bg-warning-600; + + .title { + @apply bg-warning-700; + } + } + + &.danger { + @apply bg-danger-600; + + .title { + @apply bg-danger-700; + } + } +} diff --git a/apps/site/components/Common/AlertBox/index.stories.tsx b/apps/site/components/Common/AlertBox/index.stories.tsx new file mode 100644 index 0000000000000..e5b5340faba61 --- /dev/null +++ b/apps/site/components/Common/AlertBox/index.stories.tsx @@ -0,0 +1,73 @@ +import { ExclamationCircleIcon } from '@heroicons/react/24/solid'; +import type { Meta as MetaObj, StoryObj } from '@storybook/react'; + +import AlertBox from '@/components/Common/AlertBox'; + +type Story = StoryObj; +type Meta = MetaObj; + +export const Info: Story = { + args: { + level: 'info', + title: '3', + children: + 'Legacy. Although this feature is unlikely to be removed and is still covered by semantic versioning guarantees, it is no longer actively maintained, and other alternatives are available.', + size: 'default', + }, +}; + +export const Success: Story = { + args: { + level: 'success', + title: '2', + children: + 'Stable. Compatibility with the npm ecosystem is a high priority.', + size: 'default', + }, +}; + +export const Warning: Story = { + args: { + level: 'warning', + title: '1', + children: + 'Experimental. The feature is not subject to semantic versioning rules. Non-backward compatible changes or removal may occur in any future release. Use of the feature is not recommended in production environments. Experimental features are subdivided into stages:', + size: 'default', + }, +}; + +export const Danger: Story = { + args: { + level: 'danger', + title: '0', + children: + 'Deprecated. The feature may emit warnings. Backward compatibility is not guaranteed.', + size: 'default', + }, +}; + +export const WithIcon: Story = { + args: { + level: 'info', + title: '3', + children: ( +

+ Lorem ipsum dolor sit amet consectetur + adipisicing elit. Inventore, quasi doloremque. Totam, earum velit, sunt + voluptates fugiat beatae praesentium quis magni explicabo repudiandae + nam aut molestias ex ad sequi eum! +

+ ), + size: 'default', + }, +}; + +export default { + component: AlertBox, + argTypes: { + size: { + options: ['default', 'small'], + control: { type: 'radio' }, + }, + }, +} as Meta; diff --git a/apps/site/components/Common/AlertBox/index.tsx b/apps/site/components/Common/AlertBox/index.tsx new file mode 100644 index 0000000000000..1e0b78844935a --- /dev/null +++ b/apps/site/components/Common/AlertBox/index.tsx @@ -0,0 +1,24 @@ +import classNames from 'classnames'; +import type { FC, PropsWithChildren } from 'react'; + +import styles from './index.module.css'; + +type AlertBoxProps = PropsWithChildren<{ + level: 'info' | 'success' | 'warning' | 'danger'; + title: string; + size?: 'default' | 'small'; +}>; + +const AlertBox: FC = ({ + level, + title, + children, + size = 'default', +}) => ( +
+ {title} + {children} +
+); + +export default AlertBox; diff --git a/apps/site/next-env.d.ts b/apps/site/next-env.d.ts deleted file mode 100644 index 725dd6f245153..0000000000000 --- a/apps/site/next-env.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -/// -/// -/// - -// NOTE: This file should not be edited -// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.