import {Fragment, useState} from 'react';
import AlertLink from 'sentry/components/alertLink';
import JSXNode from 'sentry/components/stories/jsxNode';
import JSXProperty from 'sentry/components/stories/jsxProperty';
import {IconSentry} from 'sentry/icons';
import storyBook from 'sentry/stories/storyBook';
export default storyBook(AlertLink, story => {
story('Default', () => {
return (
The component is a highlighted banner that links to
some other page (or component). Depending on the{' '}
prop specified, it can be used as a
success alert, an error or warning alert, and for various other use cases.
The default looks like this:
Clicking this link will not open in a new tab!
The default props are ,{' '}
,{' '}
, and{' '}
.
This alert below has :
Clicking this link WILL open in a new tab!
);
});
story('priority', () => {
return (
The prop specifies the alert category, and
changes the color of the alert.
This is an error alert. Something went wrong.
Info alert. Put some exciting info here.
Muted alerts look like this.
Success alert. Yay!
Warning alert. Something is about to go wrong, probably.
);
});
story('icon', () => {
return (
The prop can be specified if you want to add
an icon to the alert. Just directly pass in the icon, like{' '}
for example, to the prop.
}>
Read the docs.
);
});
story('withoutMarginBottom', () => {
return (
The prop is a boolean that's{' '}
false
by default.
This one has no bottom margin.
This one has bottom margin by default.
This one has no margin bottom.
);
});
story('size', () => {
return (
The prop can be either "small"
or{' '}
"normal"
.{' '}
Normal
Small
);
});
story('to vs href vs onClick', () => {
const [count, setCount] = useState(0);
return (
There are three ways to specify what should happen when the{' '}
is clicked.{' '}
The prop should be used for internal links.
Note: links specified with this prop will never open in a new tab, even if you
set
.
View the badge story page
The prop should be used for external links.
Learn more about Session Replay
Lastly, you can get creative with the prop.
setCount(count + 1)}>
You clicked this {count} times.
);
});
});