@thecb/components 3.1.4-beta.0 → 3.1.10

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.
Files changed (76) hide show
  1. package/.storybook/page.js +5 -4
  2. package/.tool-versions +1 -0
  3. package/dist/index.cjs.js +113 -100
  4. package/package.json +5 -5
  5. package/src/components/atoms/alert/Alert.stories.js +28 -0
  6. package/src/components/atoms/amount-callout/AmountCallout.stories.js +41 -0
  7. package/src/components/atoms/amount-callout/AmountCallout.theme.js +4 -4
  8. package/src/components/atoms/breadcrumb/Breadcrumb.stories.js +38 -0
  9. package/src/components/atoms/button-with-link/ButtonWithLink.stories.js +32 -0
  10. package/src/components/atoms/checkbox/Checkbox.stories.js +29 -0
  11. package/src/components/atoms/checkbox-list/CheckboxList.stories.js +50 -0
  12. package/src/components/atoms/country-dropdown/CountryDropdown.stories.js +42 -0
  13. package/src/components/atoms/display-box/DisplayBox.stories.js +25 -0
  14. package/src/components/atoms/display-card/DisplayCard.js +2 -0
  15. package/src/components/atoms/display-card/DisplayCard.stories.js +24 -0
  16. package/src/components/atoms/form-layouts/FormLayouts.stories.js +72 -0
  17. package/src/components/atoms/form-select/FormSelect.stories.js +44 -0
  18. package/src/components/atoms/formatted-address/FormattedAddress.js +1 -3
  19. package/src/components/atoms/formatted-address/FormattedAddress.stories.js +32 -0
  20. package/src/components/atoms/hamburger-button/HamburgerButton.js +7 -1
  21. package/src/components/atoms/hamburger-button/HamburgerButton.stories.js +21 -0
  22. package/src/components/atoms/heading/Heading.stories.js +20 -0
  23. package/src/components/atoms/icons/icons.stories.js +50 -0
  24. package/src/components/atoms/labeled-amount/LabeledAmount.js +1 -1
  25. package/src/components/atoms/labeled-amount/LabeledAmount.stories.js +29 -0
  26. package/src/components/atoms/layouts/Cluster.js +2 -0
  27. package/src/components/atoms/layouts/Cluster.styled.js +1 -1
  28. package/src/components/atoms/layouts/examples/ResizingContainer.js +3 -1
  29. package/src/components/atoms/layouts/examples/ResizingContainer.styled.js +1 -1
  30. package/src/components/atoms/layouts/examples/box-example/BoxExample.stories.js +58 -0
  31. package/src/components/atoms/layouts/examples/center-example/CenterExample.stories.js +28 -0
  32. package/src/components/atoms/layouts/examples/cover-example/CoverExample.stories.js +53 -0
  33. package/src/components/atoms/layouts/examples/frame-example/FrameExample.stories.js +22 -0
  34. package/src/components/atoms/layouts/examples/imposter-example/ImposterExample.stories.js +35 -0
  35. package/src/components/atoms/layouts/examples/motion-example/MotionExample.stories.js +62 -0
  36. package/src/components/atoms/layouts/examples/reel-example/ReelExample.stories.js +57 -0
  37. package/src/components/atoms/line-item/LineItem.js +2 -2
  38. package/src/components/atoms/line-item/LineItem.stories.js +19 -0
  39. package/src/components/atoms/link/ExternalLink.js +1 -3
  40. package/src/components/atoms/link/InternalLink.styled.js +0 -2
  41. package/src/components/atoms/link/Link.stories.js +57 -0
  42. package/src/components/atoms/link/Link.theme.js +3 -2
  43. package/src/components/atoms/nav-footer/NavFooter.stories.js +31 -0
  44. package/src/components/atoms/nav-header/NavHeader.stories.js +29 -0
  45. package/src/components/atoms/paragraph/Paragraph.stories.js +34 -0
  46. package/src/components/atoms/paragraph/Paragraph.theme.js +6 -2
  47. package/src/components/atoms/password-requirements/PasswordRequirements.stories.js +75 -0
  48. package/src/components/atoms/placeholder/Placeholder.js +16 -16
  49. package/src/components/atoms/placeholder/Placeholder.stories.js +38 -0
  50. package/src/components/atoms/processing-fee/ProcessingFee.stories.js +28 -0
  51. package/src/components/atoms/solid-divider/SolidDivider.stories.js +11 -0
  52. package/src/components/atoms/spinner/Spinner.stories.js +17 -0
  53. package/src/components/atoms/state-province-dropdown/StateProvinceDropdown.stories.js +52 -0
  54. package/src/components/atoms/text/Text.stories.js +34 -0
  55. package/src/components/atoms/text/Text.theme.js +6 -2
  56. package/src/components/molecules/collapsible-section/CollapsibleSection.js +2 -1
  57. package/src/components/molecules/collapsible-section/CollapsibleSection.stories.js +68 -0
  58. package/src/components/molecules/highlight-tab-row/HighlightTabRow.js +8 -3
  59. package/src/components/molecules/highlight-tab-row/HighlightTabRow.stories.js +30 -0
  60. package/src/components/molecules/highlight-tab-row/index.js +1 -6
  61. package/src/components/molecules/modal/Modal.stories.js +44 -0
  62. package/src/components/molecules/module/Module.js +6 -2
  63. package/src/components/molecules/module/Module.stories.js +31 -0
  64. package/src/components/molecules/module/index.js +1 -6
  65. package/src/components/molecules/obligation/Obligation.js +1 -1
  66. package/src/components/molecules/obligation/modules/AmountModule.js +6 -2
  67. package/src/components/molecules/payment-button-bar/PaymentButtonBar.stories.js +20 -0
  68. package/src/components/molecules/payment-details/PaymentDetails.stories.js +71 -0
  69. package/src/components/molecules/radio-section/RadioSection.stories.js +31 -0
  70. package/src/components/molecules/tab-sidebar/TabSidebar.stories.js +59 -0
  71. package/src/components/molecules/terms-and-conditions/TermsAndConditions.stories.js +24 -0
  72. package/src/components/molecules/terms-and-conditions-modal/TermsAndConditionsModal.stories.js +31 -0
  73. package/src/components/molecules/workflow-tile/WorkflowTile.stories.js +25 -0
  74. package/dist/cb-components.esm.js +0 -23576
  75. package/dist/cb-components.js +0 -94714
  76. package/dist/index.esm.js +0 -36084
