Skip to content

Commit 50201a8

Browse files
Merge pull request #358 from tweettypography/lookup-story
Lookup story
2 parents 04d3667 + d3f0226 commit 50201a8

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

stories/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ export default from './data-table';
88
export default from './forms/input';
99
export default from './forms/input/inline';
1010
export default from './icon';
11+
export default from './lookup';
1112
export default from './spinner';

stories/lookup/index.jsx

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import React from 'react';
2+
import { storiesOf, action } from '@kadira/storybook';
3+
4+
import { LOOKUP } from '../../utilities/constants';
5+
import Lookup from '../../components/lookup';
6+
7+
const DemoLookup = React.createClass({
8+
displayName: 'DemoLookup',
9+
10+
getInitialState () {
11+
return {
12+
options: [
13+
{ label: 'File 1' },
14+
{ label: 'File 2' },
15+
{ label: 'File 3' },
16+
{ label: 'File 4' }
17+
]
18+
};
19+
},
20+
21+
render () {
22+
return (
23+
<Lookup
24+
{...this.props}
25+
onChange={action('change')}
26+
onSelect={this.handleSelect}
27+
options={this.state.options}
28+
selectedItem={this.state.selectedItem}
29+
/>
30+
);
31+
},
32+
33+
handleSelect (selectedItem, ...rest) {
34+
action('select')(selectedItem, ...rest);
35+
36+
this.setState({ selectedItem });
37+
}
38+
});
39+
40+
storiesOf(LOOKUP, module)
41+
.addDecorator(getStory => <div className="slds-p-around--medium">{getStory()}</div>)
42+
.add('standard', () => <DemoLookup
43+
emptyMessage="No Files found"
44+
hasError={false}
45+
iconCategory="utility"
46+
iconInverse={false}
47+
iconName="open_folder"
48+
label="Files"
49+
/>);

0 commit comments

Comments
 (0)