@bloom-housing/ui-components 9.0.3 → 10.0.0
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/__tests__/blocks/ActionBlock.test.js +2 -2
- package/dist/__tests__/blocks/ActionBlock.test.js.map +1 -1
- package/dist/src/actions/ExpandableContent.d.ts +7 -2
- package/dist/src/actions/ExpandableContent.js +10 -4
- package/dist/src/actions/ExpandableContent.js.map +1 -1
- package/dist/src/actions/ExpandableContent.stories.d.ts +1 -0
- package/dist/src/actions/ExpandableContent.stories.js +2 -1
- package/dist/src/actions/ExpandableContent.stories.js.map +1 -1
- package/dist/src/blocks/ActionBlock.d.ts +1 -1
- package/dist/src/blocks/ActionBlock.js +1 -1
- package/dist/src/blocks/ActionBlock.js.map +1 -1
- package/dist/src/blocks/ActionBlock.stories.d.ts +1 -1
- package/dist/src/blocks/ActionBlock.stories.js +8 -7
- package/dist/src/blocks/ActionBlock.stories.js.map +1 -1
- package/package.json +2 -1
- package/src/actions/ExpandableContent.stories.tsx +7 -1
- package/src/actions/ExpandableContent.tsx +15 -3
- package/src/blocks/ActionBlock.scss +2 -2
- package/src/blocks/ActionBlock.stories.tsx +29 -48
- package/src/blocks/ActionBlock.tsx +2 -2
- package/tailwind.config.js +1 -0
|
@@ -6,7 +6,7 @@ import { AppearanceStyleType } from "../../src/global/AppearanceTypes";
|
|
|
6
6
|
afterEach(cleanup);
|
|
7
7
|
describe("<ActionBlock>", function () {
|
|
8
8
|
it("can render with header & subheader", function () {
|
|
9
|
-
var getByText = render(React.createElement(ActionBlock, { header: "My Applications", subheader: "Subheader Text", icon: React.createElement("span", { className: "Action-icon" }), actions: [
|
|
9
|
+
var getByText = render(React.createElement(ActionBlock, { header: React.createElement("h1", null, "My Applications"), subheader: "Subheader Text", icon: React.createElement("span", { className: "Action-icon" }), actions: [
|
|
10
10
|
React.createElement(Button, { onClick: function () { return console.log("click"); }, styleType: AppearanceStyleType.primary, key: "button-1" }, "Action"),
|
|
11
11
|
] })).getByText;
|
|
12
12
|
expect(getByText("My Applications")).not.toBeNull();
|
|
@@ -14,7 +14,7 @@ describe("<ActionBlock>", function () {
|
|
|
14
14
|
expect(getByText("Action")).not.toBeNull();
|
|
15
15
|
});
|
|
16
16
|
it("subheader is hidden for inline layout", function () {
|
|
17
|
-
var _a = render(React.createElement(ActionBlock, { header: "My Applications", subheader: "Subheader Text", icon: React.createElement("span", { className: "Action-icon" }), layout: ActionBlockLayout.inline, actions: [
|
|
17
|
+
var _a = render(React.createElement(ActionBlock, { header: React.createElement("h1", null, "My Applications"), subheader: "Subheader Text", icon: React.createElement("span", { className: "Action-icon" }), layout: ActionBlockLayout.inline, actions: [
|
|
18
18
|
React.createElement(Button, { onClick: function () { return console.log("click"); }, styleType: AppearanceStyleType.primary, key: "button-1" }, "Action"),
|
|
19
19
|
] })), getByText = _a.getByText, container = _a.container;
|
|
20
20
|
expect(getByText("My Applications")).not.toBeNull();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionBlock.test.js","sourceRoot":"","sources":["../../../__tests__/blocks/ActionBlock.test.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"ActionBlock.test.js","sourceRoot":"","sources":["../../../__tests__/blocks/ActionBlock.test.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA;AAC7E,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAA;AAEtE,SAAS,CAAC,OAAO,CAAC,CAAA;AAElB,QAAQ,CAAC,eAAe,EAAE;IACxB,EAAE,CAAC,oCAAoC,EAAE;QAC/B,IAAA,SA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C,yBAAyB,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QAClF,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAA;IAC5C,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
export declare enum Order {
|
|
3
|
+
above = "above",
|
|
4
|
+
below = "below"
|
|
5
|
+
}
|
|
2
6
|
type ExpandableContentProps = {
|
|
3
|
-
children: React.
|
|
7
|
+
children: React.ReactNode;
|
|
4
8
|
strings: {
|
|
5
9
|
readMore?: string;
|
|
6
10
|
readLess?: string;
|
|
7
11
|
};
|
|
8
12
|
className?: string;
|
|
13
|
+
order?: Order;
|
|
9
14
|
};
|
|
10
|
-
declare const ExpandableContent: ({ children, strings, className }: ExpandableContentProps) => JSX.Element;
|
|
15
|
+
declare const ExpandableContent: ({ children, strings, className, order, }: ExpandableContentProps) => JSX.Element;
|
|
11
16
|
export { ExpandableContent as default, ExpandableContent };
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
|
+
export var Order;
|
|
3
|
+
(function (Order) {
|
|
4
|
+
Order["above"] = "above";
|
|
5
|
+
Order["below"] = "below";
|
|
6
|
+
})(Order || (Order = {}));
|
|
2
7
|
var ExpandableContent = function (_a) {
|
|
3
|
-
var children = _a.children, strings = _a.strings, className = _a.className;
|
|
4
|
-
var
|
|
8
|
+
var children = _a.children, strings = _a.strings, className = _a.className, _b = _a.order, order = _b === void 0 ? Order.above : _b;
|
|
9
|
+
var _c = useState(false), isExpanded = _c[0], setExpanded = _c[1];
|
|
5
10
|
var rootClassNames = className ? "".concat(className) : undefined;
|
|
6
11
|
return (React.createElement("div", { className: rootClassNames },
|
|
7
|
-
isExpanded && React.createElement("div", null, children),
|
|
12
|
+
order === Order.above && React.createElement(React.Fragment, null, isExpanded && React.createElement("div", null, children)),
|
|
8
13
|
React.createElement("button", { type: "button", className: "button is-unstyled m-0 no-underline has-toggle", "aria-expanded": isExpanded, onClick: function () {
|
|
9
14
|
setExpanded(!isExpanded);
|
|
10
|
-
} }, isExpanded ? strings.readLess : strings.readMore)
|
|
15
|
+
} }, isExpanded ? strings.readLess : strings.readMore),
|
|
16
|
+
order === Order.below && React.createElement(React.Fragment, null, isExpanded && React.createElement("div", null, children))));
|
|
11
17
|
};
|
|
12
18
|
export { ExpandableContent as default, ExpandableContent };
|
|
13
19
|
//# sourceMappingURL=ExpandableContent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpandableContent.js","sourceRoot":"","sources":["../../../src/actions/ExpandableContent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"ExpandableContent.js","sourceRoot":"","sources":["../../../src/actions/ExpandableContent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEvC,MAAM,CAAN,IAAY,KAGX;AAHD,WAAY,KAAK;IACf,wBAAe,CAAA;IACf,wBAAe,CAAA;AACjB,CAAC,EAHW,KAAK,KAAL,KAAK,QAGhB;AAYD,IAAM,iBAAiB,GAAG,UAAC,EAKF;QAJvB,QAAQ,cAAA,EACR,OAAO,aAAA,EACP,SAAS,eAAA,EACT,aAAmB,EAAnB,KAAK,mBAAG,KAAK,CAAC,KAAK,KAAA;IAEb,IAAA,KAA4B,QAAQ,CAAC,KAAK,CAAC,EAA1C,UAAU,QAAA,EAAE,WAAW,QAAmB,CAAA;IACjD,IAAM,cAAc,GAAG,SAAS,CAAC,CAAC,CAAC,UAAG,SAAS,CAAE,CAAC,CAAC,CAAC,SAAS,CAAA;IAE7D,OAAO,CACL,6BAAK,SAAS,EAAE,cAAc;QAC3B,KAAK,KAAK,KAAK,CAAC,KAAK,IAAI,0CAAG,UAAU,IAAI,iCAAM,QAAQ,CAAO,CAAI;QACpE,gCACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,gDAAgD,mBAC3C,UAAU,EACzB,OAAO,EAAE;gBACP,WAAW,CAAC,CAAC,UAAU,CAAC,CAAA;YAC1B,CAAC,IAEA,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAC1C;QACR,KAAK,KAAK,KAAK,CAAC,KAAK,IAAI,0CAAG,UAAU,IAAI,iCAAM,QAAQ,CAAO,CAAI,CAChE,CACP,CAAA;AACH,CAAC,CAAA;AAED,OAAO,EAAE,iBAAiB,IAAI,OAAO,EAAE,iBAAiB,EAAE,CAAA"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { ExpandableContent } from "./ExpandableContent";
|
|
2
|
+
import { ExpandableContent, Order } from "./ExpandableContent";
|
|
3
3
|
export default {
|
|
4
4
|
title: "Actions/Expandable Content",
|
|
5
5
|
};
|
|
6
6
|
var content = React.createElement("div", { className: "mb-2" }, "Sample Content");
|
|
7
7
|
export var standard = function () { return (React.createElement(ExpandableContent, { strings: { readMore: "read more", readLess: "read less" } }, content)); };
|
|
8
|
+
export var below = function () { return (React.createElement(ExpandableContent, { strings: { readMore: "read more", readLess: "read less" }, order: Order.below }, content)); };
|
|
8
9
|
//# sourceMappingURL=ExpandableContent.stories.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpandableContent.stories.js","sourceRoot":"","sources":["../../../src/actions/ExpandableContent.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"ExpandableContent.stories.js","sourceRoot":"","sources":["../../../src/actions/ExpandableContent.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAE9D,eAAe;IACb,KAAK,EAAE,4BAA4B;CACpC,CAAA;AAED,IAAM,OAAO,GAAG,6BAAK,SAAS,EAAE,MAAM,qBAAsB,CAAA;AAE5D,MAAM,CAAC,IAAM,QAAQ,GAAG,cAAM,OAAA,CAC5B,oBAAC,iBAAiB,IAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,IACzE,OAAO,CACU,CACrB,EAJ6B,CAI7B,CAAA;AAED,MAAM,CAAC,IAAM,KAAK,GAAG,cAAM,OAAA,CACzB,oBAAC,iBAAiB,IAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,IAC7F,OAAO,CACU,CACrB,EAJ0B,CAI1B,CAAA"}
|
|
@@ -25,7 +25,7 @@ var ActionBlock = function (_a) {
|
|
|
25
25
|
return (React.createElement("div", { className: actionBlockClasses.join(" ") },
|
|
26
26
|
React.createElement("div", { className: "action-block__head" },
|
|
27
27
|
icon && React.createElement("div", { className: "action-block__icon" }, icon),
|
|
28
|
-
React.createElement("
|
|
28
|
+
React.createElement("div", { className: "action-block__header" }, header),
|
|
29
29
|
subheader && layout === ActionBlockLayout.block && (React.createElement("p", { className: "action-block__subheader" }, subheader))),
|
|
30
30
|
React.createElement("div", { className: "action-block__actions" }, actions)));
|
|
31
31
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionBlock.js","sourceRoot":"","sources":["../../../src/blocks/ActionBlock.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,oBAAoB,CAAA;AAE3B,MAAM,CAAN,IAAY,iBAGX;AAHD,WAA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,OAAO,CAAO,CAClD,CACP,CAAA;AACH,CAAC,CAAA;AACD,OAAO,EAAE,WAAW,IAAI,OAAO,EAAE,WAAW,EAAE,CAAA"}
|
|
@@ -3,7 +3,7 @@ declare const _default: {
|
|
|
3
3
|
};
|
|
4
4
|
export default _default;
|
|
5
5
|
export declare const blockWithIcon: () => JSX.Element;
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const blockNoIconNoBackground: () => JSX.Element;
|
|
7
7
|
export declare const blockWithDarkerBg: () => JSX.Element;
|
|
8
8
|
export declare const blockWithSubheader: () => JSX.Element;
|
|
9
9
|
export declare const inlineBlock: () => JSX.Element;
|
|
@@ -3,28 +3,29 @@ import ActionBlock, { ActionBlockLayout } from "./ActionBlock";
|
|
|
3
3
|
import { Button } from "../..";
|
|
4
4
|
import { AppearanceStyleType } from "../global/AppearanceTypes";
|
|
5
5
|
import Icon from "../icons/Icon";
|
|
6
|
+
import Heading from "../text/Heading";
|
|
6
7
|
export default {
|
|
7
8
|
title: "Blocks/Action Block",
|
|
8
9
|
};
|
|
9
|
-
export var blockWithIcon = function () { return (React.createElement(ActionBlock, { header: "Action
|
|
10
|
+
export var blockWithIcon = function () { return (React.createElement(ActionBlock, { header: React.createElement(Heading, { priority: 2 }, "Action Block"), background: "primary-lighter", icon: React.createElement(Icon, { size: "3xl", symbol: "mail" }), actions: [
|
|
10
11
|
React.createElement(Button, { onClick: function () { return console.log("click"); }, styleType: AppearanceStyleType.primary }, "Action"),
|
|
11
12
|
] })); };
|
|
12
|
-
export var
|
|
13
|
+
export var blockNoIconNoBackground = function () { return (React.createElement(ActionBlock, { header: React.createElement(Heading, { priority: 2 }, "Full length headline text that spans the block"), actions: [
|
|
13
14
|
React.createElement(Button, { onClick: function () { return console.log("click"); }, styleType: AppearanceStyleType.info }, "Button"),
|
|
14
15
|
] })); };
|
|
15
|
-
export var blockWithDarkerBg = function () { return (React.createElement(ActionBlock, { header: "Action
|
|
16
|
+
export var blockWithDarkerBg = function () { return (React.createElement(ActionBlock, { header: React.createElement(Heading, { priority: 2 }, "Action Block"), icon: React.createElement(Icon, { size: "3xl", symbol: "mail" }), background: "primary-darker", actions: [
|
|
16
17
|
React.createElement(Button, { onClick: function () { return console.log("click"); }, styleType: AppearanceStyleType.primary }, "Action"),
|
|
17
18
|
React.createElement(Button, { onClick: function () { return console.log("click"); }, styleType: AppearanceStyleType.info }, "Action"),
|
|
18
19
|
] })); };
|
|
19
|
-
export var blockWithSubheader = function () { return (React.createElement(ActionBlock, { header: "Full length headline text that spans the block", subheader: "Brunch leggings trust fund tattooed, flannel sustainable man braid venmo. ", icon: React.createElement(Icon, { size: "3xl", symbol: "mail" }), background: "primary-lighter", actions: [React.createElement(Button, { onClick: function () { return console.log("click"); } }, "Action")] })); };
|
|
20
|
-
export var inlineBlock = function () { return (React.createElement(ActionBlock, { header: "See more listings from our community partners", icon: React.createElement(Icon, { size: "3xl", symbol: "mail" }), background: "primary-lighter", layout: ActionBlockLayout.inline, actions: [
|
|
20
|
+
export var blockWithSubheader = function () { return (React.createElement(ActionBlock, { header: React.createElement(Heading, { priority: 2 }, "Full length headline text that spans the block"), subheader: "Brunch leggings trust fund tattooed, flannel sustainable man braid venmo. ", icon: React.createElement(Icon, { size: "3xl", symbol: "mail" }), background: "primary-lighter", actions: [React.createElement(Button, { onClick: function () { return console.log("click"); } }, "Action")] })); };
|
|
21
|
+
export var inlineBlock = function () { return (React.createElement(ActionBlock, { header: React.createElement(Heading, { priority: 2 }, "See more listings from our community partners"), icon: React.createElement(Icon, { size: "3xl", symbol: "mail" }), background: "primary-lighter", layout: ActionBlockLayout.inline, actions: [
|
|
21
22
|
React.createElement(Button, { onClick: function () { return console.log("click"); }, styleType: AppearanceStyleType.primary }, "Action"),
|
|
22
23
|
] })); };
|
|
23
|
-
export var inlineBlockWith2actions = function () { return (React.createElement(ActionBlock, { header: "Find more listings on our website", background: "primary-darker", layout: ActionBlockLayout.inline, actions: [
|
|
24
|
+
export var inlineBlockWith2actions = function () { return (React.createElement(ActionBlock, { header: React.createElement(Heading, { priority: 2 }, "Find more listings on our website"), background: "primary-darker", layout: ActionBlockLayout.inline, actions: [
|
|
24
25
|
React.createElement(Button, { onClick: function () { return console.log("click"); } }, "First Come, First Served"),
|
|
25
26
|
React.createElement(Button, { onClick: function () { return console.log("click"); } }, "First Come, First Served"),
|
|
26
27
|
] })); };
|
|
27
|
-
export var inlineBlockWith2actionsAsLinks = function () { return (React.createElement(ActionBlock, { header: "Find more listings on our website
|
|
28
|
+
export var inlineBlockWith2actionsAsLinks = function () { return (React.createElement(ActionBlock, { header: React.createElement(Heading, { priority: 2 }, "Find more listings on our website"), background: "primary-darker", layout: ActionBlockLayout.inline, actions: [
|
|
28
29
|
React.createElement("a", { className: "button", key: "action-1", href: "https://google.com" }, "First come, first served"),
|
|
29
30
|
React.createElement("a", { className: "button", key: "action-2", href: "https://google.com" }, "City Second loan program"),
|
|
30
31
|
] })); };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionBlock.stories.js","sourceRoot":"","sources":["../../../src/blocks/ActionBlock.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"ActionBlock.stories.js","sourceRoot":"","sources":["../../../src/blocks/ActionBlock.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,WAAW,EAAE,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAC/D,OAAO,IAAI,MAAM,eAAe,CAAA;AAChC,OAAO,OAAO,MAAM,iBAAiB,CAAA;AAErC,eAAe;IACb,KAAK,EAAE,qBAAqB;CAC7B,CAAA;AAED,MAAM,CAAC,IAAM,aAAa,GAAG,cAAM,OAAA,CACjC,oBAAC,WAAW,IACV,MAAM,EAAE,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GAAG,CAAC,OAAO,CAAC,EAApB,CAAoB,+BAAmC;QAC9E,oBAAC,MAAM,IAAC,OAAO,EAAE,cAAM,OAAA,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,EAApB,CAAoB,+BAAmC;KAC/E,GACY,CAChB,EAV4C,CAU5C,CAAA;AAED,MAAM,CAAC,IAAM,8BAA8B,GAAG,cAAM,OAAA,CAClD,oBAAC,WAAW,IACV,MAAM,EAAE,oBAAC,OAAO,IAAC,QAAQ,EAAE,CAAC,wCAA6C,EACzE,UAAU,EAAC,gBAAgB,EAC3B,MAAM,EAAE,iBAAiB,CAAC,MAAM,EAChC,OAAO,EAAE;QACP,2BAAG,SAAS,EAAC,QAAQ,EAAC,GAAG,EAAC,UAAU,EAAC,IAAI,EAAE,oBAAoB,IAC5D,0BAA0B,CACzB;QACJ,2BAAG,SAAS,EAAC,QAAQ,EAAC,GAAG,EAAC,UAAU,EAAC,IAAI,EAAE,oBAAoB,IAC5D,0BAA0B,CACzB;KACL,GACY,CAChB,EAdmD,CAcnD,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bloom-housing/ui-components",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.0.0",
|
|
4
4
|
"author": "Sean Albert <sean.albert@exygy.com>",
|
|
5
5
|
"description": "Shared user interface components for Bloom affordable housing system",
|
|
6
6
|
"homepage": "https://github.com/bloom-housing/ui-components",
|
|
@@ -109,6 +109,7 @@
|
|
|
109
109
|
"sass-loader": "^10.0.3",
|
|
110
110
|
"semantic-release": "19.0.5",
|
|
111
111
|
"style-loader": "^1.1.3",
|
|
112
|
+
"tailwindcss-rtl": "^0.9.0",
|
|
112
113
|
"ts-jest": "^26.4.1",
|
|
113
114
|
"ts-loader": "^8.0.4",
|
|
114
115
|
"typescript": "^4.9.4",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react"
|
|
2
2
|
|
|
3
|
-
import { ExpandableContent } from "./ExpandableContent"
|
|
3
|
+
import { ExpandableContent, Order } from "./ExpandableContent"
|
|
4
4
|
|
|
5
5
|
export default {
|
|
6
6
|
title: "Actions/Expandable Content",
|
|
@@ -13,3 +13,9 @@ export const standard = () => (
|
|
|
13
13
|
{content}
|
|
14
14
|
</ExpandableContent>
|
|
15
15
|
)
|
|
16
|
+
|
|
17
|
+
export const below = () => (
|
|
18
|
+
<ExpandableContent strings={{ readMore: "read more", readLess: "read less" }} order={Order.below}>
|
|
19
|
+
{content}
|
|
20
|
+
</ExpandableContent>
|
|
21
|
+
)
|
|
@@ -1,21 +1,32 @@
|
|
|
1
1
|
import React, { useState } from "react"
|
|
2
2
|
|
|
3
|
+
export enum Order {
|
|
4
|
+
above = "above",
|
|
5
|
+
below = "below",
|
|
6
|
+
}
|
|
7
|
+
|
|
3
8
|
type ExpandableContentProps = {
|
|
4
|
-
children: React.
|
|
9
|
+
children: React.ReactNode
|
|
5
10
|
strings: {
|
|
6
11
|
readMore?: string
|
|
7
12
|
readLess?: string
|
|
8
13
|
}
|
|
9
14
|
className?: string
|
|
15
|
+
order?: Order
|
|
10
16
|
}
|
|
11
17
|
|
|
12
|
-
const ExpandableContent = ({
|
|
18
|
+
const ExpandableContent = ({
|
|
19
|
+
children,
|
|
20
|
+
strings,
|
|
21
|
+
className,
|
|
22
|
+
order = Order.above,
|
|
23
|
+
}: ExpandableContentProps) => {
|
|
13
24
|
const [isExpanded, setExpanded] = useState(false)
|
|
14
25
|
const rootClassNames = className ? `${className}` : undefined
|
|
15
26
|
|
|
16
27
|
return (
|
|
17
28
|
<div className={rootClassNames}>
|
|
18
|
-
{isExpanded && <div>{children}</div>}
|
|
29
|
+
{order === Order.above && <>{isExpanded && <div>{children}</div>}</>}
|
|
19
30
|
<button
|
|
20
31
|
type="button"
|
|
21
32
|
className="button is-unstyled m-0 no-underline has-toggle"
|
|
@@ -26,6 +37,7 @@ const ExpandableContent = ({ children, strings, className }: ExpandableContentPr
|
|
|
26
37
|
>
|
|
27
38
|
{isExpanded ? strings.readLess : strings.readMore}
|
|
28
39
|
</button>
|
|
40
|
+
{order === Order.below && <>{isExpanded && <div>{children}</div>}</>}
|
|
29
41
|
</div>
|
|
30
42
|
)
|
|
31
43
|
}
|
|
@@ -1,112 +1,93 @@
|
|
|
1
|
-
import React from "react"
|
|
2
|
-
import ActionBlock, { ActionBlockLayout } from "./ActionBlock"
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
1
|
+
import React from "react"
|
|
2
|
+
import ActionBlock, { ActionBlockLayout } from "./ActionBlock"
|
|
3
|
+
import { Button } from "../.."
|
|
4
|
+
import { AppearanceStyleType } from "../global/AppearanceTypes"
|
|
5
|
+
import Icon from "../icons/Icon"
|
|
6
|
+
import Heading from "../text/Heading"
|
|
7
7
|
|
|
8
8
|
export default {
|
|
9
9
|
title: "Blocks/Action Block",
|
|
10
|
-
}
|
|
10
|
+
}
|
|
11
11
|
|
|
12
12
|
export const blockWithIcon = () => (
|
|
13
13
|
<ActionBlock
|
|
14
|
-
header=
|
|
14
|
+
header={<Heading priority={2}>Action Block</Heading>}
|
|
15
15
|
background="primary-lighter"
|
|
16
16
|
icon={<Icon size="3xl" symbol="mail" />}
|
|
17
17
|
actions={[
|
|
18
|
-
<Button
|
|
19
|
-
onClick={() => console.log("click")}
|
|
20
|
-
styleType={AppearanceStyleType.primary}
|
|
21
|
-
>
|
|
18
|
+
<Button onClick={() => console.log("click")} styleType={AppearanceStyleType.primary}>
|
|
22
19
|
Action
|
|
23
20
|
</Button>,
|
|
24
21
|
]}
|
|
25
22
|
></ActionBlock>
|
|
26
|
-
)
|
|
23
|
+
)
|
|
27
24
|
|
|
28
|
-
export const
|
|
25
|
+
export const blockNoIconNoBackground = () => (
|
|
29
26
|
<ActionBlock
|
|
30
|
-
header=
|
|
27
|
+
header={<Heading priority={2}>Full length headline text that spans the block</Heading>}
|
|
31
28
|
actions={[
|
|
32
|
-
<Button
|
|
33
|
-
onClick={() => console.log("click")}
|
|
34
|
-
styleType={AppearanceStyleType.info}
|
|
35
|
-
>
|
|
29
|
+
<Button onClick={() => console.log("click")} styleType={AppearanceStyleType.info}>
|
|
36
30
|
Button
|
|
37
31
|
</Button>,
|
|
38
32
|
]}
|
|
39
33
|
></ActionBlock>
|
|
40
|
-
)
|
|
34
|
+
)
|
|
41
35
|
|
|
42
36
|
export const blockWithDarkerBg = () => (
|
|
43
37
|
<ActionBlock
|
|
44
|
-
header=
|
|
38
|
+
header={<Heading priority={2}>Action Block</Heading>}
|
|
45
39
|
icon={<Icon size="3xl" symbol="mail" />}
|
|
46
40
|
background="primary-darker"
|
|
47
41
|
actions={[
|
|
48
|
-
<Button
|
|
49
|
-
onClick={() => console.log("click")}
|
|
50
|
-
styleType={AppearanceStyleType.primary}
|
|
51
|
-
>
|
|
42
|
+
<Button onClick={() => console.log("click")} styleType={AppearanceStyleType.primary}>
|
|
52
43
|
Action
|
|
53
44
|
</Button>,
|
|
54
|
-
<Button
|
|
55
|
-
onClick={() => console.log("click")}
|
|
56
|
-
styleType={AppearanceStyleType.info}
|
|
57
|
-
>
|
|
45
|
+
<Button onClick={() => console.log("click")} styleType={AppearanceStyleType.info}>
|
|
58
46
|
Action
|
|
59
47
|
</Button>,
|
|
60
48
|
]}
|
|
61
49
|
></ActionBlock>
|
|
62
|
-
)
|
|
50
|
+
)
|
|
63
51
|
|
|
64
52
|
export const blockWithSubheader = () => (
|
|
65
53
|
<ActionBlock
|
|
66
|
-
header=
|
|
54
|
+
header={<Heading priority={2}>Full length headline text that spans the block</Heading>}
|
|
67
55
|
subheader="Brunch leggings trust fund tattooed, flannel sustainable man braid venmo. "
|
|
68
56
|
icon={<Icon size="3xl" symbol="mail" />}
|
|
69
57
|
background="primary-lighter"
|
|
70
58
|
actions={[<Button onClick={() => console.log("click")}>Action</Button>]}
|
|
71
59
|
></ActionBlock>
|
|
72
|
-
)
|
|
60
|
+
)
|
|
73
61
|
|
|
74
62
|
export const inlineBlock = () => (
|
|
75
63
|
<ActionBlock
|
|
76
|
-
header=
|
|
64
|
+
header={<Heading priority={2}>See more listings from our community partners</Heading>}
|
|
77
65
|
icon={<Icon size="3xl" symbol="mail" />}
|
|
78
66
|
background="primary-lighter"
|
|
79
67
|
layout={ActionBlockLayout.inline}
|
|
80
68
|
actions={[
|
|
81
|
-
<Button
|
|
82
|
-
onClick={() => console.log("click")}
|
|
83
|
-
styleType={AppearanceStyleType.primary}
|
|
84
|
-
>
|
|
69
|
+
<Button onClick={() => console.log("click")} styleType={AppearanceStyleType.primary}>
|
|
85
70
|
Action
|
|
86
71
|
</Button>,
|
|
87
72
|
]}
|
|
88
73
|
></ActionBlock>
|
|
89
|
-
)
|
|
74
|
+
)
|
|
90
75
|
|
|
91
76
|
export const inlineBlockWith2actions = () => (
|
|
92
77
|
<ActionBlock
|
|
93
|
-
header=
|
|
78
|
+
header={<Heading priority={2}>Find more listings on our website</Heading>}
|
|
94
79
|
background="primary-darker"
|
|
95
80
|
layout={ActionBlockLayout.inline}
|
|
96
81
|
actions={[
|
|
97
|
-
<Button onClick={() => console.log("click")}>
|
|
98
|
-
|
|
99
|
-
</Button>,
|
|
100
|
-
<Button onClick={() => console.log("click")}>
|
|
101
|
-
First Come, First Served
|
|
102
|
-
</Button>,
|
|
82
|
+
<Button onClick={() => console.log("click")}>First Come, First Served</Button>,
|
|
83
|
+
<Button onClick={() => console.log("click")}>First Come, First Served</Button>,
|
|
103
84
|
]}
|
|
104
85
|
></ActionBlock>
|
|
105
|
-
)
|
|
86
|
+
)
|
|
106
87
|
|
|
107
88
|
export const inlineBlockWith2actionsAsLinks = () => (
|
|
108
89
|
<ActionBlock
|
|
109
|
-
header=
|
|
90
|
+
header={<Heading priority={2}>Find more listings on our website</Heading>}
|
|
110
91
|
background="primary-darker"
|
|
111
92
|
layout={ActionBlockLayout.inline}
|
|
112
93
|
actions={[
|
|
@@ -118,4 +99,4 @@ export const inlineBlockWith2actionsAsLinks = () => (
|
|
|
118
99
|
</a>,
|
|
119
100
|
]}
|
|
120
101
|
></ActionBlock>
|
|
121
|
-
)
|
|
102
|
+
)
|
|
@@ -15,7 +15,7 @@ interface ActionBlockProps {
|
|
|
15
15
|
actions: React.ReactNode[]
|
|
16
16
|
background?: string
|
|
17
17
|
className?: string
|
|
18
|
-
header:
|
|
18
|
+
header: React.ReactNode
|
|
19
19
|
icon?: React.ReactNode
|
|
20
20
|
layout?: ActionBlockLayout
|
|
21
21
|
subheader?: string
|
|
@@ -41,7 +41,7 @@ const ActionBlock = ({
|
|
|
41
41
|
<div className={actionBlockClasses.join(" ")}>
|
|
42
42
|
<div className="action-block__head">
|
|
43
43
|
{icon && <div className="action-block__icon">{icon}</div>}
|
|
44
|
-
<
|
|
44
|
+
<div className={"action-block__header"}>{header}</div>
|
|
45
45
|
{subheader && layout === ActionBlockLayout.block && (
|
|
46
46
|
<p className="action-block__subheader">{subheader}</p>
|
|
47
47
|
)}
|