@@ -0,0 +1,38 @@
1
+ import React from "react";
2
+ import { text, select } from "@storybook/addon-knobs";
3
+ import Placeholder from "./Placeholder";
4
+ import page from "../../../../.storybook/page";
5
+
6
+ const variantsLabel = "variant";
7
+ const variants = {
8
+ default: "default",
9
+ large: "large"
10
+ };
11
+ const defaultValue = "default";
12
+ const groupId = "props";
13
+
14
+ const icons = {
15
+ accounts: "accounts",
16
+ properties: "properties"
17
+ };
18
+
19
+ const iconLabel = "largeIcon";
20
+
21
+ const defaultIcon = "accounts";
22
+
23
+ export const placeholder = () => (
24
+ <Placeholder
25
+ variant={select(variantsLabel, variants, defaultValue, groupId)}
26
+ isLink
27
+ destination={text("destination", "add-account", "props")}
28
+ text={text("text", "Add an Account", "props")}
29
+ largeIcon={select(iconLabel, icons, defaultIcon, groupId)}
30
+ key="placeholder"
31
+ />
32
+ );
33
+
34
+ const story = page({
35
+ title: "Components|Atoms/Placeholder",
36
+ Component: Placeholder
37
+ });
38
+ export default story;
@@ -0,0 +1,28 @@
1
+ import React from "react";
2
+ import { text, select, boolean } from "@storybook/addon-knobs";
3
+ import ProcessingFee from "./ProcessingFee";
4
+ import page from "../../../../.storybook/page";
5
+
6
+ const feeTypes = {
7
+ flat: "FLAT",
8
+ percentage: "PERCENTAGE",
9
+ None: undefined
10
+ };
11
+ const defaultValue = "FLAT";
12
+ const groupId = "props";
13
+
14
+ export const processingFee = () => (
15
+ <ProcessingFee
16
+ feeValue={text("feeValue", "0", groupId)}
17
+ feeName={text("feeName", "Credit Card", groupId)}
18
+ feeType={select("feeTypes", feeTypes, defaultValue, groupId)}
19
+ feeMinimum={text("feeMinimum", "0", groupId)}
20
+ hide={boolean("hide", false, groupId)}
21
+ />
22
+ );
23
+
24
+ const story = page({
25
+ title: "Components|Atoms/ProcessingFee",
26
+ Component: ProcessingFee
27
+ });
28
+ export default story;
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ import SolidDivider from "./SolidDivider";
3
+ import page from "../../../../.storybook/page";
4
+
5
+ export const solidDivider = () => <SolidDivider />;
6
+
7
+ const story = page({
8
+ title: "Components|Atoms/SolidDivider",
9
+ Component: SolidDivider
10
+ });
11
+ export default story;
@@ -0,0 +1,17 @@
1
+ import React from "react";
2
+ import { text } from "@storybook/addon-knobs";
3
+ import Spinner from "./Spinner";
4
+ import { Box } from "../layouts";
5
+ import page from "../../../../.storybook/page";
6
+
7
+ export const spinner = () => (
8
+ <Box>
9
+ <Spinner size={text("size", "100", "props")} />
10
+ </Box>
11
+ );
12
+
13
+ const story = page({
14
+ title: "Components|Atoms/Spinner",
15
+ Component: Spinner
16
+ });
17
+ export default story;
@@ -0,0 +1,52 @@
1
+ import React from "react";
2
+ import { connect } from "react-redux";
3
+ import { text, boolean } from "@storybook/addon-knobs";
4
+ import { createFormState, required } from "redux-freeform";
5
+
6
+ import StateProvinceDropDown from ".";
7
+ import page from "../../../../.storybook/page";
8
+
9
+ const { mapStateToProps, mapDispatchToProps, reducer } = createFormState({
10
+ state: {
11
+ validators: [required()]
12
+ }
13
+ });
14
+ const errorMessages = {
15
+ [required.error]: "State is required"
16
+ };
17
+
18
+ const story = page({
19
+ title: "Components|Atoms/StateProvinceDropDown",
20
+ Component: StateProvinceDropDown,
21
+ reducer,
22
+ mapStateToProps,
23
+ mapDispatchToProps,
24
+ height: "500px"
25
+ });
26
+
27
+ const FormWrapper = ({
28
+ fields,
29
+ actions,
30
+ countryCode,
31
+ labelTextWhenNoError,
32
+ showErrors
33
+ }) => (
34
+ <StateProvinceDropDown
35
+ errorMessages={errorMessages}
36
+ field={fields.state}
37
+ fieldActions={actions.fields.state}
38
+ countryCode={countryCode}
39
+ labelTextWhenNoError={labelTextWhenNoError}
40
+ showErrors={showErrors}
41
+ />
42
+ );
43
+
44
+ export default story;
45
+ const ConnectedForm = connect(mapStateToProps, mapDispatchToProps)(FormWrapper);
46
+ export const stateProvinceDropDown = () => (
47
+ <ConnectedForm
48
+ labelTextWhenNoError={text("State/Province", "", "props")}
49
+ countryCode={text("countryCode", "US", "props")}
50
+ showErrors={boolean("showErrors", false, "props")}
51
+ />
52
+ );
@@ -0,0 +1,34 @@
1
+ import React from "react";
2
+ import { text as storybookText, number, select } from "@storybook/addon-knobs";
3
+
4
+ import Text from "./Text";
5
+ import page from "../../../../.storybook/page";
6
+ import {
7
+ FONT_WEIGHT_BOLD,
8
+ FONT_WEIGHT_SEMIBOLD,
9
+ FONT_WEIGHT_REGULAR
10
+ } from "../../../constants/style_constants";
11
+ import * as colors from "../../../constants/colors";
12
+
13
+ const fontWeights = {
14
+ FONT_WEIGHT_BOLD,
15
+ FONT_WEIGHT_SEMIBOLD,
16
+ FONT_WEIGHT_REGULAR
17
+ };
18
+ export const text = () => (
19
+ <Text
20
+ extraStyles={storybookText("extraStyles", "text-align: center;", "props")}
21
+ margin={number("margin", 0, { min: 0, max: 99 }, "props")}
22
+ weight={select("weight", fontWeights, 400, "props")}
23
+ color={select("activeColor", colors, "black", "props")}
24
+ hoverStyles={storybookText("hoverStyles", "color: blue;", "props")}
25
+ >
26
+ {storybookText("children", "Lorem Ipsum", "props")}
27
+ </Text>
28
+ );
29
+
30
+ const story = page({
31
+ title: "Components|Atoms/Text",
32
+ Component: Text
33
+ });
34
+ export default story;
@@ -1,6 +1,10 @@
1
1
  const fontFamily = {
2
- primary: "Public Sans",
3
- secondary: "Open Sans"
2
+ p: "Public Sans",
3
+ pL: "Public Sans",
4
+ pS: "Public Sans",
5
+ pXS: "Public Sans",
6
+ pXXS: "Public Sans",
7
+ pXL: "Public Sans"
4
8
  };
