Skip to content

Commit b50b812

Browse files
committed
Add border prop to Toolbar and Sidebar
1 parent b00b655 commit b50b812

File tree

7 files changed

+49
-11
lines changed

7 files changed

+49
-11
lines changed

packages/react-components/CHANGELOG.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
# [Unreleased](https://github.com/puppetlabs/design-system/compare/@puppet/[email protected])
1+
# [Unreleased](https://github.com/puppetlabs/design-system/compare/@puppet/[email protected])
2+
3+
# [5.19.1](https://github.com/puppetlabs/design-system/compare/@puppet/[email protected]...@puppet/[email protected]) (2020-03-18)
24

35
- [Docs] Add instructions for setting up fonts in different environments (by [sprokusk](https://github.com/sprokusk) in [#233](https://github.com/puppetlabs/design-system/pull/233))
6+
- [SidePanel, Toolbar] Add `border` prop to Toolbar and Sidebar (by [@vine77](https://github.com/vine77) in [#235](https://github.com/puppetlabs/design-system/pull/235))
7+
- Upgrade dependencies (by [@vine77](https://github.com/vine77) in [b91310b](https://github.com/puppetlabs/design-system/commit/b91310b722c509d90268b6efeae6692404074f0f))
48

59
# [5.19.0](https://github.com/puppetlabs/design-system/compare/@puppet/[email protected]...@puppet/[email protected]) (2020-03-13)
610

packages/react-components/source/react/library/sidepanel/SidePanel.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
3+
import classNames from 'classnames';
34
import Button from '../button';
45
import Heading from '../heading';
56

67
const propTypes = {
8+
border: PropTypes.bool,
79
className: PropTypes.string,
810
children: PropTypes.node,
911
closeButtonProps: PropTypes.shape({}),
@@ -15,6 +17,7 @@ const propTypes = {
1517
};
1618

1719
const defaultProps = {
20+
border: false,
1821
children: null,
1922
closeButtonProps: {},
2023
open: true,
@@ -28,6 +31,7 @@ const defaultProps = {
2831
* SidePanel may be used inside the rightmost Columns.Column.
2932
*/
3033
const SidePanel = ({
34+
border,
3135
children,
3236
open,
3337
title,
@@ -49,7 +53,11 @@ const SidePanel = ({
4953

5054
return (
5155
open && (
52-
<div className={`rc-sidepanel ${className}`}>
56+
<div
57+
className={classNames('rc-sidepanel', className, {
58+
'rc-sidepanel-border': border,
59+
})}
60+
>
5361
<div className="rc-sidepanel-toolbar">
5462
<Heading
5563
as="h5"

packages/react-components/source/react/library/toolbar/Toolbar.js

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,28 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
3+
import classNames from 'classnames';
34
import Actions from './Actions';
45

56
const propTypes = {
7+
border: PropTypes.bool,
68
children: PropTypes.node,
79
className: PropTypes.string,
810
};
911

1012
const defaultProps = {
13+
border: false,
1114
children: null,
1215
className: '',
1316
};
1417

15-
const Toolbar = ({ children, className }) => (
16-
<div className={`rc-toolbar ${className}`}>{children}</div>
18+
const Toolbar = ({ border, children, className }) => (
19+
<div
20+
className={classNames('rc-toolbar', className, {
21+
'rc-toolbar-border': border,
22+
})}
23+
>
24+
{children}
25+
</div>
1726
);
1827

1928
Toolbar.propTypes = propTypes;

packages/react-components/source/react/library/toolbar/Toolbar.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Toolbar acts as a container for tabs and buttons that is unified and compact.
77
```jsx
88
import Button from '../button';
99

10-
<Toolbar>
10+
<Toolbar border>
1111
<Toolbar.Actions>
1212
<Button innerFocus type="transparent">
1313
Toolbar button
@@ -30,7 +30,7 @@ const [open, setOpen] = React.useState(false);
3030

3131
<div style={{ display: 'flex' }}>
3232
<div style={{ flexGrow: 1 }}>
33-
<Toolbar>
33+
<Toolbar border>
3434
<Tabs>
3535
<Tabs.Tab icon="home" title="Tab 1">
3636
<Text>This is the first toolbar tab.</Text>
@@ -52,7 +52,7 @@ const [open, setOpen] = React.useState(false);
5252
<div>
5353
<SidePanel
5454
type="toolbar"
55-
bordered
55+
border
5656
title="SidePanel for the toolbar"
5757
open={open}
5858
onClose={() => setOpen(false)}

packages/react-components/source/scss/library/components/_sidepanel.scss

+5-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
display: flex;
55
flex: none;
66
flex-direction: column;
7+
height: 100%;
78
width: 326px;
89

910
@media (max-width: 767px) {
@@ -18,11 +19,14 @@
1819
.rc-sidepanel-toolbar {
1920
background-color: $puppet-n50;
2021
border-bottom: $puppet-common-border;
21-
border-top: $puppet-common-border;
2222
display: flex;
2323
justify-content: space-between;
2424
}
2525

26+
.rc-sidepanel-border .rc-sidepanel-toolbar {
27+
border-top: $puppet-common-border;
28+
}
29+
2630
.rc-sidepanel-heading {
2731
color: $puppet-n800;
2832
font-family: $puppet-type-font-family-secondary;

packages/react-components/source/scss/library/components/_toolbar.scss

+15-3
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,32 @@
33
.rc-toolbar {
44
background-color: $puppet-n50;
55
border-bottom: $puppet-common-border;
6-
border-top: $puppet-common-border;
76
display: flex;
87
}
98

9+
.rc-toolbar-border {
10+
border-top: $puppet-common-border;
11+
}
12+
1013
.rc-toolbar > .rc-tabs {
11-
margin: -1px 0;
14+
margin-bottom: -1px;
15+
margin-top: 0;
16+
}
17+
18+
.rc-toolbar-border > .rc-tabs {
19+
margin-top: -1px;
1220
}
1321

1422
.rc-toolbar > .rc-tabs > .rc-tabs-list {
1523
background-color: $puppet-n50;
1624
border-bottom: $puppet-common-border;
17-
border-top: $puppet-common-border;
1825
z-index: 2;
1926
}
2027

28+
.rc-toolbar-border > .rc-tabs > .rc-tabs-list {
29+
border-top: $puppet-common-border;
30+
}
31+
2132
.rc-toolbar > .rc-tabs > .rc-tabs-list > .rc-tabs-button {
2233
border: 0;
2334
border-radius: 0 !important;
@@ -60,6 +71,7 @@
6071

6172
.rc-toolbar > .rc-tabs > .rc-tabs-panel {
6273
border-top: 0;
74+
padding: 0;
6375
}
6476

6577
.rc-toolbar-actions {

packages/react-layouts/src/Columns/Columns.scss

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.rc-columns {
22
display: flex;
33
flex-direction: row;
4+
height: 100%;
45
}
56

67
.rc-column {

0 commit comments

Comments
 (0)