-
Notifications
You must be signed in to change notification settings - Fork 7
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
1 parent
b029265
commit c9c8ab4
Showing
20 changed files
with
257 additions
and
10 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import PropTypes from 'prop-types'; | ||
import React from 'react'; | ||
import styles from './Toolbar.scss'; | ||
|
||
const Toolbar = (props) => { | ||
const { | ||
children, | ||
} = props; | ||
|
||
return ( | ||
<div className={styles.toolbar}> | ||
{children} | ||
</div> | ||
); | ||
}; | ||
|
||
Toolbar.propTypes = { | ||
children: PropTypes.oneOfType([ | ||
PropTypes.arrayOf(PropTypes.node), | ||
PropTypes.node, | ||
]).isRequired, | ||
}; | ||
|
||
export default Toolbar; |
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,18 @@ | ||
@import '../../../styles/tools/offset'; | ||
@import 'theme'; | ||
|
||
.toolbar { | ||
display: flex; | ||
flex-wrap: wrap; | ||
align-items: flex-end; | ||
margin: calc(-1 * #{$toolbar-spacing}); | ||
} | ||
|
||
.item { | ||
flex: none; | ||
margin: $toolbar-spacing; | ||
} | ||
|
||
.spacer { | ||
flex: 1 1 auto; | ||
} |
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,24 @@ | ||
import PropTypes from 'prop-types'; | ||
import React from 'react'; | ||
import styles from './Toolbar.scss'; | ||
|
||
const ToolbarItem = (props) => { | ||
const { | ||
children, | ||
} = props; | ||
|
||
return ( | ||
<div className={styles.item}> | ||
{children} | ||
</div> | ||
); | ||
}; | ||
|
||
ToolbarItem.propTypes = { | ||
children: PropTypes.oneOfType([ | ||
PropTypes.arrayOf(PropTypes.node), | ||
PropTypes.node, | ||
]).isRequired, | ||
}; | ||
|
||
export default ToolbarItem; |
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,8 @@ | ||
import React from 'react'; | ||
import styles from './Toolbar.scss'; | ||
|
||
const ToolbarSpacer = () => ( | ||
<div className={styles.spacer} /> | ||
); | ||
|
||
export default ToolbarSpacer; |
27 changes: 27 additions & 0 deletions
27
src/lib/components/layout/Toolbar/__tests__/Toolbar.test.jsx
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,27 @@ | ||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
import Toolbar from '../Toolbar'; | ||
|
||
describe('rendering', () => { | ||
it('renders correctly with a single child', () => { | ||
const tree = shallow(( | ||
<Toolbar> | ||
<span>content</span> | ||
</Toolbar> | ||
)); | ||
|
||
expect(tree).toMatchSnapshot(); | ||
}); | ||
|
||
it('renders correctly with multiple children', () => { | ||
const tree = shallow(( | ||
<Toolbar> | ||
<span>content 1</span> | ||
<span>content 2</span> | ||
<span>content 3</span> | ||
</Toolbar> | ||
)); | ||
|
||
expect(tree).toMatchSnapshot(); | ||
}); | ||
}); |
27 changes: 27 additions & 0 deletions
27
src/lib/components/layout/Toolbar/__tests__/ToolbarItem.test.jsx
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,27 @@ | ||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
import ToolbarItem from '../ToolbarItem'; | ||
|
||
describe('rendering', () => { | ||
it('renders correctly with a single child', () => { | ||
const tree = shallow(( | ||
<ToolbarItem> | ||
<span>content</span> | ||
</ToolbarItem> | ||
)); | ||
|
||
expect(tree).toMatchSnapshot(); | ||
}); | ||
|
||
it('renders correctly with multiple children', () => { | ||
const tree = shallow(( | ||
<ToolbarItem> | ||
<span>content 1</span> | ||
<span>content 2</span> | ||
<span>content 3</span> | ||
</ToolbarItem> | ||
)); | ||
|
||
expect(tree).toMatchSnapshot(); | ||
}); | ||
}); |
13 changes: 13 additions & 0 deletions
13
src/lib/components/layout/Toolbar/__tests__/ToolbarSpacer.test.jsx
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,13 @@ | ||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
import ToolbarSpacer from '../ToolbarSpacer'; | ||
|
||
describe('rendering', () => { | ||
it('renders correctly', () => { | ||
const tree = shallow(( | ||
<ToolbarSpacer /> | ||
)); | ||
|
||
expect(tree).toMatchSnapshot(); | ||
}); | ||
}); |
27 changes: 27 additions & 0 deletions
27
src/lib/components/layout/Toolbar/__tests__/__snapshots__/Toolbar.test.jsx.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,27 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`rendering renders correctly with a single child 1`] = ` | ||
<div | ||
className="toolbar" | ||
> | ||
<span> | ||
content | ||
</span> | ||
</div> | ||
`; | ||
|
||
exports[`rendering renders correctly with multiple children 1`] = ` | ||
<div | ||
className="toolbar" | ||
> | ||
<span> | ||
content 1 | ||
</span> | ||
<span> | ||
content 2 | ||
</span> | ||
<span> | ||
content 3 | ||
</span> | ||
</div> | ||
`; |
27 changes: 27 additions & 0 deletions
27
src/lib/components/layout/Toolbar/__tests__/__snapshots__/ToolbarItem.test.jsx.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,27 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`rendering renders correctly with a single child 1`] = ` | ||
<div | ||
className="item" | ||
> | ||
<span> | ||
content | ||
</span> | ||
</div> | ||
`; | ||
|
||
exports[`rendering renders correctly with multiple children 1`] = ` | ||
<div | ||
className="item" | ||
> | ||
<span> | ||
content 1 | ||
</span> | ||
<span> | ||
content 2 | ||
</span> | ||
<span> | ||
content 3 | ||
</span> | ||
</div> | ||
`; |
7 changes: 7 additions & 0 deletions
7
src/lib/components/layout/Toolbar/__tests__/__snapshots__/ToolbarSpacer.test.jsx.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,7 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`rendering renders correctly 1`] = ` | ||
<div | ||
className="spacer" | ||
/> | ||
`; |
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 @@ | ||
$toolbar-spacing: var(--rui-toolbar-spacing); |
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 @@ | ||
export { default as Toolbar } from './Toolbar'; | ||
export { default as ToolbarItem } from './ToolbarItem'; | ||
export { default as ToolbarSpacer } from './ToolbarSpacer'; |
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