Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(InfoBox): introduce #7352

Merged
merged 8 commits into from
Dec 24, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions apps/site/components/ApiDocs/StabilityIndex/index.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
.stabilityIndex {
AugustinMauroy marked this conversation as resolved.
Show resolved Hide resolved
@apply py-3
px-4
flex
flex-row
items-center
gap-2
text-white
rounded;

.indexLelvel {
@apply rounded-sm
text-sm
px-1.5;
}

&.stabilityLevel3 {
@apply bg-info-600;

.indexLelvel {
@apply bg-info-700;
}
}

&.stabilityLevel2 {
@apply bg-green-600;

.indexLelvel {
@apply bg-green-700;
}
}

&.stabilityLevel1 {
@apply bg-warning-600;

.indexLelvel {
@apply bg-warning-700;
}
}

&.stabilityLevel0 {
@apply bg-danger-600;

.indexLelvel {
@apply bg-danger-700;
}
}
}
37 changes: 37 additions & 0 deletions apps/site/components/ApiDocs/StabilityIndex/index.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import type { Meta as MetaObj, StoryObj } from '@storybook/react';


import StabilityIndex from '@/components/ApiDocs/StabilityIndex';

type Story = StoryObj<typeof StabilityIndex>;
type Meta = MetaObj<typeof StabilityIndex>;

export const Legacy: Story = {
args: {
level: 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.'
},
}

export const Stable: Story = {
args: {
level: 2,
children: 'Stable. Compatibility with the npm ecosystem is a high priority.'
},
}

export const Experimental: Story = {
args: {
level: 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:'
},
}

export const Deprecated: Story = {
args: {
level: 0,
children: 'Deprecated. The feature may emit warnings. Backward compatibility is not guaranteed.'
},
}

export default { component: StabilityIndex } as Meta;
19 changes: 19 additions & 0 deletions apps/site/components/ApiDocs/StabilityIndex/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import classNames from 'classnames';
import type { FC, PropsWithChildren } from 'react';

import styles from './index.module.css';

type StabilityIndexProps = PropsWithChildren<{
level: number;
AugustinMauroy marked this conversation as resolved.
Show resolved Hide resolved
}>;

const StabilityIndex: FC<StabilityIndexProps> = ({ level, children }) => (
<div className={classNames(styles.stabilityIndex, styles[`stabilityLevel${level}`])}>
<span
className={styles.indexLelvel}
AugustinMauroy marked this conversation as resolved.
Show resolved Hide resolved
AugustinMauroy marked this conversation as resolved.
Show resolved Hide resolved
>{level}</span>{children}
</div>
);


export default StabilityIndex;
2 changes: 1 addition & 1 deletion apps/site/next-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
/// <reference types="next/navigation-types/compat/navigation" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
Loading