-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
737cfc7
commit 0cefe24
Showing
6 changed files
with
125 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 0 additions & 40 deletions
40
apps/site/components/ApiDocs/StabilityIndex/index.stories.tsx
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
39 changes: 27 additions & 12 deletions
39
...s/ApiDocs/StabilityIndex/index.module.css → ...omponents/Common/InfoBox/index.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import { ExclamationCircleIcon } from '@heroicons/react/24/solid'; | ||
import type { Meta as MetaObj, StoryObj } from '@storybook/react'; | ||
|
||
import InfoBox from '@/components/Common/InfoBox'; | ||
|
||
type Story = StoryObj<typeof InfoBox>; | ||
type Meta = MetaObj<typeof InfoBox>; | ||
|
||
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 Error: Story = { | ||
args: { | ||
level: 'error', | ||
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: ( | ||
<p> | ||
Lorem ipsum dolor sit amet <ExclamationCircleIcon /> 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! | ||
</p> | ||
), | ||
size: 'default', | ||
}, | ||
}; | ||
|
||
export default { | ||
component: InfoBox, | ||
argTypes: { | ||
size: { | ||
options: ['default', 'small'], | ||
control: { type: 'radio' }, | ||
}, | ||
}, | ||
} as Meta; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import classNames from 'classnames'; | ||
import type { FC, PropsWithChildren } from 'react'; | ||
|
||
import styles from './index.module.css'; | ||
|
||
type InfoBoxProps = PropsWithChildren<{ | ||
level: 'info' | 'success' | 'warning' | 'error'; | ||
title: string; | ||
size?: 'default' | 'small'; | ||
}>; | ||
|
||
const InfoBox: FC<InfoBoxProps> = ({ | ||
level, | ||
title, | ||
children, | ||
size = 'default', | ||
}) => ( | ||
<div className={classNames(styles.infoBox, styles[level], styles[size])}> | ||
<span className={styles.title}>{title}</span> | ||
{children} | ||
</div> | ||
); | ||
|
||
export default InfoBox; |