-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: refactor popover component and add theme prop
- Loading branch information
Chao Liang
committed
Jan 23, 2019
1 parent
f4b63c4
commit 4389163
Showing
24 changed files
with
472 additions
and
42 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
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
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
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,127 @@ | ||
import React from 'react'; | ||
import Example from '../components/Example'; | ||
import { Popover } from '../../src'; | ||
|
||
class PopoverExample extends React.PureComponent { | ||
render() { | ||
return ( | ||
<> | ||
<label>Placement (left, right, bottom, top)</label> | ||
<div style={{ display: 'flex' }}> | ||
<Popover id="popover-example-left" placement="left" title="Popover Title"> | ||
LEFT | ||
</Popover> | ||
<Popover id="popover-example-right" placement="right" title="Popover Title"> | ||
RIGHT | ||
</Popover> | ||
<Popover id="popover-example-bottom" placement="bottom" title="Popover Title"> | ||
BOTTOM | ||
</Popover> | ||
<Popover id="popover-example-top" placement="top" title="Popover Title"> | ||
TOP | ||
</Popover> | ||
</div> | ||
<label>Theme (light, dark, warn, error)</label> | ||
<div style={{ display: 'flex' }}> | ||
<Popover id="popover-example-light" placement="bottom" theme="light" title="Popover Title"> | ||
LIGHT | ||
</Popover> | ||
<Popover id="popover-example-dark" placement="bottom" theme="dark" title="Popover Title"> | ||
DARK | ||
</Popover> | ||
<Popover id="popover-example-warn" placement="bottom" theme="warn" title="Popover Title"> | ||
WARN | ||
</Popover> | ||
<Popover id="popover-example-error" placement="bottom" theme="error" title="Popover Title"> | ||
ERROR | ||
</Popover> | ||
</div> | ||
</> | ||
); | ||
} | ||
} | ||
|
||
const exampleProps = { | ||
componentName: 'Popover', | ||
exampleCodeSnippet: ` | ||
<Popover id="popover-example-left" placement="left" title="Popover Title"> | ||
LEFT | ||
</Popover> | ||
<Popover id="popover-example-right" placement="right" title="Popover Title"> | ||
RIGHT | ||
</Popover> | ||
<Popover id="popover-example-bottom" placement="bottom" title="Popover Title"> | ||
BOTTOM | ||
</Popover> | ||
<Popover id="popover-example-top" placement="top" title="Popover Title"> | ||
TOP | ||
</Popover> | ||
<Popover id="popover-example-light" placement="bottom" theme="light" title="Popover Title"> | ||
LIGHT | ||
</Popover> | ||
<Popover id="popover-example-dark" placement="bottom" theme="dark" title="Popover Title"> | ||
DARK | ||
</Popover> | ||
<Popover id="popover-example-warn" placement="bottom" theme="warn" title="Popover Title"> | ||
WARN | ||
</Popover> | ||
<Popover id="popover-example-error" placement="bottom" theme="error" title="Popover Title"> | ||
ERROR | ||
</Popover> | ||
`, | ||
propTypeSectionArray: [ | ||
{ | ||
propTypes: [ | ||
{ | ||
propType: 'id', | ||
type: 'string', | ||
note: 'A unique identifier for the element.', | ||
}, | ||
{ | ||
propType: 'title', | ||
type: 'node', | ||
note: 'Title for this popover.', | ||
}, | ||
{ | ||
propType: 'children', | ||
type: 'node', | ||
note: 'Message content for this popover.', | ||
}, | ||
{ | ||
propType: 'bsClass', | ||
type: 'text', | ||
defaultValue: 'popover', | ||
note: `Base className. The default value is 'popover'.`, | ||
}, | ||
{ | ||
propType: 'className', | ||
type: 'text', | ||
note: 'Additional className for the component', | ||
}, | ||
{ | ||
propType: 'placement', | ||
type: 'oneOf[top, right, bottom, left]', | ||
defaultValue: 'right', | ||
}, | ||
{ | ||
propType: 'theme', | ||
type: 'oneOf[light, dark, warn, error]', | ||
defaultValue: 'light', | ||
}, | ||
], | ||
}, | ||
], | ||
}; | ||
|
||
export default () => ( | ||
<Example {...exampleProps}> | ||
<PopoverExample /> | ||
</Example> | ||
); |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
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
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
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
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
File renamed without changes.
Oops, something went wrong.