-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
John Benavides
committed
Dec 27, 2017
1 parent
e8a66ca
commit bdd9a51
Showing
15 changed files
with
428 additions
and
0 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
78 changes: 78 additions & 0 deletions
78
src/components/panel/__test__/__snapshots__/panel.test.js.snap
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,78 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Panel component Should Exist 1`] = `[Function]`; | ||
|
||
exports[`Panel component Should have box classname 1`] = ` | ||
<nav | ||
className="panel" | ||
> | ||
<div | ||
className="panel-heading" | ||
> | ||
repositories | ||
</div> | ||
<div | ||
className="panel-block" | ||
> | ||
<div> | ||
Control | ||
</div> | ||
</div> | ||
<div | ||
className="panel-tabs panel-tabs" | ||
> | ||
<a | ||
className="is-active" | ||
> | ||
all | ||
</a> | ||
<a | ||
className="" | ||
> | ||
public | ||
</a> | ||
<a | ||
className="" | ||
> | ||
private | ||
</a> | ||
<a | ||
className="" | ||
> | ||
sources | ||
</a> | ||
<a | ||
className="" | ||
> | ||
forks | ||
</a> | ||
</div> | ||
<a | ||
className="panel-block is-active" | ||
> | ||
<span | ||
className="panel-icon" | ||
> | ||
<i | ||
className="fa fa-bars" | ||
/> | ||
</span> | ||
bulma | ||
</a> | ||
<label | ||
className="panel-block panel-block" | ||
> | ||
<input | ||
type="checkbox" | ||
/> | ||
remember me | ||
</label> | ||
<div | ||
className="panel-block" | ||
> | ||
<button> | ||
reset all filters | ||
</button> | ||
</div> | ||
</nav> | ||
`; |
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,46 @@ | ||
import React from 'react'; | ||
import renderer from 'react-test-renderer'; | ||
import Panel from '..'; | ||
|
||
describe('Panel component', () => { | ||
it('Should Exist', () => { | ||
expect(Panel).toMatchSnapshot(); | ||
}); | ||
it('Should have box classname', () => { | ||
const component = renderer.create( | ||
<Panel> | ||
<Panel.Header> | ||
repositories | ||
</Panel.Header> | ||
<Panel.Block> | ||
<div> | ||
Control | ||
</div> | ||
</Panel.Block> | ||
<Panel.Tabs className="panel-tabs"> | ||
<Panel.Tabs.Tab active>all</Panel.Tabs.Tab> | ||
<Panel.Tabs.Tab>public</Panel.Tabs.Tab> | ||
<Panel.Tabs.Tab>private</Panel.Tabs.Tab> | ||
<Panel.Tabs.Tab>sources</Panel.Tabs.Tab> | ||
<Panel.Tabs.Tab>forks</Panel.Tabs.Tab> | ||
</Panel.Tabs> | ||
<Panel.Block renderAs="a" active> | ||
<Panel.Icon> | ||
<i className="fa fa-bars" /> | ||
</Panel.Icon > | ||
bulma | ||
</Panel.Block> | ||
<Panel.Block renderAs="label" className="panel-block"> | ||
<input type="checkbox" /> | ||
remember me | ||
</Panel.Block> | ||
<Panel.Block> | ||
<button> | ||
reset all filters | ||
</button> | ||
</Panel.Block> | ||
</Panel>, | ||
); | ||
expect(component.toJSON()).toMatchSnapshot(); | ||
}); | ||
}); |
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,39 @@ | ||
import React, { PureComponent } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import classnames from 'classnames'; | ||
|
||
export default class PanelHeader extends PureComponent { | ||
static displayName = 'Panel.Block' | ||
|
||
static propTypes = { | ||
className: PropTypes.string, | ||
renderAs: PropTypes.oneOfType([ | ||
PropTypes.string, | ||
PropTypes.func, | ||
]), | ||
active: PropTypes.bool, | ||
} | ||
|
||
static defaultProps = { | ||
className: '', | ||
renderAs: 'div', | ||
active: false, | ||
} | ||
render() { | ||
const { | ||
className, | ||
renderAs, | ||
active, | ||
...props | ||
} = this.props; | ||
const Element = renderAs; | ||
return ( | ||
<Element | ||
{...props} | ||
className={classnames('panel-block', className, { | ||
'is-active': active, | ||
})} | ||
/> | ||
); | ||
} | ||
} |
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,34 @@ | ||
import React, { PureComponent } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import classnames from 'classnames'; | ||
|
||
export default class PanelHeader extends PureComponent { | ||
static displayName = 'Panel.Header' | ||
|
||
static propTypes = { | ||
className: PropTypes.string, | ||
renderAs: PropTypes.oneOfType([ | ||
PropTypes.string, | ||
PropTypes.func, | ||
]), | ||
} | ||
|
||
static defaultProps = { | ||
className: '', | ||
renderAs: 'div', | ||
} | ||
render() { | ||
const { | ||
className, | ||
renderAs, | ||
...props | ||
} = this.props; | ||
const Element = renderAs; | ||
return ( | ||
<Element | ||
{...props} | ||
className={classnames('panel-heading', className)} | ||
/> | ||
); | ||
} | ||
} |
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,34 @@ | ||
import React, { PureComponent } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import classnames from 'classnames'; | ||
|
||
export default class PanelIcon extends PureComponent { | ||
static displayName = 'Panel.Icon' | ||
|
||
static propTypes = { | ||
className: PropTypes.string, | ||
renderAs: PropTypes.oneOfType([ | ||
PropTypes.string, | ||
PropTypes.func, | ||
]), | ||
} | ||
|
||
static defaultProps = { | ||
className: '', | ||
renderAs: 'span', | ||
} | ||
render() { | ||
const { | ||
className, | ||
renderAs, | ||
...props | ||
} = this.props; | ||
const Element = renderAs; | ||
return ( | ||
<Element | ||
{...props} | ||
className={classnames('panel-icon', className)} | ||
/> | ||
); | ||
} | ||
} |
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,39 @@ | ||
import React, { PureComponent } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import classnames from 'classnames'; | ||
|
||
export default class PanelTabsTab extends PureComponent { | ||
static displayName = 'Panel.Tabs.Tab' | ||
|
||
static propTypes = { | ||
className: PropTypes.string, | ||
renderAs: PropTypes.oneOfType([ | ||
PropTypes.string, | ||
PropTypes.func, | ||
]), | ||
active: PropTypes.bool, | ||
} | ||
|
||
static defaultProps = { | ||
className: '', | ||
renderAs: 'a', | ||
active: false, | ||
} | ||
render() { | ||
const { | ||
className, | ||
renderAs, | ||
active, | ||
...props | ||
} = this.props; | ||
const Element = renderAs; | ||
return ( | ||
<Element | ||
{...props} | ||
className={classnames(className, { | ||
'is-active': active, | ||
})} | ||
/> | ||
); | ||
} | ||
} |
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 @@ | ||
export { default } from './tabs'; |
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,38 @@ | ||
import React, { PureComponent } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import classnames from 'classnames'; | ||
import Tab from './components/tab'; | ||
|
||
export default class PanelTabs extends PureComponent { | ||
static displayName = 'Panel.Tabs' | ||
|
||
static propTypes = { | ||
className: PropTypes.string, | ||
renderAs: PropTypes.oneOfType([ | ||
PropTypes.string, | ||
PropTypes.func, | ||
]), | ||
} | ||
|
||
static defaultProps = { | ||
className: '', | ||
renderAs: 'div', | ||
} | ||
|
||
static Tab = Tab; | ||
|
||
render() { | ||
const { | ||
className, | ||
renderAs, | ||
...props | ||
} = this.props; | ||
const Element = renderAs; | ||
return ( | ||
<Element | ||
{...props} | ||
className={classnames('panel-tabs', className)} | ||
/> | ||
); | ||
} | ||
} |
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,3 @@ | ||
import './panel.sass'; | ||
|
||
export { default } from './panel'; |
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,43 @@ | ||
import React, { PureComponent } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import classnames from 'classnames'; | ||
|
||
import Block from './components/block'; | ||
import Header from './components/header'; | ||
import Icon from './components/icon'; | ||
import Tabs from './components/tabs'; | ||
|
||
export default class Panel extends PureComponent { | ||
static propTypes = { | ||
className: PropTypes.string, | ||
renderAs: PropTypes.oneOfType([ | ||
PropTypes.string, | ||
PropTypes.func, | ||
]), | ||
} | ||
|
||
static defaultProps = { | ||
className: '', | ||
renderAs: 'nav', | ||
} | ||
|
||
static Header = Header | ||
static Tabs = Tabs | ||
static Block = Block | ||
static Icon = Icon | ||
|
||
render() { | ||
const { | ||
className, | ||
renderAs, | ||
...props | ||
} = this.props; | ||
const Element = renderAs; | ||
return ( | ||
<Element | ||
{...props} | ||
className={classnames('panel', className)} | ||
/> | ||
); | ||
} | ||
} |
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,2 @@ | ||
@import '../utils.sass'; | ||
@import '~bulma/sass/components/panel.sass'; |
Oops, something went wrong.