mirror of https://github.com/grafana/grafana
parent
9df47391ea
commit
40d7ba1e6a
@ -1,12 +1,9 @@ |
|||||||
import { storiesOf } from '@storybook/react'; |
import { storiesOf } from '@storybook/react'; |
||||||
import { withCenteredStory } from '../../utils/storybook/withCenteredStory'; |
|
||||||
import { renderComponentWithTheme } from '../../utils/storybook/withTheme'; |
|
||||||
import TableInputCSV from './TableInputCSV'; |
import TableInputCSV from './TableInputCSV'; |
||||||
|
import { withFullSizeStory } from '../../utils/storybook/withFullSizeStory'; |
||||||
|
|
||||||
const TableInputStories = storiesOf('UI/Table/Input', module); |
const TableInputStories = storiesOf('UI/Table/Input', module); |
||||||
|
|
||||||
TableInputStories.addDecorator(withCenteredStory); |
|
||||||
|
|
||||||
TableInputStories.add('default', () => { |
TableInputStories.add('default', () => { |
||||||
return renderComponentWithTheme(TableInputCSV, {}); |
return withFullSizeStory(TableInputCSV, {}); |
||||||
}); |
}); |
||||||
|
|||||||
@ -0,0 +1,17 @@ |
|||||||
|
.gf-table-input-wrap { |
||||||
|
width: 100%; |
||||||
|
} |
||||||
|
|
||||||
|
.gf-table-input-wrap textarea { |
||||||
|
height: 100%; |
||||||
|
width: 100%; |
||||||
|
resize: none; |
||||||
|
} |
||||||
|
|
||||||
|
.gf-table-input-wrap footer { |
||||||
|
position: absolute; |
||||||
|
bottom: 20px; |
||||||
|
right: 20px; |
||||||
|
border: 2px solid #222; |
||||||
|
background: #ccc; |
||||||
|
} |
||||||
@ -1,11 +0,0 @@ |
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP |
|
||||||
|
|
||||||
exports[`TableInputCSV renders correctly 1`] = ` |
|
||||||
<div> |
|
||||||
<textarea |
|
||||||
onBlur={[Function]} |
|
||||||
onChange={[Function]} |
|
||||||
value="" |
|
||||||
/> |
|
||||||
</div> |
|
||||||
`; |
|
||||||
@ -0,0 +1,23 @@ |
|||||||
|
import React from 'react'; |
||||||
|
import { AutoSizer } from 'react-virtualized'; |
||||||
|
|
||||||
|
export const withFullSizeStory = (component: React.ComponentType<any>, props: any) => ( |
||||||
|
<div |
||||||
|
style={{ |
||||||
|
height: '100vh', |
||||||
|
width: '100%', |
||||||
|
}} |
||||||
|
> |
||||||
|
<AutoSizer> |
||||||
|
{({ width, height }) => ( |
||||||
|
<> |
||||||
|
{React.createElement(component, { |
||||||
|
...props, |
||||||
|
width, |
||||||
|
height, |
||||||
|
})} |
||||||
|
</> |
||||||
|
)} |
||||||
|
</AutoSizer> |
||||||
|
</div> |
||||||
|
); |
||||||
Loading…
Reference in new issue