-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
d9736ab
commit cb92d45
Showing
2 changed files
with
87 additions
and
3 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
73 changes: 73 additions & 0 deletions
73
x-pack/plugins/apm/public/components/shared/span_icon/span_icon.stories.tsx
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 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { | ||
EuiFlexGrid, | ||
EuiFlexItem, | ||
EuiCopy, | ||
EuiPanel, | ||
EuiSpacer, | ||
EuiCodeBlock, | ||
} from '@elastic/eui'; | ||
import React from 'react'; | ||
import { storiesOf } from '@storybook/react'; | ||
import { EuiThemeProvider } from '../../../../../../../src/plugins/kibana_react/common'; | ||
import { SpanIcon } from './index'; | ||
import { typeIcons } from './get_span_icon'; | ||
|
||
const types = Object.keys(typeIcons); | ||
|
||
storiesOf('shared/span_icon/span_icon', module) | ||
.addDecorator((storyFn) => <EuiThemeProvider>{storyFn()}</EuiThemeProvider>) | ||
.add( | ||
'Span icon', | ||
() => { | ||
return ( | ||
<> | ||
<EuiCodeBlock language="html" isCopyable paddingSize="m"> | ||
{'<SpanIcon type="db" subtype="cassandra" />'} | ||
</EuiCodeBlock> | ||
|
||
<EuiSpacer /> | ||
<EuiFlexGrid direction="column" columns={3}> | ||
{types.map((type) => { | ||
const subTypes = Object.keys(typeIcons[type]); | ||
return ( | ||
<> | ||
{subTypes.map((subType) => { | ||
const id = `${type}.${subType}`; | ||
return ( | ||
<EuiFlexItem key={id}> | ||
<EuiCopy | ||
display="block" | ||
textToCopy={id} | ||
afterMessage={`${id} copied`} | ||
> | ||
{(copy) => ( | ||
<EuiPanel | ||
hasShadow={false} | ||
hasBorder={false} | ||
onClick={copy} | ||
paddingSize="s" | ||
> | ||
<SpanIcon type={type} subType={subType} />  {' '} | ||
<small>{id}</small> | ||
</EuiPanel> | ||
)} | ||
</EuiCopy> | ||
</EuiFlexItem> | ||
); | ||
})} | ||
</> | ||
); | ||
})} | ||
</EuiFlexGrid> | ||
</> | ||
); | ||
}, | ||
{} | ||
); |