123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- import {Fragment} from 'react';
- import {Button} from 'sentry/components/button';
- import FieldGroup from 'sentry/components/forms/fieldGroup';
- import {
- Panel,
- PanelAlert,
- PanelBody,
- PanelHeader,
- PanelItem,
- PanelTable,
- } from 'sentry/components/panels';
- import {IconTelescope} from 'sentry/icons';
- import {_BulkController} from './bulkController.stories';
- export default {
- title: 'Components/Tables/Panels',
- args: {
- dashedBorder: false,
- },
- };
- export const BasicPanel = ({...args}) => (
- <Panel {...args}>
- <PanelHeader>Panel Header</PanelHeader>
- <PanelBody>
- <PanelItem>Panel Item</PanelItem>
- <PanelItem>Panel Item</PanelItem>
- <PanelItem>Panel Item</PanelItem>
- </PanelBody>
- </Panel>
- );
- BasicPanel.parameters = {
- docs: {
- description: {
- story: 'Basic Panel component used in most settings',
- },
- },
- };
- export const PanelAlerts = ({...args}) => (
- <Panel {...args}>
- <PanelHeader>Panel Header</PanelHeader>
- <PanelBody>
- <PanelAlert type="info">Info Alert message</PanelAlert>
- <PanelAlert type="error">Error Alert message</PanelAlert>
- <PanelAlert type="warning">Warning Alert message</PanelAlert>
- <PanelAlert type="success">Success Alert message</PanelAlert>
- <PanelAlert type="info" icon={<IconTelescope size="md" />}>
- Custom Icon message
- </PanelAlert>
- <PanelItem>Panel Item</PanelItem>
- </PanelBody>
- </Panel>
- );
- PanelAlerts.parameters = {
- docs: {
- description: {
- story: 'Alert boxes inside a panel',
- },
- },
- };
- export const _PanelTable = () => (
- <Fragment>
- <PanelTable
- // eslint-disable-next-line react/jsx-key
- headers={[<div>Header #1</div>, 'Header #2', <div>Custom Header Wooooo</div>, '']}
- >
- <div>Panel Item with really long content</div>
- <div>Panel Item</div>
- <div>Panel Item</div>
- <div>Panel Item</div>
- <div>Panel Item</div>
- <div>Panel Item</div>
- <div>Panel Item</div>
- <div>Panel Item</div>
- <div>Panel Item</div>
- <div>Panel Item</div>
- <div>Panel Item</div>
- </PanelTable>
- <PanelTable headers={['Short', 'Longer heading name', '']}>
- <div>One Row</div>
- <div>One Row</div>
- <div>One Row</div>
- </PanelTable>
- <PanelTable
- isLoading
- // eslint-disable-next-line react/jsx-key
- headers={[<div>Header #1</div>, 'Header #2', <div>Custom Header Wooooo</div>]}
- >
- <div>Panel Item</div>
- <div>Panel Item</div>
- <div>Panel Item</div>
- </PanelTable>
- <PanelTable
- isEmpty
- // eslint-disable-next-line react/jsx-key
- headers={[<div>Header #1</div>, 'Header #2', <div>Custom Header Wooooo</div>]}
- >
- <div>Panel Item</div>
- <div>Panel Item</div>
- <div>Panel Item</div>
- </PanelTable>
- <_BulkController />
- </Fragment>
- );
- _PanelTable.parameters = {
- docs: {
- description: {
- story: 'A Panel for "tabular" data',
- },
- },
- };
- export const WithFields = ({...args}) => (
- <Panel {...args}>
- <PanelHeader>Panel Header</PanelHeader>
- <PanelBody>
- <FieldGroup label="Label" help="This is a helpful description for this form field">
- <Button priority="danger">Remove</Button>
- </FieldGroup>
- <FieldGroup
- label="Label"
- help="Control will fill up all available space, so wrap with a `<div>` to have it behave like an inline-block element."
- >
- <div>
- <Button priority="danger">Remove</Button>
- </div>
- </FieldGroup>
- </PanelBody>
- </Panel>
- );
- _PanelTable.parameters = {
- docs: {
- description: {
- story: 'Non-connected form field item',
- },
- },
- };
|