beem-component 1.2.8 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/BannerCard/bannerCard.stories.js +110 -0
- package/dist/components/BannerCard/bannerCards.js +107 -0
- package/dist/components/Cards/cards.js +4 -4
- package/dist/components/Modals/modals.stories.js +10 -15
- package/dist/components/NoteBar/noteBar.js +62 -13
- package/dist/components/NoteBar/noteBar.stories.js +13 -1
- package/dist/components/ProgressRing/progressRing.js +176 -0
- package/dist/components/ProgressRing/progressRing.stories.js +63 -0
- package/dist/components/Tabs/tabs.js +25 -19
- package/dist/components/Tabs/tabs.stories.js +16 -5
- package/dist/components/index.js +16 -0
- package/package.json +1 -1
- package/src/App.js +38 -42
- package/src/MainChat.js +41 -0
- package/src/lib/components/BannerCard/bannerCard.stories.js +82 -0
- package/src/lib/components/BannerCard/bannerCards.js +67 -0
- package/src/lib/components/Cards/cards.js +11 -15
- package/src/lib/components/NoteBar/noteBar.js +29 -5
- package/src/lib/components/NoteBar/noteBar.stories.js +12 -0
- package/src/lib/components/ProgressRing/progressRing.js +145 -0
- package/src/lib/components/ProgressRing/progressRing.stories.js +41 -0
- package/src/lib/components/Tabs/tabs.js +16 -9
- package/src/lib/components/Tabs/tabs.stories.js +15 -3
- package/src/lib/components/index.js +5 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.CustomProgressRing = exports.BasicProgressRing = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _progressRing = _interopRequireDefault(require("./progressRing"));
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
|
|
14
|
+
/* eslint-disable import/no-anonymous-default-export */
|
|
15
|
+
var _default = {
|
|
16
|
+
component: _progressRing.default,
|
|
17
|
+
title: "components/ProgressRing",
|
|
18
|
+
argTypes: {
|
|
19
|
+
size: {
|
|
20
|
+
options: ["small", "medium", "large"],
|
|
21
|
+
control: {
|
|
22
|
+
type: "select"
|
|
23
|
+
},
|
|
24
|
+
description: "Size of the Progress Ring (Can also be predefined e.g. 50)",
|
|
25
|
+
defaultValue: {
|
|
26
|
+
summary: "large"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
progress: {
|
|
30
|
+
description: "Progress Indicator"
|
|
31
|
+
},
|
|
32
|
+
variant: {
|
|
33
|
+
options: ["primary", "success", "warning", "danger"],
|
|
34
|
+
control: {
|
|
35
|
+
type: "select"
|
|
36
|
+
},
|
|
37
|
+
description: "Color of the Progress Ring",
|
|
38
|
+
defaultValue: {
|
|
39
|
+
summary: "xsmall"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
exports.default = _default;
|
|
45
|
+
|
|
46
|
+
var MainProgressRing = function MainProgressRing(args) {
|
|
47
|
+
return /*#__PURE__*/_react.default.createElement(_progressRing.default, args);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
var BasicProgressRing = MainProgressRing.bind({});
|
|
51
|
+
exports.BasicProgressRing = BasicProgressRing;
|
|
52
|
+
BasicProgressRing.args = {
|
|
53
|
+
progress: 30,
|
|
54
|
+
variant: "success",
|
|
55
|
+
size: "xlarge"
|
|
56
|
+
};
|
|
57
|
+
var CustomProgressRing = MainProgressRing.bind({});
|
|
58
|
+
exports.CustomProgressRing = CustomProgressRing;
|
|
59
|
+
CustomProgressRing.args = {
|
|
60
|
+
progress: 50,
|
|
61
|
+
variant: "primary",
|
|
62
|
+
size: "40"
|
|
63
|
+
};
|
|
@@ -29,34 +29,39 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
29
29
|
|
|
30
30
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
31
31
|
|
|
32
|
-
var BmTabWrapper = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: row;\n justify-content: center;\n align-items: center;\n padding:
|
|
33
|
-
var state = _ref.state
|
|
32
|
+
var BmTabWrapper = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: row;\n justify-content: center;\n align-items: center;\n padding: 1rem;\n background: ", ";\n box-shadow: ", ";\n > *:not(:last-child) {\n margin-right: 0.5rem;\n }\n ", "\n\n &:hover {\n box-shadow: ", ";\n }\n"])), _colors.BmPrimaryWhite, function (_ref) {
|
|
33
|
+
var state = _ref.state,
|
|
34
|
+
disabled = _ref.disabled;
|
|
34
35
|
|
|
35
|
-
if (state === "active") {
|
|
36
|
+
if (state === "active" && !disabled) {
|
|
36
37
|
return "inset 0px -3px 0px ".concat(_colors.BmPrimaryBlue);
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
if (state === "inactive") {
|
|
40
|
-
return "inset 0px -3px 0px ".concat(_colors.BmGrey400);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
40
|
return "none";
|
|
44
41
|
}, function (_ref2) {
|
|
45
42
|
var color = _ref2.color,
|
|
46
43
|
children = _ref2.children,
|
|
47
44
|
disabled = _ref2.disabled;
|
|
48
45
|
return children && disabled ? "\n > * {\n color: ".concat(_colors.BmGrey400, ";\n }\n ") : "\n > * {\n color: ".concat(color, ";\n }\n ");
|
|
46
|
+
}, function (_ref3) {
|
|
47
|
+
var disabled = _ref3.disabled;
|
|
48
|
+
|
|
49
|
+
if (!disabled) {
|
|
50
|
+
return "inset 0px -3px 0px ".concat(_colors.BmGrey400);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return "none";
|
|
49
54
|
});
|
|
50
55
|
|
|
51
|
-
var BmTab = function BmTab(
|
|
52
|
-
var leadingIcon =
|
|
53
|
-
trailingIcon =
|
|
54
|
-
children =
|
|
55
|
-
size =
|
|
56
|
-
color =
|
|
57
|
-
icon =
|
|
58
|
-
disabled =
|
|
59
|
-
rest = _objectWithoutProperties(
|
|
56
|
+
var BmTab = function BmTab(_ref4) {
|
|
57
|
+
var leadingIcon = _ref4.leadingIcon,
|
|
58
|
+
trailingIcon = _ref4.trailingIcon,
|
|
59
|
+
children = _ref4.children,
|
|
60
|
+
size = _ref4.size,
|
|
61
|
+
color = _ref4.color,
|
|
62
|
+
icon = _ref4.icon,
|
|
63
|
+
disabled = _ref4.disabled,
|
|
64
|
+
rest = _objectWithoutProperties(_ref4, _excluded);
|
|
60
65
|
|
|
61
66
|
return /*#__PURE__*/_react.default.createElement(BmTabWrapper, _extends({
|
|
62
67
|
leadingIcon: leadingIcon,
|
|
@@ -65,11 +70,11 @@ var BmTab = function BmTab(_ref3) {
|
|
|
65
70
|
disabled: disabled
|
|
66
71
|
}, rest), leadingIcon && /*#__PURE__*/_react.default.createElement(_iconStyles.BmIcons, {
|
|
67
72
|
icon: leadingIcon,
|
|
68
|
-
size: size ||
|
|
73
|
+
size: size || "large",
|
|
69
74
|
color: disabled ? "".concat(_colors.BmGrey400) : color
|
|
70
75
|
}), children, trailingIcon && /*#__PURE__*/_react.default.createElement(_iconStyles.BmIcons, {
|
|
71
76
|
icon: trailingIcon,
|
|
72
|
-
size: size ||
|
|
77
|
+
size: size || "large",
|
|
73
78
|
color: disabled ? "".concat(_colors.BmGrey400) : color
|
|
74
79
|
}));
|
|
75
80
|
};
|
|
@@ -81,5 +86,6 @@ BmTab.propTypes = {
|
|
|
81
86
|
leadingIcon: _propTypes.default.node,
|
|
82
87
|
state: _propTypes.default.string,
|
|
83
88
|
color: _propTypes.default.string,
|
|
84
|
-
size: _propTypes.default.string
|
|
89
|
+
size: _propTypes.default.string,
|
|
90
|
+
disabled: _propTypes.default.bool
|
|
85
91
|
};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = exports.
|
|
6
|
+
exports.default = exports.DisabledTab = exports.BasicTab = void 0;
|
|
7
7
|
|
|
8
8
|
var _icons = require("@material-ui/icons");
|
|
9
9
|
|
|
@@ -25,7 +25,7 @@ var _default = {
|
|
|
25
25
|
description: "Color of the Icons and Text"
|
|
26
26
|
},
|
|
27
27
|
state: {
|
|
28
|
-
options: ["active"
|
|
28
|
+
options: ["active"],
|
|
29
29
|
control: {
|
|
30
30
|
type: "select"
|
|
31
31
|
},
|
|
@@ -40,6 +40,9 @@ var _default = {
|
|
|
40
40
|
defaultValue: {
|
|
41
41
|
summary: "large"
|
|
42
42
|
}
|
|
43
|
+
},
|
|
44
|
+
disabled: {
|
|
45
|
+
description: "Disabled tab"
|
|
43
46
|
}
|
|
44
47
|
}
|
|
45
48
|
};
|
|
@@ -49,12 +52,20 @@ var MainTab = function MainTab(args) {
|
|
|
49
52
|
return /*#__PURE__*/_react.default.createElement(_tabs.BmTab, args);
|
|
50
53
|
};
|
|
51
54
|
|
|
52
|
-
var
|
|
53
|
-
exports.
|
|
54
|
-
|
|
55
|
+
var BasicTab = MainTab.bind({});
|
|
56
|
+
exports.BasicTab = BasicTab;
|
|
57
|
+
BasicTab.args = {
|
|
55
58
|
children: /*#__PURE__*/_react.default.createElement("h3", null, "Tabs"),
|
|
56
59
|
leadingIcon: /*#__PURE__*/_react.default.createElement(_icons.Favorite, null),
|
|
57
60
|
trailingIcon: /*#__PURE__*/_react.default.createElement(_icons.KeyboardArrowDown, null),
|
|
58
61
|
disabled: false,
|
|
59
62
|
state: 'active'
|
|
63
|
+
};
|
|
64
|
+
var DisabledTab = MainTab.bind({});
|
|
65
|
+
exports.DisabledTab = DisabledTab;
|
|
66
|
+
DisabledTab.args = {
|
|
67
|
+
children: /*#__PURE__*/_react.default.createElement("h3", null, "Disabled Tabs"),
|
|
68
|
+
leadingIcon: /*#__PURE__*/_react.default.createElement(_icons.Favorite, null),
|
|
69
|
+
trailingIcon: /*#__PURE__*/_react.default.createElement(_icons.KeyboardArrowDown, null),
|
|
70
|
+
disabled: true
|
|
60
71
|
};
|
package/dist/components/index.js
CHANGED
|
@@ -29,6 +29,12 @@ Object.defineProperty(exports, "BmAvatarIcon", {
|
|
|
29
29
|
return _iconStyles.BmAvatarIcon;
|
|
30
30
|
}
|
|
31
31
|
});
|
|
32
|
+
Object.defineProperty(exports, "BmBanner", {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function get() {
|
|
35
|
+
return _bannerCards.default;
|
|
36
|
+
}
|
|
37
|
+
});
|
|
32
38
|
Object.defineProperty(exports, "BmBtnIcon", {
|
|
33
39
|
enumerable: true,
|
|
34
40
|
get: function get() {
|
|
@@ -204,6 +210,12 @@ Object.defineProperty(exports, "BmProgressBar", {
|
|
|
204
210
|
return _progressbar.BmProgressBar;
|
|
205
211
|
}
|
|
206
212
|
});
|
|
213
|
+
Object.defineProperty(exports, "BmProgressRing", {
|
|
214
|
+
enumerable: true,
|
|
215
|
+
get: function get() {
|
|
216
|
+
return _progressRing.default;
|
|
217
|
+
}
|
|
218
|
+
});
|
|
207
219
|
Object.defineProperty(exports, "BmQuickReplyIcon", {
|
|
208
220
|
enumerable: true,
|
|
209
221
|
get: function get() {
|
|
@@ -349,6 +361,10 @@ var _checkbox = require("./checkbox");
|
|
|
349
361
|
|
|
350
362
|
var _tags = require("../components/Tags/tags");
|
|
351
363
|
|
|
364
|
+
var _bannerCards = _interopRequireDefault(require("../components/BannerCard/bannerCards"));
|
|
365
|
+
|
|
366
|
+
var _progressRing = _interopRequireDefault(require("./ProgressRing/progressRing"));
|
|
367
|
+
|
|
352
368
|
var _iconStyles = require("./iconStyles");
|
|
353
369
|
|
|
354
370
|
var _noteBar = require("./NoteBar/noteBar");
|
package/package.json
CHANGED
package/src/App.js
CHANGED
|
@@ -1,56 +1,52 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from "react";
|
|
2
2
|
import "../src/main.scss";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
BmButton,
|
|
5
|
+
BmCard,
|
|
6
|
+
BmIcons,
|
|
7
|
+
BmNoteBar,
|
|
8
|
+
BmTab,
|
|
9
|
+
MainWrapper,
|
|
10
|
+
} from "./lib/components";
|
|
4
11
|
import { GlobalStyle } from "./lib/components/globalStyles";
|
|
5
12
|
import "./lib/assets/css/sidebar.scss";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import CustomerInfo from "./CustomerInfo";
|
|
10
|
-
import InfoAccordion from "./InfoAccordion";
|
|
13
|
+
import BmBanner from "./lib/components/BannerCard/bannerCards";
|
|
14
|
+
import { FileCopyOutlined } from "@material-ui/icons";
|
|
15
|
+
import BmProgressRing from "./lib/components/ProgressRing/progressRing";
|
|
11
16
|
|
|
12
17
|
export const App = () => {
|
|
13
|
-
const [showModal, setShowModal] = useState(false);
|
|
14
18
|
return (
|
|
15
19
|
<>
|
|
16
20
|
<GlobalStyle />
|
|
17
|
-
<MainWrapper>
|
|
21
|
+
{/* <MainWrapper> */}
|
|
22
|
+
<BmBanner border="dashed" content="center" bannerBg="default" closeButton>
|
|
23
|
+
<BmIcons icon={<FileCopyOutlined />} />
|
|
24
|
+
<h3>Message Title</h3>
|
|
25
|
+
<p>Message Text</p>
|
|
18
26
|
<div>
|
|
19
|
-
<BmButton
|
|
20
|
-
|
|
27
|
+
<BmButton variant="neutral" size="small">
|
|
28
|
+
Label
|
|
21
29
|
</BmButton>
|
|
22
30
|
</div>
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
</
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
</
|
|
30
|
-
<
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
<div className="chat-messages">
|
|
43
|
-
<Chat />
|
|
44
|
-
</div>
|
|
45
|
-
<div className="chat-contact-info">
|
|
46
|
-
<CustomerInfo />
|
|
47
|
-
<InfoAccordion />
|
|
48
|
-
</div>
|
|
49
|
-
</div>
|
|
50
|
-
</div>
|
|
51
|
-
</div>
|
|
52
|
-
</div>
|
|
53
|
-
</MainWrapper>
|
|
31
|
+
</BmBanner>
|
|
32
|
+
<BmCard>
|
|
33
|
+
<BmCard.Header>
|
|
34
|
+
<h3>Card Header</h3>
|
|
35
|
+
</BmCard.Header>
|
|
36
|
+
<BmCard.Body>
|
|
37
|
+
<p>Hello</p>
|
|
38
|
+
<BmProgressRing progress="70" size="50" />
|
|
39
|
+
</BmCard.Body>
|
|
40
|
+
<BmCard.Footer>Card Footer</BmCard.Footer>
|
|
41
|
+
</BmCard>
|
|
42
|
+
<BmProgressRing progress="70" size="45" />
|
|
43
|
+
<BmTab state="active">
|
|
44
|
+
<h3>Tabs</h3>
|
|
45
|
+
</BmTab>
|
|
46
|
+
<BmNoteBar closeButton>
|
|
47
|
+
<p>Hello</p>
|
|
48
|
+
</BmNoteBar>
|
|
49
|
+
{/* </MainWrapper> */}
|
|
54
50
|
</>
|
|
55
51
|
);
|
|
56
52
|
};
|
package/src/MainChat.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "../src/main.scss";
|
|
3
|
+
import { MainWrapper } from "./lib/components";
|
|
4
|
+
import { GlobalStyle } from "./lib/components/globalStyles";
|
|
5
|
+
import "./lib/assets/css/sidebar.scss";
|
|
6
|
+
import SideBar from "./SideBar";
|
|
7
|
+
import ChatHeader from "./ChatHeader";
|
|
8
|
+
import Chat from "./Chat";
|
|
9
|
+
import CustomerInfo from "./CustomerInfo";
|
|
10
|
+
import InfoAccordion from "./InfoAccordion";
|
|
11
|
+
|
|
12
|
+
export const App = () => {
|
|
13
|
+
return (
|
|
14
|
+
<>
|
|
15
|
+
<GlobalStyle />
|
|
16
|
+
<MainWrapper>
|
|
17
|
+
<div className="main-chat-container">
|
|
18
|
+
<div className="chat-container">
|
|
19
|
+
<div className="sidebar">
|
|
20
|
+
<SideBar />
|
|
21
|
+
</div>
|
|
22
|
+
<div className="chat">
|
|
23
|
+
<ChatHeader />
|
|
24
|
+
<div className="chat-menu">
|
|
25
|
+
<div className="chat-messages">
|
|
26
|
+
<Chat />
|
|
27
|
+
</div>
|
|
28
|
+
<div className="chat-contact-info">
|
|
29
|
+
<CustomerInfo />
|
|
30
|
+
<InfoAccordion />
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
</MainWrapper>
|
|
37
|
+
</>
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export default App;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/* eslint-disable import/no-anonymous-default-export */
|
|
2
|
+
import React from "react";
|
|
3
|
+
import BmBanner from "./bannerCards";
|
|
4
|
+
import { BmButton, BmTag } from "..";
|
|
5
|
+
import { BmPrimaryBlue, BmSecondaryYellow } from "../colors";
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
component: BmBanner,
|
|
9
|
+
title: "components/Banner",
|
|
10
|
+
argTypes: {
|
|
11
|
+
border: {
|
|
12
|
+
options: ["dashed", "solid"],
|
|
13
|
+
control: { type: "select" },
|
|
14
|
+
description: "Banner border",
|
|
15
|
+
defaultValue: { summary: "none" },
|
|
16
|
+
},
|
|
17
|
+
bannerBg: {
|
|
18
|
+
description:
|
|
19
|
+
"Banner Background Color, Can be set as 'default', or custom color",
|
|
20
|
+
},
|
|
21
|
+
content: {
|
|
22
|
+
options: ["left", "center", "right"],
|
|
23
|
+
control: { type: "select" },
|
|
24
|
+
description:
|
|
25
|
+
"Aligning content of banner, will not work if closeButton is present",
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const SampleBanner = () => {
|
|
31
|
+
return (
|
|
32
|
+
<BmBanner border="dashed" content="center" bannerBg="default">
|
|
33
|
+
<h3>Message Title</h3>
|
|
34
|
+
<p>Message Text</p>
|
|
35
|
+
<div>
|
|
36
|
+
<BmButton size="small">Label</BmButton>
|
|
37
|
+
</div>
|
|
38
|
+
</BmBanner>
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const AnnouncementBanner = () => {
|
|
43
|
+
return (
|
|
44
|
+
<BmBanner bannerBg={`${BmPrimaryBlue}`} closeButton>
|
|
45
|
+
<h3 style={{ color: "white" }}>Special Announcement Title</h3>
|
|
46
|
+
<p style={{ color: "white" }}>Message Text</p>
|
|
47
|
+
<div>
|
|
48
|
+
<BmButton variant="neutral" size="small">
|
|
49
|
+
Label
|
|
50
|
+
</BmButton>
|
|
51
|
+
</div>
|
|
52
|
+
</BmBanner>
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export const FeatureBanner = () => {
|
|
57
|
+
return (
|
|
58
|
+
<BmBanner bannerBg={`${BmSecondaryYellow}`} closeButton>
|
|
59
|
+
<BmTag variant="light">
|
|
60
|
+
<p>New</p>
|
|
61
|
+
</BmTag>
|
|
62
|
+
<h3 style={{ color: "white" }}>New Feature Title</h3>
|
|
63
|
+
<p style={{ color: "white" }}>Message Text</p>
|
|
64
|
+
<div>
|
|
65
|
+
<BmButton size="small">Label</BmButton>
|
|
66
|
+
</div>
|
|
67
|
+
</BmBanner>
|
|
68
|
+
);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export const GenericBanner = () => {
|
|
72
|
+
return (
|
|
73
|
+
<BmBanner border="solid" bannerBg="default" closeButton>
|
|
74
|
+
<h3>New Feature Title</h3>
|
|
75
|
+
<p>Message Text</p>
|
|
76
|
+
<div>
|
|
77
|
+
<BmButton size="small">Label</BmButton>
|
|
78
|
+
</div>
|
|
79
|
+
</BmBanner>
|
|
80
|
+
|
|
81
|
+
);
|
|
82
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { Clear } from "@material-ui/icons";
|
|
3
|
+
import styled from "styled-components";
|
|
4
|
+
import { BmIcons } from "..";
|
|
5
|
+
import { BmGrey50, BmPrimaryBlue } from "../colors";
|
|
6
|
+
|
|
7
|
+
const BannerCardWrapper = styled.div`
|
|
8
|
+
display: ${({ closeButton, show }) => {
|
|
9
|
+
if (!closeButton) {
|
|
10
|
+
return "flex";
|
|
11
|
+
}
|
|
12
|
+
return show ? "flex" : "none";
|
|
13
|
+
}};
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
padding: 0.5rem;
|
|
16
|
+
border: 0.071rem
|
|
17
|
+
${({ border }) => {
|
|
18
|
+
if (border === "dashed") return "dashed";
|
|
19
|
+
if (border === "solid") return "solid";
|
|
20
|
+
return "none";
|
|
21
|
+
}}
|
|
22
|
+
${BmPrimaryBlue};
|
|
23
|
+
border-radius: 0.25rem;
|
|
24
|
+
align-items: ${({ content, closeButton }) => {
|
|
25
|
+
if (!closeButton) {
|
|
26
|
+
if (content === "center") return "center";
|
|
27
|
+
if (content === "left") return "flex-start";
|
|
28
|
+
if (content === "right") return "flex-end";
|
|
29
|
+
return "center";
|
|
30
|
+
}
|
|
31
|
+
}};
|
|
32
|
+
background: ${({ bannerBg }) => {
|
|
33
|
+
if (bannerBg === "default") return `${BmGrey50}`;
|
|
34
|
+
if (!bannerBg) return "none";
|
|
35
|
+
return bannerBg;
|
|
36
|
+
}}};
|
|
37
|
+
> *:not(:last-child) {
|
|
38
|
+
margin-bottom: 0.5rem;
|
|
39
|
+
}
|
|
40
|
+
`;
|
|
41
|
+
|
|
42
|
+
const BannerComponent = styled.div`
|
|
43
|
+
display: flex;
|
|
44
|
+
flex-direction: row;
|
|
45
|
+
justify-content: space-between;
|
|
46
|
+
`;
|
|
47
|
+
|
|
48
|
+
const BmBanner = ({ closeButton, children, ...rest }) => {
|
|
49
|
+
const [show, setShow] = useState(true);
|
|
50
|
+
return (
|
|
51
|
+
<BannerCardWrapper closeButton={closeButton} {...rest} show={show}>
|
|
52
|
+
{closeButton && (
|
|
53
|
+
<BannerComponent>
|
|
54
|
+
{children[0]}{" "}
|
|
55
|
+
<BmIcons
|
|
56
|
+
icon={<Clear />}
|
|
57
|
+
size="small"
|
|
58
|
+
onClick={() => setShow(!show)}
|
|
59
|
+
/>
|
|
60
|
+
</BannerComponent>
|
|
61
|
+
)}
|
|
62
|
+
{closeButton ? children.slice(1) : children}
|
|
63
|
+
</BannerCardWrapper>
|
|
64
|
+
);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export default BmBanner;
|
|
@@ -7,31 +7,27 @@ const BmCard = styled.div`
|
|
|
7
7
|
background: ${BmPrimaryWhite};
|
|
8
8
|
border: 0.071rem solid ${BmGrey400};
|
|
9
9
|
border-radius: 0.25rem;
|
|
10
|
+
> * {
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: row;
|
|
13
|
+
align-items: center;
|
|
14
|
+
justify-content: space-between;
|
|
15
|
+
margin-bottom: 0.5rem;
|
|
16
|
+
}
|
|
17
|
+
|
|
10
18
|
`;
|
|
11
19
|
|
|
12
20
|
BmCard.Header = styled.div`
|
|
13
|
-
|
|
14
|
-
flex-direction: row;
|
|
15
|
-
justify-content: space-between;
|
|
16
|
-
padding: 1rem 1rem 0rem 1rem;
|
|
21
|
+
padding: 0.5rem 0.5rem 0rem 0.5rem;
|
|
17
22
|
`;
|
|
18
23
|
|
|
19
24
|
BmCard.Body = styled.div`
|
|
20
|
-
|
|
21
|
-
flex-direction: row;
|
|
22
|
-
justify-content: space-between;
|
|
23
|
-
margin-top: 0.5rem;
|
|
24
|
-
margin-bottom: 1rem;
|
|
25
|
-
padding: 0rem 1rem;
|
|
25
|
+
padding: 0rem 0.5rem;
|
|
26
26
|
`;
|
|
27
27
|
|
|
28
28
|
BmCard.Footer = styled.div`
|
|
29
|
-
display: flex;
|
|
30
|
-
flex-direction: row;
|
|
31
|
-
justify-content: space-between;
|
|
32
29
|
border-top: 0.071rem solid ${BmGrey400};
|
|
33
|
-
padding:
|
|
34
|
-
align-items: center;
|
|
30
|
+
padding: 0.5rem 0.5rem 0rem 0.5rem;
|
|
35
31
|
`;
|
|
36
32
|
|
|
37
33
|
export default BmCard;
|
|
@@ -1,17 +1,23 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { useState } from "react";
|
|
2
2
|
import Proptypes from "prop-types";
|
|
3
|
-
import { Error, Info, Warning } from "@material-ui/icons";
|
|
3
|
+
import { Clear, Error, Info, Warning } from "@material-ui/icons";
|
|
4
4
|
import styled from "styled-components";
|
|
5
5
|
import {
|
|
6
6
|
BmGrey400,
|
|
7
7
|
BmPrimaryBlue,
|
|
8
8
|
BmSecondaryRed,
|
|
9
9
|
BmPrimaryGold,
|
|
10
|
+
BmSecondaryGrey,
|
|
10
11
|
} from "../colors";
|
|
11
12
|
import { BmIcons } from "../iconStyles";
|
|
12
13
|
|
|
13
14
|
export const NoteBarWrapper = styled.div`
|
|
14
|
-
display:
|
|
15
|
+
display: ${({ closeButton, isOpen }) => {
|
|
16
|
+
if (!closeButton) {
|
|
17
|
+
return "flex";
|
|
18
|
+
}
|
|
19
|
+
return isOpen ? "flex" : "none";
|
|
20
|
+
}};
|
|
15
21
|
flex-direction: row;
|
|
16
22
|
align-items: center;
|
|
17
23
|
padding: 0.5rem 1rem;
|
|
@@ -22,9 +28,17 @@ export const NoteBarWrapper = styled.div`
|
|
|
22
28
|
}
|
|
23
29
|
`;
|
|
24
30
|
|
|
25
|
-
export const BmNoteBar = ({
|
|
31
|
+
export const BmNoteBar = ({
|
|
32
|
+
type,
|
|
33
|
+
children,
|
|
34
|
+
color,
|
|
35
|
+
size,
|
|
36
|
+
closeButton,
|
|
37
|
+
...rest
|
|
38
|
+
}) => {
|
|
39
|
+
const [isOpen, setIsOpen] = useState(true);
|
|
26
40
|
return (
|
|
27
|
-
<NoteBarWrapper {...rest}>
|
|
41
|
+
<NoteBarWrapper closeButton={closeButton} isOpen={isOpen} {...rest}>
|
|
28
42
|
{type === "info" && (
|
|
29
43
|
<BmIcons
|
|
30
44
|
icon={<Info />}
|
|
@@ -47,6 +61,15 @@ export const BmNoteBar = ({ type, children, color, size, ...rest }) => {
|
|
|
47
61
|
/>
|
|
48
62
|
)}
|
|
49
63
|
{children}
|
|
64
|
+
{closeButton && (
|
|
65
|
+
<BmIcons
|
|
66
|
+
icon={<Clear />}
|
|
67
|
+
color={color ? color : `${BmSecondaryGrey}`}
|
|
68
|
+
size={size ? size : "small"}
|
|
69
|
+
style={{ marginLeft: "auto" }}
|
|
70
|
+
onClick={() => setIsOpen(false)}
|
|
71
|
+
/>
|
|
72
|
+
)}
|
|
50
73
|
</NoteBarWrapper>
|
|
51
74
|
);
|
|
52
75
|
};
|
|
@@ -56,4 +79,5 @@ BmNoteBar.propTypes = {
|
|
|
56
79
|
color: Proptypes.string,
|
|
57
80
|
size: Proptypes.string,
|
|
58
81
|
type: Proptypes.string,
|
|
82
|
+
closeButton: Proptypes.bool,
|
|
59
83
|
};
|
|
@@ -26,6 +26,9 @@ export default {
|
|
|
26
26
|
description: "Color of the icon ",
|
|
27
27
|
defaultValue: { summary: undefined },
|
|
28
28
|
},
|
|
29
|
+
closeButton: {
|
|
30
|
+
description: "If present will allow to close the notebar, default size of the icon is small",
|
|
31
|
+
},
|
|
29
32
|
},
|
|
30
33
|
};
|
|
31
34
|
|
|
@@ -38,3 +41,12 @@ NoteBar.args = {
|
|
|
38
41
|
children: <p>NoteBar</p>,
|
|
39
42
|
color: undefined,
|
|
40
43
|
};
|
|
44
|
+
|
|
45
|
+
export const NoteBarWithCloseButton = MainNoteBar.bind({});
|
|
46
|
+
NoteBarWithCloseButton.args = {
|
|
47
|
+
type: "warning",
|
|
48
|
+
size: "large",
|
|
49
|
+
children: <p>NoteBar</p>,
|
|
50
|
+
color: undefined,
|
|
51
|
+
closeButton: true,
|
|
52
|
+
};
|