5
9
 
6
10
  // Text uses the same variants as paragraph
@@ -15,6 +15,7 @@ const CollapsibleSection = ({
15
15
  isMobile,
16
16
  supportsTouch,
17
17
  title,
18
+ customPadding,
18
19
  initiallyOpen = true,
19
20
  openHeight = "auto",
20
21
  children,
@@ -69,7 +70,7 @@ const CollapsibleSection = ({
69
70
  >
70
71
  <Stack childGap={isOpen ? "0.5rem" : "0rem"}>
71
72
  <Box
72
- padding="0"
73
+ padding={customPadding ? customPadding : "0"}
73
74
  background={themeValues.headingBackgroundColor}
74
75
  onClick={isMobile && supportsTouch ? noop : toggleSection}
75
76
  onTouchEnd={isMobile && supportsTouch ? toggleSection : noop}
@@ -0,0 +1,68 @@
1
+ import React, { useState } from "react";
2
+ import { text, boolean } from "@storybook/addon-knobs";
3
+ import CollapsibleSection from "./CollapsibleSection";
4
+ import DisplayCard from "../../atoms/display-card";
5
+ import { Stack, Motion } from "../../atoms/layouts";
6
+ import page from "../../../../.storybook/page";
7
+
8
+ const content = {
9
+ open: {
10
+ x: "0",
11
+ opacity: 1
12
+ },
13
+ closed: {
14
+ x: "-7.5%",
15
+ opacity: 0
16
+ }
17
+ };
18
+ export const collapsibleSection = () => {
19
+ const [open, setOpen] = useState(false);
20
+ return (
21
+ <CollapsibleSection
22
+ title={text("title", "Collapsible Section Storybook", "props")}
23
+ toggleSection={() => setOpen(!open)}
24
+ initiallyOpen={boolean("initiallyOpen", false, "props")}
25
+ isOpen={open}
26
+ key="security-section"
27
+ >
28
+ <Stack childGap="16px">
29
+ <Motion
30
+ padding="0"
31
+ variants={content}
32
+ transition={{ duration: 0.3 }}
33
+ positionTransition
34
+ extraStyles={`transform-origin: 100% 0;`}
35
+ >
36
+ <DisplayCard
37
+ title="Password"
38
+ item="•••••••••••••"
39
+ buttonText="Change Password"
40
+ link
41
+ url=""
42
+ />
43
+ </Motion>
44
+ <Motion
45
+ padding="0"
46
+ variants={content}
47
+ transition={{ duration: 0.3 }}
48
+ positionTransition
49
+ extraStyles={`transform-origin: 100% 0;`}
50
+ >
51
+ <DisplayCard
52
+ title="Name"
53
+ item="Hello Citybase"
54
+ buttonText="Edit Name"
55
+ link
56
+ url=""
57
+ />
58
+ </Motion>
59
+ </Stack>
60
+ </CollapsibleSection>
61
+ );
62
+ };
63
+ const story = page({
64
+ title: "Components|Molecules/CollapsibleSection",
65
+ Component: CollapsibleSection
66
+ });
67
+
68
+ export default story;
@@ -1,10 +1,13 @@
1
- import React from "react";
2
-
1
+ import React, { memo } from "react";
3
2
  import { repeat } from "ramda";
3
+
4
+ import { fallbackValues } from "./HighlightTabRow.theme";
5
+ import { themeComponent } from "../../../util/themeUtils";
4
6
  import { Reel, Box } from "../../atoms/layouts";
5
7
  import Text from "../../atoms/text";
6
8
  import { FONT_WEIGHT_SEMIBOLD } from "../../../constants/style_constants";
7
9
 
10
+ // this component needs some fix'n
8
11
  const HighlightTabRow = ({ tabs, highlightIndex, themeValues, isMobile }) => {
9
12
  const itemsAfterIndex = tabs.slice(highlightIndex).length - 1;
10
13
  const itemsBeforeIndex = tabs.slice(0, highlightIndex).length;
@@ -59,4 +62,6 @@ const HighlightTabRow = ({ tabs, highlightIndex, themeValues, isMobile }) => {
59
62
  );
60
63
  };
61
64
 
62
- export default HighlightTabRow;
65
+ export default memo(
66
+ themeComponent(HighlightTabRow, "HighlightTabRow", fallbackValues)
67
+ );
@@ -0,0 +1,30 @@
1
+ import React from "react";
2
+ import { text, boolean, object } from "@storybook/addon-knobs";
3
+ import HighlightTabRow from "./HighlightTabRow";
4
+ import page from "../../../../.storybook/page";
5
+
6
+ const groupId = "props";
7
+
8
+ export const highlightTabRow = () => (
9
+ <HighlightTabRow
10
+ tabs={object(
11
+ "tabs",
12
+ [
13
+ "Payment Amount",
14
+ "Payment Method",
15
+ "Customer Information",
16
+ "Payment Confirmation"
17
+ ],
18
+ groupId
19
+ )}
20
+ highlightIndex={text("highlightIndex", "0", groupId)}
21
+ isMobile={boolean("isMobile", false, groupId)}
22
+ />
23
+ );
24
+
25
+ const story = page({
26
+ title: "Components|Molecules/HighlightTabRow",
27
+ Component: HighlightTabRow,
28
+ containerMax: "80rem"
29
+ });
30
+ export default story;
@@ -1,8 +1,3 @@
1
- import { memo } from "react";
2
1
  import HighlightTabRow from "./HighlightTabRow";
3
- import { themeComponent } from "../../../util/themeUtils";
4
- import { fallbackValues } from "./HighlightTabRow.theme";
5
2
 
6
- export default memo(
7
- themeComponent(HighlightTabRow, "HighlightTabRow", fallbackValues)
8
- );
3
+ export default HighlightTabRow;
@@ -0,0 +1,44 @@
1
+ import React from "react";
2
+ import { text, boolean } from "@storybook/addon-knobs";
3
+ import Modal from "./Modal";
4
+
5
+ import page from "../../../../.storybook/page";
6
+
7
+ import Text from "../../atoms/text";
8
+ import { noop } from "../../../util/general";
9
+
10
+ const groupId = "props";
11
+ export const modal = () => (
12
+ <Modal
13
+ ModalLink={() => (
14
+ <Text
15
+ onClick={noop}
16
+ color={"#347BB2"}
17
+ fontSize="18px"
18
+ lineHeight="2rem"
19
+ extraStyles={`cursor: pointer;`}
20
+ >
21
+ Modal Link
22
+ </Text>
23
+ )}
24
+ hideModal={noop}
25
+ continueAction={noop}
26
+ modalOpen={boolean("modalOpen", false, groupId)}
27
+ modalHeaderText={text("modalHeaderText", "Modal Header Text", groupId)}
28
+ modalBodyText={text("modalBodyText", "Modal Body Text", groupId)}
29
+ cancelButtonText={text("cancelButtonText", "Cancel", groupId)}
30
+ continueButtonText={text("continueButtonText", "Continue", groupId)}
31
+ modalHeaderBg={text("modalHeaderBg", "white", groupId)}
32
+ modalBodyBg={text("modalBodyBg", "#F6F6F9", groupId)}
33
+ useDangerButton={boolean("useDangerButton", false, groupId)}
34
+ defaultWrapper={boolean("defaultWrapper", true, groupId)}
35
+ onlyCloseButton={boolean("onlyCloseButton", false, groupId)}
36
+ maxHeight={text("maxHeight", null, groupId)}
37
+ />
38
+ );
39
+
40
+ const story = page({
41
+ title: "Components|Molecules/Modal",
42
+ Component: Modal
43
+ });
44
+ export default story;
@@ -1,4 +1,6 @@
1
- import React, { Fragment } from "react";
1
+ import React, { Fragment, memo } from "react";
2
+ import { themeComponent } from "../../../util/themeUtils";
3
+ import { fallbackValues } from "./Module.theme";
2
4
  import Heading from "../../atoms/heading";
3
5
  import { Box } from "../../atoms/layouts";
4
6
 
@@ -37,4 +39,6 @@ const Module = ({
37
39
  </Fragment>
38
40
  );
39
41
 
40
- export default Module;
42
+ export default memo(
43
+ themeComponent(Module, "Module", fallbackValues, "default")
44
+ );
@@ -0,0 +1,31 @@
1
+ import React from "react";
2
+ import { text, select } from "@storybook/addon-knobs";
3
+ import Module from "./Module";
4
+ import page from "../../../../.storybook/page";
5
+
6
+ const variantsLabel = "variant";
7
+ const variants = {
8
+ default: "default",
9
+ largeTitle: "largeTitle",
10
+ None: undefined
11
+ };
12
+ const defaultValue = "default";
13
+ const groupId = "props";
14
+
15
+ export const module = () => (
16
+ <Module
17
+ variant={select(variantsLabel, variants, defaultValue, groupId)}
18
+ heading={text("heading", "Module Title", groupId)}
19
+ spacing={text("spacing", "1rem", groupId)}
20
+ padding={text("padding", "1rem", groupId)}
21
+ spacingBottom={text("spacingBottom", "2.5rem", groupId)}
22
+ >
23
+ {text("child components", "child components go here", groupId)}
24
+ </Module>
25
+ );
26
+
27
+ const story = page({
28
+ title: "Components|Atoms/Module",
29
+ Component: Module
30
+ });
31
+ export default story;
@@ -1,8 +1,3 @@
1
- import { memo } from "react";
2
1
  import Module from "./Module";
3
- import { themeComponent } from "../../../util/themeUtils";
4
- import { fallbackValues } from "./Module.theme";
5
2
 
6
- export default memo(
7
- themeComponent(Module, "Module", fallbackValues, "default")
8
- );
3
+ export default Module;
@@ -25,7 +25,7 @@ const Obligation = ({
25
25
  >
26
26
  <Stack childGap="14px">
27
27
  <Box key={`${obligations[0].id}-top`} padding="0 8px" minWidth="100%">
28
- <Cluster justify="space-between" align="center" childGap="4px">
28
+ <Cluster justify="space-between" align="center" childGap="4px" nowrap>
29
29
  <Box padding="0">
30
30
  <Cluster justify="flex-start" align="center">
31
31
  {!isMobile && (
@@ -12,7 +12,11 @@ import { displayCurrency } from "../../../../util/general";
12
12
  const AmountModule = ({ totalAmountDue, autoPayEnabled, isMobile }) => (
13
13
  <Box padding="0 0.25rem 0 0">
14
14
  <Stack childGap="0">
15
- <Text variant="pS" weight={FONT_WEIGHT_SEMIBOLD}>
15
+ <Text
16
+ variant="pS"
17
+ weight={FONT_WEIGHT_SEMIBOLD}
18
+ extraStyles={`text-align: right;`}
19
+ >
16
20
  {isMobile ? "Total Due" : "Total Amount Due"}
17
21
  </Text>
18
22
  <AmountCallout
@@ -24,7 +28,7 @@ const AmountModule = ({ totalAmountDue, autoPayEnabled, isMobile }) => (
24
28
  variant="p"
25
29
  weight={FONT_WEIGHT_REGULAR}
26
30
  color={REGENT_GREY}
27
- extraStyles={`font-style: italic`}
31
+ extraStyles={`font-style: italic; text-align: right;`}
28
32
  >
29
33
  {isMobile ? "Autopay On" : "Autopay Enabled"}
30
34
  </Text>
@@ -0,0 +1,20 @@
1
+ import React from "react";
2
+ import { text, boolean } from "@storybook/addon-knobs";
3
+ import PaymentButtonBar from "./PaymentButtonBar";
4
+ import page from "../../../../.storybook/page";
5
+
6
+ export const paymentButtonBar = () => (
7
+ <PaymentButtonBar
8
+ forwardButtonText={text("forwardButtonText", "Next", "props")}
9
+ cancelText={text("cancelText", "Cancel", "props")}
10
+ backButtonAction={() => {}}
11
+ forwardButtonAction={() => {}}
12
+ forwardButtonLoading={boolean("forwardButtonLoading", false, "props")}
13
+ />
14
+ );
15
+
16
+ const story = page({
17
+ title: "Components|Molecules/PaymentButtonBar",
18
+ Component: PaymentButtonBar
19
+ });
20
+ export default story;
@@ -0,0 +1,71 @@
1
+ import React from "react";
2
+ import { text, boolean } from "@storybook/addon-knobs";
3
+ import PaymentDetails from "./PaymentDetails";
4
+ import page from "../../../../.storybook/page";
5
+
6
+ const payment = {
7
+ fees: [
8
+ {
9
+ amount: 1739.12,
10
+ label: "Service Fee"
11
+ }
12
+ ],
13
+ lineItems: [
14
+ {
15
+ amount: 77294,
16
+ customAttributes: [
17
+ {
18
+ key: "parcel_id",
19
+ value: "71-83-630-216-0724"
20
+ },
21
+ {
22
+ key: "property_city",
23
+ value: "North Breana"
24
+ },
25
+ {
26
+ key: "property_class",
27
+ value: "7-91"
28
+ },
29
+ {
30
+ key: "property_secondary_address",
31
+ value: "79"
32
+ },
33
+ {
34
+ key: "property_street_address",
35
+ value: "0034 Bednar Mission"
36
+ },
37
+ {
38
+ key: "property_zip_code",
39
+ value: "80326-6917"
40
+ },
41
+ {
42
+ key: "tax_rate",
43
+ value: "7.076"
44
+ }
45
+ ],
46
+ description: "0034 Bednar Mission Unit: 79",
47
+ quantity: 1,
48
+ subDescription: "PIN: 71-83-630-216-0724"
49
+ }
50
+ ],
51
+ subtotal: 77294,
52
+ total: 79033
53
+ };
54
+
55
+ export const paymentDetails = () => (
56
+ <PaymentDetails
57
+ subtotal={text("subtotal", payment.subtotal, "props")}
58
+ lineItems={payment.lineItems}
59
+ fees={payment.fees}
60
+ total={text("total", payment.total, "props")}
61
+ collapsibleOnMobile={boolean("collapsibleOnMobile", false, "props")}
62
+ initiallyOpen={boolean("initiallyOpen", true, "props")}
63
+ hideTitle={boolean("hideTitle", false, "props")}
64
+ />
65
+ );
66
+
67
+ const story = page({
68
+ title: "Components|Molecules/PaymentDetails",
69
+ Component: PaymentDetails
70
+ });
71
+ export default story;
@@ -0,0 +1,31 @@
1
+ import React, { useState } from "react";
2
+ import { text, boolean } from "@storybook/addon-knobs";
3
+
4
+ import RadioSection from "./RadioSection";
5
+ import page from "../../../../.storybook/page";
6
+
7
+ const story = page({
8
+ title: "Components|Atoms/RadioSection",
9
+ Component: RadioSection
10
+ });
11
+ export default story;
12
+
13
+ const sections = [
14
+ { id: "foo", title: "Foo", content: <div>Content 0</div> },
15
+ { id: "bar", title: "Bar", content: <div>Content 1</div> },
16
+ { id: "baz", title: "Baz", content: <div>Content 2</div> }
17
+ ];
18
+
19
+ export const radioSection = () => {
20
+ const [openSection, setOpenSection] = useState("");
21
+ return (
22
+ <RadioSection
23
+ isMobile={boolean("isMobile", false, "props")}
24
+ supportsTouch={boolean("isMobile", false, "props")}
25
+ toggleOpenSection={setOpenSection}
26
+ openSection={openSection}
27
+ staggeredAnimation={boolean("staggeredAnimation", false, "props")}
28
+ sections={sections}
29
+ />
30
+ );
31
+ };
@@ -0,0 +1,59 @@
1
+ import React, { Fragment } from "react";
2
+ import { boolean, object } from "@storybook/addon-knobs";
3
+ import TabSidebar from "./TabSidebar";
4
+
5
+ import page from "../../../../.storybook/page";
6
+
7
+ import * as Icons from "../../atoms/icons";
8
+
9
+ const groupId = "props";
10
+
11
+ const defaultLinks = [
12
+ {
13
+ route: "/profile/accounts",
14
+ text: "Accounts",
15
+ active: true,
16
+ icon: "AccountsIconSmall"
17
+ },
18
+ {
19
+ route: "/profile/settings",
20
+ text: "Settings",
21
+ active: false,
22
+ icon: "SettingsIconSmall"
23
+ },
24
+ {
25
+ route: "/profile/properties",
26
+ text: "Properties",
27
+ active: false,
28
+ icon: "PropertiesIconSmall"
29
+ }
30
+ ];
31
+
32
+ const isRouteActive = route => location.pathname.includes(route);
33
+
34
+ // should TabSidebar be updated to just take the name of an icon per tab? instead of a full component
35
+ const getIcon = link => {
36
+ const Icon = Icons[link.icon];
37
+ return Icon ? (
38
+ <Icon variant={isRouteActive(link) ? "primary" : "secondary"} />
39
+ ) : (
40
+ <Fragment />
41
+ );
42
+ };
43
+
44
+ export const tabSidebar = () => {
45
+ let links = object("links", defaultLinks, groupId);
46
+
47
+ return (
48
+ <TabSidebar
49
+ links={links.map(link => ({ ...link, icon: getIcon(link) }))}
50
+ isMobile={boolean("isMobile", false, groupId)}
51
+ />
52
+ );
53
+ };
54
+
55
+ const story = page({
56
+ title: "Components|Molecules/TabSidebar",
57
+ Component: TabSidebar
58
+ });
59
+ export default story;