@thecb/components 2.2.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/.eslintrc.json +29 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +18 -0
- package/.github/stale.yml +17 -0
- package/.prettierignore +3 -0
- package/.tool-versions +1 -0
- package/README.md +149 -0
- package/dist/cb-components.cjs.js +77 -0
- package/package.json +96 -0
- package/rollup.config.js +35 -0
- package/src/components/atoms/alert/Alert.js +67 -0
- package/src/components/atoms/alert/Alert.theme.js +71 -0
- package/src/components/atoms/alert/index.js +3 -0
- package/src/components/atoms/amount-callout/AmountCallout.js +27 -0
- package/src/components/atoms/amount-callout/AmountCallout.theme.js +19 -0
- package/src/components/atoms/amount-callout/index.js +3 -0
- package/src/components/atoms/breadcrumb/Breadcrumb.js +50 -0
- package/src/components/atoms/breadcrumb/Breadcrumb.theme.js +25 -0
- package/src/components/atoms/breadcrumb/index.js +3 -0
- package/src/components/atoms/button-with-action/ButtonWithAction.js +128 -0
- package/src/components/atoms/button-with-action/ButtonWithAction.stories.js +125 -0
- package/src/components/atoms/button-with-action/ButtonWithAction.theme.js +360 -0
- package/src/components/atoms/button-with-action/index.js +3 -0
- package/src/components/atoms/button-with-link/ButtonWithLink.js +40 -0
- package/src/components/atoms/button-with-link/index.js +3 -0
- package/src/components/atoms/checkbox/Checkbox.js +143 -0
- package/src/components/atoms/checkbox/Checkbox.theme.js +54 -0
- package/src/components/atoms/checkbox/index.js +3 -0
- package/src/components/atoms/checkbox-list/CheckboxList.js +129 -0
- package/src/components/atoms/checkbox-list/CheckboxList.theme.js +42 -0
- package/src/components/atoms/checkbox-list/index.js +3 -0
- package/src/components/atoms/country-dropdown/CountryDropdown.js +24 -0
- package/src/components/atoms/country-dropdown/index.js +1 -0
- package/src/components/atoms/country-dropdown/options.js +249 -0
- package/src/components/atoms/display-box/DisplayBox.js +22 -0
- package/src/components/atoms/display-box/DisplayBox.theme.js +9 -0
- package/src/components/atoms/display-box/index.js +3 -0
- package/src/components/atoms/display-card/DisplayCard.js +65 -0
- package/src/components/atoms/display-card/index.js +3 -0
- package/src/components/atoms/dropdown/Dropdown.js +299 -0
- package/src/components/atoms/dropdown/Dropdown.theme.js +9 -0
- package/src/components/atoms/dropdown/DropdownIcon.js +31 -0
- package/src/components/atoms/dropdown/index.js +3 -0
- package/src/components/atoms/form-layouts/FormContainer.js +28 -0
- package/src/components/atoms/form-layouts/FormInput.js +218 -0
- package/src/components/atoms/form-layouts/FormInputColumn.js +15 -0
- package/src/components/atoms/form-layouts/FormInputRow.js +26 -0
- package/src/components/atoms/form-layouts/FormLayouts.theme.js +52 -0
- package/src/components/atoms/form-layouts/index.js +6 -0
- package/src/components/atoms/form-select/FormSelect.js +62 -0
- package/src/components/atoms/form-select/FormSelect.styled.js +65 -0
- package/src/components/atoms/form-select/index.js +3 -0
- package/src/components/atoms/formatted-address/FormattedAddress.js +53 -0
- package/src/components/atoms/formatted-address/FormattedAddress.theme.js +11 -0
- package/src/components/atoms/formatted-address/index.js +3 -0
- package/src/components/atoms/hamburger-button/HamburgerButton.js +113 -0
- package/src/components/atoms/hamburger-button/index.js +3 -0
- package/src/components/atoms/heading/Heading.js +37 -0
- package/src/components/atoms/heading/Heading.styled.js +14 -0
- package/src/components/atoms/heading/Heading.theme.js +18 -0
- package/src/components/atoms/heading/index.js +3 -0
- package/src/components/atoms/icons/AccountsAddIcon.js +42 -0
- package/src/components/atoms/icons/AccountsIcon.js +37 -0
- package/src/components/atoms/icons/AccountsIconSmall.js +63 -0
- package/src/components/atoms/icons/ChevronIcon.js +51 -0
- package/src/components/atoms/icons/ForgotPasswordIcon.js +46 -0
- package/src/components/atoms/icons/GoToEmailIcon.js +31 -0
- package/src/components/atoms/icons/Icons.theme.js +38 -0
- package/src/components/atoms/icons/PaymentMethodIcon.js +42 -0
- package/src/components/atoms/icons/PaymentsIconSmall.js +63 -0
- package/src/components/atoms/icons/ProfileIconSmall.js +44 -0
- package/src/components/atoms/icons/PropertiesAddIcon.js +70 -0
- package/src/components/atoms/icons/PropertiesIconSmall.js +32 -0
- package/src/components/atoms/icons/SettingsIconSmall.js +63 -0
- package/src/components/atoms/icons/VerifiedEmailIcon.js +53 -0
- package/src/components/atoms/icons/index.js +28 -0
- package/src/components/atoms/index.js +33 -0
- package/src/components/atoms/labeled-amount/LabeledAmount.js +35 -0
- package/src/components/atoms/labeled-amount/LabeledAmount.theme.js +10 -0
- package/src/components/atoms/labeled-amount/index.js +3 -0
- package/src/components/atoms/layouts/Box.js +83 -0
- package/src/components/atoms/layouts/Box.styled.js +131 -0
- package/src/components/atoms/layouts/Center.js +28 -0
- package/src/components/atoms/layouts/Center.styled.js +18 -0
- package/src/components/atoms/layouts/Cluster.js +37 -0
- package/src/components/atoms/layouts/Cluster.styled.js +21 -0
- package/src/components/atoms/layouts/Cover.js +49 -0
- package/src/components/atoms/layouts/Cover.styled.js +29 -0
- package/src/components/atoms/layouts/Frame.js +28 -0
- package/src/components/atoms/layouts/Frame.styled.js +27 -0
- package/src/components/atoms/layouts/Grid.js +38 -0
- package/src/components/atoms/layouts/Grid.styled.js +22 -0
- package/src/components/atoms/layouts/Imposter.js +52 -0
- package/src/components/atoms/layouts/Imposter.styled.js +19 -0
- package/src/components/atoms/layouts/Motion.js +51 -0
- package/src/components/atoms/layouts/Motion.styled.js +41 -0
- package/src/components/atoms/layouts/Reel.js +28 -0
- package/src/components/atoms/layouts/Reel.styled.js +17 -0
- package/src/components/atoms/layouts/Sidebar.js +42 -0
- package/src/components/atoms/layouts/Sidebar.styled.js +38 -0
- package/src/components/atoms/layouts/Stack.js +36 -0
- package/src/components/atoms/layouts/Stack.styled.js +30 -0
- package/src/components/atoms/layouts/Switcher.js +64 -0
- package/src/components/atoms/layouts/Switcher.styled.js +44 -0
- package/src/components/atoms/layouts/examples/FixedSizeContainer.js +22 -0
- package/src/components/atoms/layouts/examples/FixedSizeContainer.styled.js +20 -0
- package/src/components/atoms/layouts/examples/LayoutContentBlock.js +27 -0
- package/src/components/atoms/layouts/examples/LayoutContentBlock.styled.js +15 -0
- package/src/components/atoms/layouts/examples/ResizingContainer.js +49 -0
- package/src/components/atoms/layouts/examples/ResizingContainer.styled.js +39 -0
- package/src/components/atoms/layouts/examples/cluster-example/ClusterExample.js +10 -0
- package/src/components/atoms/layouts/examples/cluster-example/ClusterExample.stories.js +97 -0
- package/src/components/atoms/layouts/examples/grid-example/GridExample.js +49 -0
- package/src/components/atoms/layouts/examples/grid-example/GridExample.stories.js +44 -0
- package/src/components/atoms/layouts/examples/sidebar-example/SidebarExample.js +11 -0
- package/src/components/atoms/layouts/examples/sidebar-example/SidebarExample.stories.js +87 -0
- package/src/components/atoms/layouts/examples/stack-example/StackExample.js +27 -0
- package/src/components/atoms/layouts/examples/stack-example/StackExample.stories.js +69 -0
- package/src/components/atoms/layouts/examples/switcher-example/SwitcherExample.js +38 -0
- package/src/components/atoms/layouts/examples/switcher-example/SwitcherExample.stories.js +65 -0
- package/src/components/atoms/layouts/index.js +27 -0
- package/src/components/atoms/line-item/LineItem.js +30 -0
- package/src/components/atoms/line-item/LineItem.theme.js +7 -0
- package/src/components/atoms/line-item/index.js +3 -0
- package/src/components/atoms/link/ExternalLink.js +50 -0
- package/src/components/atoms/link/ExternalLink.styled.js +26 -0
- package/src/components/atoms/link/InternalLink.js +51 -0
- package/src/components/atoms/link/InternalLink.styled.js +39 -0
- package/src/components/atoms/link/Link.theme.js +8 -0
- package/src/components/atoms/link/index.js +4 -0
- package/src/components/atoms/nav-footer/NavFooter.js +57 -0
- package/src/components/atoms/nav-footer/index.js +3 -0
- package/src/components/atoms/nav-header/NavHeader.js +36 -0
- package/src/components/atoms/nav-header/index.js +3 -0
- package/src/components/atoms/paragraph/Paragraph.js +31 -0
- package/src/components/atoms/paragraph/Paragraph.styled.js +13 -0
- package/src/components/atoms/paragraph/Paragraph.theme.js +18 -0
- package/src/components/atoms/paragraph/index.js +3 -0
- package/src/components/atoms/password-requirements/PasswordRequirements.js +116 -0
- package/src/components/atoms/password-requirements/index.js +3 -0
- package/src/components/atoms/placeholder/Placeholder.js +122 -0
- package/src/components/atoms/placeholder/Placeholder.theme.js +9 -0
- package/src/components/atoms/placeholder/index.js +3 -0
- package/src/components/atoms/processing-fee/ProcessingFee.js +43 -0
- package/src/components/atoms/processing-fee/ProcessingFee.theme.js +7 -0
- package/src/components/atoms/processing-fee/index.js +3 -0
- package/src/components/atoms/radio-button/RadioButton.js +101 -0
- package/src/components/atoms/radio-button/RadioButton.theme.js +9 -0
- package/src/components/atoms/radio-button/index.js +3 -0
- package/src/components/atoms/solid-divider/SolidDivider.js +22 -0
- package/src/components/atoms/solid-divider/SolidDivider.theme.js +8 -0
- package/src/components/atoms/solid-divider/index.js +3 -0
- package/src/components/atoms/spinner/Spinner.js +61 -0
- package/src/components/atoms/spinner/Spinner.theme.js +5 -0
- package/src/components/atoms/spinner/index.js +3 -0
- package/src/components/atoms/state-province-dropdown/StateProvinceDropdown.js +28 -0
- package/src/components/atoms/state-province-dropdown/index.js +3 -0
- package/src/components/atoms/state-province-dropdown/options.js +3837 -0
- package/src/components/atoms/text/Text.js +37 -0
- package/src/components/atoms/text/Text.styled.js +32 -0
- package/src/components/atoms/text/Text.theme.js +22 -0
- package/src/components/atoms/text/index.js +3 -0
- package/src/components/atoms/toggle-switch/ToggleSwitch.js +212 -0
- package/src/components/atoms/toggle-switch/ToggleSwitch.theme.js +36 -0
- package/src/components/atoms/toggle-switch/index.js +3 -0
- package/src/components/index.js +3 -0
- package/src/components/molecules/address-form/AddressForm.js +110 -0
- package/src/components/molecules/address-form/AddressForm.state.js +52 -0
- package/src/components/molecules/address-form/index.js +11 -0
- package/src/components/molecules/change-password-form/ChangePasswordForm.js +92 -0
- package/src/components/molecules/change-password-form/ChangePasswordForm.state.js +33 -0
- package/src/components/molecules/change-password-form/index.js +11 -0
- package/src/components/molecules/collapsible-section/CollapsibleSection.js +126 -0
- package/src/components/molecules/collapsible-section/CollapsibleSection.theme.js +11 -0
- package/src/components/molecules/collapsible-section/index.js +3 -0
- package/src/components/molecules/edit-name-form/EditNameForm.js +51 -0
- package/src/components/molecules/edit-name-form/EditNameForm.state.js +14 -0
- package/src/components/molecules/edit-name-form/index.js +11 -0
- package/src/components/molecules/email-form/EmailForm.js +55 -0
- package/src/components/molecules/email-form/EmailForm.state.js +19 -0
- package/src/components/molecules/email-form/index.js +11 -0
- package/src/components/molecules/forgot-password-form/ForgotPasswordForm.js +32 -0
- package/src/components/molecules/forgot-password-form/ForgotPasswordForm.state.js +11 -0
- package/src/components/molecules/forgot-password-form/index.js +11 -0
- package/src/components/molecules/highlight-tab-row/HighlightTabRow.js +62 -0
- package/src/components/molecules/highlight-tab-row/HighlightTabRow.theme.js +7 -0
- package/src/components/molecules/highlight-tab-row/index.js +8 -0
- package/src/components/molecules/index.js +24 -0
- package/src/components/molecules/login-form/LoginForm.js +46 -0
- package/src/components/molecules/login-form/LoginForm.state.js +14 -0
- package/src/components/molecules/login-form/index.js +11 -0
- package/src/components/molecules/modal/Modal.js +138 -0
- package/src/components/molecules/modal/index.js +3 -0
- package/src/components/molecules/module/Module.js +42 -0
- package/src/components/molecules/module/Module.theme.js +30 -0
- package/src/components/molecules/module/index.js +8 -0
- package/src/components/molecules/nav-menu/NavMenu.theme.js +5 -0
- package/src/components/molecules/nav-menu/NavMenuDesktop.js +39 -0
- package/src/components/molecules/nav-menu/NavMenuMobile.js +63 -0
- package/src/components/molecules/nav-menu/index.js +4 -0
- package/src/components/molecules/obligation/Obligation.js +69 -0
- package/src/components/molecules/obligation/icons/AccountBillIcon.js +89 -0
- package/src/components/molecules/obligation/icons/AccountConstructionIcon.js +99 -0
- package/src/components/molecules/obligation/icons/AccountDentalIcon.js +94 -0
- package/src/components/molecules/obligation/icons/AccountElectricIcon.js +99 -0
- package/src/components/molecules/obligation/icons/AccountGarbageIcon.js +94 -0
- package/src/components/molecules/obligation/icons/AccountGasIcon.js +94 -0
- package/src/components/molecules/obligation/icons/AccountGenericIcon.js +89 -0
- package/src/components/molecules/obligation/icons/AccountMedicalIcon.js +94 -0
- package/src/components/molecules/obligation/icons/AccountWaterIcon.js +94 -0
- package/src/components/molecules/obligation/icons/PropertyApartmentIcon.js +99 -0
- package/src/components/molecules/obligation/icons/PropertyBusinessIcon.js +94 -0
- package/src/components/molecules/obligation/icons/PropertyCarIcon.js +99 -0
- package/src/components/molecules/obligation/icons/PropertyCommercialVehicleIcon.js +100 -0
- package/src/components/molecules/obligation/icons/PropertyGarageIcon.js +96 -0
- package/src/components/molecules/obligation/icons/PropertyLandIcon.js +99 -0
- package/src/components/molecules/obligation/icons/PropertyMotorcycleIcon.js +99 -0
- package/src/components/molecules/obligation/icons/PropertyPersonalIcon.js +94 -0
- package/src/components/molecules/obligation/icons/PropertyStorefrontIcon.js +100 -0
- package/src/components/molecules/obligation/icons/index.js +60 -0
- package/src/components/molecules/obligation/index.js +3 -0
- package/src/components/molecules/obligation/modules/AmountModule.js +36 -0
- package/src/components/molecules/obligation/modules/IconModule.js +29 -0
- package/src/components/molecules/obligation/modules/PaymentDetailsActions.js +67 -0
- package/src/components/molecules/obligation/modules/TitleModule.js +25 -0
- package/src/components/molecules/obligation/modules/index.js +6 -0
- package/src/components/molecules/payment-button-bar/PaymentButtonBar.js +80 -0
- package/src/components/molecules/payment-button-bar/index.js +3 -0
- package/src/components/molecules/payment-details/PaymentDetails.js +158 -0
- package/src/components/molecules/payment-details/PaymentDetails.theme.js +11 -0
- package/src/components/molecules/payment-details/index.js +1 -0
- package/src/components/molecules/phone-form/PhoneForm.js +44 -0
- package/src/components/molecules/phone-form/PhoneForm.state.js +17 -0
- package/src/components/molecules/phone-form/index.js +11 -0
- package/src/components/molecules/radio-section/RadioSection.js +205 -0
- package/src/components/molecules/radio-section/RadioSection.theme.js +15 -0
- package/src/components/molecules/radio-section/index.js +3 -0
- package/src/components/molecules/registration-form/RegistrationForm.js +104 -0
- package/src/components/molecules/registration-form/RegistrationForm.state.js +40 -0
- package/src/components/molecules/registration-form/index.js +11 -0
- package/src/components/molecules/reset-confirmation-form/ResetConfirmationForm.js +56 -0
- package/src/components/molecules/reset-confirmation-form/index.js +3 -0
- package/src/components/molecules/reset-password-form/ResetPasswordForm.js +67 -0
- package/src/components/molecules/reset-password-form/ResetPasswordForm.state.js +30 -0
- package/src/components/molecules/reset-password-form/index.js +11 -0
- package/src/components/molecules/reset-password-success/ResetPasswordSuccess.js +55 -0
- package/src/components/molecules/reset-password-success/index.js +3 -0
- package/src/components/molecules/tab-sidebar/TabSidebar.js +92 -0
- package/src/components/molecules/tab-sidebar/TabSidebar.theme.js +9 -0
- package/src/components/molecules/tab-sidebar/index.js +3 -0
- package/src/components/molecules/terms-and-conditions/TermsAndConditions.js +73 -0
- package/src/components/molecules/terms-and-conditions/index.js +3 -0
- package/src/components/molecules/terms-and-conditions-modal/TermsAndConditionsModal.js +64 -0
- package/src/components/molecules/terms-and-conditions-modal/TermsAndConditionsModal.theme.js +28 -0
- package/src/components/molecules/terms-and-conditions-modal/index.js +3 -0
- package/src/components/molecules/workflow-tile/WorkflowTile.js +58 -0
- package/src/components/molecules/workflow-tile/index.js +3 -0
- package/src/components/templates/center-single/CenterSingle.js +61 -0
- package/src/components/templates/center-single/index.js +3 -0
- package/src/components/templates/center-stack/CenterStack.js +49 -0
- package/src/components/templates/center-stack/index.js +3 -0
- package/src/components/templates/default-page-template/DefaultPageTemplate.js +49 -0
- package/src/components/templates/default-page-template/index.js +3 -0
- package/src/components/templates/index.js +5 -0
- package/src/components/templates/sidebar-single-content/SidebarSingleContent.js +60 -0
- package/src/components/templates/sidebar-single-content/index.js +3 -0
- package/src/components/templates/sidebar-stack-content/SidebarStackContent.js +81 -0
- package/src/components/templates/sidebar-stack-content/index.js +3 -0
- package/src/components/templates/templates.theme.js +5 -0
- package/src/components/withWindowSize.js +50 -0
- package/src/constants/colors.js +178 -0
- package/src/constants/regex_constants.js +1 -0
- package/src/constants/style_constants.js +21 -0
- package/src/deprecated/colors.js +154 -0
- package/src/deprecated/components/radio-button/index.js +3 -0
- package/src/deprecated/components/radio-button/radio-button.js +44 -0
- package/src/deprecated/icons/AlertErrorIcon.js +42 -0
- package/src/deprecated/icons/AlertInfoIcon.js +42 -0
- package/src/deprecated/icons/AlertSuccessIcon.js +42 -0
- package/src/deprecated/icons/AlertWarningIcon.js +36 -0
- package/src/deprecated/icons/BankIcon.js +82 -0
- package/src/deprecated/icons/GenericCard.js +39 -0
- package/src/deprecated/icons/IconAdd.js +44 -0
- package/src/deprecated/icons/IconCheck.js +23 -0
- package/src/deprecated/icons/IconCheckEmail.js +46 -0
- package/src/deprecated/icons/IconChevron.js +35 -0
- package/src/deprecated/icons/IconEmailVerified.js +62 -0
- package/src/deprecated/icons/IconEye.js +32 -0
- package/src/deprecated/icons/IconEyeSlash.js +48 -0
- package/src/deprecated/icons/IconInvalid.js +69 -0
- package/src/deprecated/icons/IconNeutral.js +27 -0
- package/src/deprecated/icons/IconQuit.js +32 -0
- package/src/deprecated/icons/IconValid.js +72 -0
- package/src/deprecated/icons/IconWarn.js +28 -0
- package/src/deprecated/icons/index.js +40 -0
- package/src/deprecated/index.js +1 -0
- package/src/deprecated/spinner/Spinner.js +68 -0
- package/src/deprecated/spinner/index.js +1 -0
- package/src/deprecated/utility/__tests__/safeConcat.spec.js +59 -0
- package/src/deprecated/utility/__tests__/validateKeyType.spec.js +116 -0
- package/src/deprecated/utility/index.js +2 -0
- package/src/deprecated/utility/safeConcat.js +10 -0
- package/src/deprecated/utility/validateKeyType.js +19 -0
- package/src/index.js +2 -0
- package/src/util/formats.js +30 -0
- package/src/util/general.js +15 -0
- package/src/util/inputValidationUtils.js +257 -0
- package/src/util/router-utils.js +23 -0
- package/src/util/themeUtils.js +144 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React, { Fragment } from "react";
|
|
2
|
+
import { MotionWrapper } from "./Motion.styled";
|
|
3
|
+
import { safeChildren } from "../../../util/general";
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
Catch-all component for creating animations with Framer Motion library
|
|
7
|
+
Wraps the framer motion "motion.div" with styled components and allows for passing
|
|
8
|
+
of style props, like with all the other layout primitives.
|
|
9
|
+
|
|
10
|
+
Compatible with other layout primitives, you can wrap non-animating primitives in a Motion
|
|
11
|
+
to animate items. See the construction of the Collapsible Section and Radio Section for examples.
|
|
12
|
+
|
|
13
|
+
Motion is intentionally more flexible than our other layout primitives - this was done to avoid
|
|
14
|
+
creating motion versions of each primitive. Usually, the correct approach will be to wrap
|
|
15
|
+
other layout primitives with a Motion in order to animate:
|
|
16
|
+
|
|
17
|
+
<Motion>
|
|
18
|
+
<Cluster>
|
|
19
|
+
stuff...
|
|
20
|
+
</Cluster>
|
|
21
|
+
</Motion>
|
|
22
|
+
|
|
23
|
+
Motion components can be nested in order to animate both a primitive container as well as its
|
|
24
|
+
children:
|
|
25
|
+
|
|
26
|
+
<Motion>
|
|
27
|
+
<Stack>
|
|
28
|
+
<Motion>
|
|
29
|
+
<Box>cool stuff</Box>
|
|
30
|
+
</Motion>
|
|
31
|
+
<Motion>
|
|
32
|
+
<Box>other stuff</Box>
|
|
33
|
+
</Motion>
|
|
34
|
+
</Stack>
|
|
35
|
+
</Motion>
|
|
36
|
+
|
|
37
|
+
This should be sufficient for most scenarios, but if you need to, you have the ability to make Motion act like all of the other primitives using the props provided.
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
export const Motion = ({
|
|
41
|
+
position = "relative",
|
|
42
|
+
padding = "0",
|
|
43
|
+
children,
|
|
44
|
+
...rest
|
|
45
|
+
}) => (
|
|
46
|
+
<MotionWrapper position={position} padding={padding} {...rest}>
|
|
47
|
+
{safeChildren(children, <Fragment />)}
|
|
48
|
+
</MotionWrapper>
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
export default Motion;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
import { motion } from "framer-motion";
|
|
3
|
+
|
|
4
|
+
export const MotionWrapper = styled(motion.div)`
|
|
5
|
+
position: ${({ position }) => position};
|
|
6
|
+
display: ${({ display }) => display};
|
|
7
|
+
box-sizing: border-box;
|
|
8
|
+
padding: ${({ padding }) => padding};
|
|
9
|
+
border: ${({ borderShorthand }) => borderShorthand};
|
|
10
|
+
border-color: ${({ borderColor }) => borderColor};
|
|
11
|
+
border-size: ${({ borderSize }) => borderSize};
|
|
12
|
+
border-style: ${({ borderStyle }) => borderStyle};
|
|
13
|
+
border-width: ${({ borderWidth }) => borderWidth};
|
|
14
|
+
border-radius: ${({ borderRadius }) => borderRadius};
|
|
15
|
+
background-color: ${({ backgroundColor }) => backgroundColor};
|
|
16
|
+
box-shadow: ${({ boxShadow }) => boxShadow};
|
|
17
|
+
min-height: ${({ minHeight }) => minHeight};
|
|
18
|
+
min-width: ${({ minWidth }) => minWidth};
|
|
19
|
+
height: ${({ height }) => height};
|
|
20
|
+
width: ${({ width }) => width};
|
|
21
|
+
text-align: ${({ textAlign }) => textAlign};
|
|
22
|
+
margin: ${({ margin }) => margin};
|
|
23
|
+
|
|
24
|
+
&:hover {
|
|
25
|
+
${({ hoverStyles }) => hoverStyles};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
&:active {
|
|
29
|
+
${({ activeStyles }) => activeStyles};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&:focus {
|
|
33
|
+
${({ focusStyles }) => focusStyles};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&:disabled {
|
|
37
|
+
${({ disabledStyles }) => disabledStyles};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
${({ extraStyles }) => extraStyles};
|
|
41
|
+
`;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React, { Fragment } from "react";
|
|
2
|
+
import { safeChildren } from "../../../util/general";
|
|
3
|
+
import { ReelStyled } from "./Reel.styled";
|
|
4
|
+
|
|
5
|
+
const Reel = ({
|
|
6
|
+
childGap = "1rem",
|
|
7
|
+
height = "auto",
|
|
8
|
+
childWidth = "auto",
|
|
9
|
+
padding = "1rem",
|
|
10
|
+
justifyContent = "flex-start",
|
|
11
|
+
disableScroll = false,
|
|
12
|
+
children,
|
|
13
|
+
...rest
|
|
14
|
+
}) => (
|
|
15
|
+
<ReelStyled
|
|
16
|
+
childGap={childGap}
|
|
17
|
+
height={height}
|
|
18
|
+
childWidth={childWidth}
|
|
19
|
+
padding={padding}
|
|
20
|
+
justifyContent={justifyContent}
|
|
21
|
+
disableScroll={disableScroll}
|
|
22
|
+
{...rest}
|
|
23
|
+
>
|
|
24
|
+
{safeChildren(children, <Fragment />)}
|
|
25
|
+
</ReelStyled>
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
export default Reel;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
|
|
3
|
+
export const ReelStyled = styled.div`
|
|
4
|
+
display: flex;
|
|
5
|
+
overflow-x: ${({ disableScroll }) => (disableScroll ? "hidden" : "auto")};
|
|
6
|
+
padding: ${({ padding }) => padding};
|
|
7
|
+
height: ${({ height }) => height};
|
|
8
|
+
justify-content: ${({ justifyContent }) => justifyContent};
|
|
9
|
+
|
|
10
|
+
> * + * {
|
|
11
|
+
margin-left: ${({ childGap }) => childGap};
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
> * {
|
|
15
|
+
flex: 0 0 ${({ childWidth }) => childWidth};
|
|
16
|
+
}
|
|
17
|
+
`;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React, { Fragment } from "react";
|
|
2
|
+
import { SidebarWrapper, SidebarInnerWrapper } from "./Sidebar.styled";
|
|
3
|
+
import { safeChildren } from "../../../util/general";
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
Component to assist in creating layouts with some element and a sidebar next to it
|
|
7
|
+
Sidebar takes a width value, this is the ideal target with, and what the sidebar
|
|
8
|
+
will be sized to on larger/medium screens
|
|
9
|
+
|
|
10
|
+
The component also takes a content minimum width, this should be a percentage
|
|
11
|
+
it represents the narrowest the content piece can get before the sidebar wraps to
|
|
12
|
+
the top of the layout. If not supplied, the sidebar will size to the width of its content.
|
|
13
|
+
|
|
14
|
+
This can be used for many use cases beyond the typical content/sidebar layout
|
|
15
|
+
Such as for pinning a button/icon next to a form input
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
const Sidebar = ({
|
|
19
|
+
childGap = "1rem",
|
|
20
|
+
width,
|
|
21
|
+
onRight = false,
|
|
22
|
+
contentMinWidth = "50%",
|
|
23
|
+
fullHeight = false,
|
|
24
|
+
minHeight,
|
|
25
|
+
children,
|
|
26
|
+
...rest
|
|
27
|
+
}) => (
|
|
28
|
+
<SidebarWrapper fullHeight={fullHeight} minHeight={minHeight} {...rest}>
|
|
29
|
+
<SidebarInnerWrapper
|
|
30
|
+
childGap={childGap}
|
|
31
|
+
width={width}
|
|
32
|
+
onRight={onRight}
|
|
33
|
+
contentMinWidth={contentMinWidth}
|
|
34
|
+
fullHeight={fullHeight}
|
|
35
|
+
minHeight={minHeight}
|
|
36
|
+
>
|
|
37
|
+
{safeChildren(children, <Fragment />)}
|
|
38
|
+
</SidebarInnerWrapper>
|
|
39
|
+
</SidebarWrapper>
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
export default Sidebar;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
|
|
3
|
+
export const SidebarWrapper = styled.div`
|
|
4
|
+
overflow: visible;
|
|
5
|
+
box-sizing: border-box;
|
|
6
|
+
|
|
7
|
+
${({ fullHeight }) => (fullHeight ? `height: 100%;` : ``)}
|
|
8
|
+
`;
|
|
9
|
+
|
|
10
|
+
export const SidebarInnerWrapper = styled.div`
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-wrap: wrap;
|
|
13
|
+
box-sizing: border-box;
|
|
14
|
+
margin: calc(${({ childGap }) => childGap} / 2 * -1);
|
|
15
|
+
|
|
16
|
+
> * {
|
|
17
|
+
margin: calc(${({ childGap }) => childGap} / 2);
|
|
18
|
+
flex-grow: 1;
|
|
19
|
+
${({ width }) => (width ? `flex-basis: ${width}` : ``)};
|
|
20
|
+
${({ minHeight }) => (minHeight ? `margin-top: 0; margin-bottom: 0;` : ``)}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
${({ onRight, contentMinWidth, childGap }) =>
|
|
24
|
+
onRight
|
|
25
|
+
? `> :first-child {
|
|
26
|
+
flex-basis: 0;
|
|
27
|
+
flex-grow: 999;
|
|
28
|
+
min-width: calc(${contentMinWidth} - ${childGap});
|
|
29
|
+
}
|
|
30
|
+
`
|
|
31
|
+
: `> :last-child {
|
|
32
|
+
flex-basis: 0;
|
|
33
|
+
flex-grow: 999;
|
|
34
|
+
min-width: calc(${contentMinWidth} - ${childGap});
|
|
35
|
+
}`}
|
|
36
|
+
|
|
37
|
+
${({ fullHeight }) => (fullHeight ? `min-height: 100%;` : ``)}
|
|
38
|
+
`;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React, { Fragment } from "react";
|
|
2
|
+
import { StackWrapper } from "./Stack.styled";
|
|
3
|
+
import { safeChildren } from "../../../util/general";
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
Component to impose margin-top between a list of child elements
|
|
7
|
+
Useful for things like sidebars and button lists
|
|
8
|
+
Avoids common pitfalls like having to manually adjust the margin
|
|
9
|
+
on first/last children
|
|
10
|
+
|
|
11
|
+
For more information and diagrams:
|
|
12
|
+
https://every-layout.dev/layouts/stack/
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
const Stack = ({
|
|
16
|
+
childGap = "1rem",
|
|
17
|
+
bottomItem,
|
|
18
|
+
fullHeight = false,
|
|
19
|
+
children,
|
|
20
|
+
direction = "column",
|
|
21
|
+
justify,
|
|
22
|
+
...rest
|
|
23
|
+
}) => (
|
|
24
|
+
<StackWrapper
|
|
25
|
+
childGap={childGap}
|
|
26
|
+
bottomItem={bottomItem}
|
|
27
|
+
fullHeight={fullHeight}
|
|
28
|
+
direction={direction}
|
|
29
|
+
justify={justify}
|
|
30
|
+
{...rest}
|
|
31
|
+
>
|
|
32
|
+
{safeChildren(children, <Fragment />)}
|
|
33
|
+
</StackWrapper>
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
export default Stack;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
|
|
3
|
+
export const StackWrapper = styled.div`
|
|
4
|
+
box-sizing: border-box;
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: ${({ direction }) => direction};
|
|
7
|
+
justify-content: ${({ justify }) => (justify ? justify : "flex-start")};
|
|
8
|
+
height: ${({ fullHeight }) => (fullHeight ? "100%" : "auto")};
|
|
9
|
+
|
|
10
|
+
> * {
|
|
11
|
+
margin-top: 0;
|
|
12
|
+
margin-bottom: 0;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
> * + * {
|
|
16
|
+
${({ direction, childGap }) =>
|
|
17
|
+
direction === "row"
|
|
18
|
+
? `margin-left: ${childGap};`
|
|
19
|
+
: `margin-top: ${childGap};`}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
${({ bottomItem, direction }) =>
|
|
23
|
+
bottomItem
|
|
24
|
+
? `
|
|
25
|
+
> :nth-child(${bottomItem}) {
|
|
26
|
+
${direction === "row" ? "margin-left: auto;" : "margin-top: auto;"}
|
|
27
|
+
}
|
|
28
|
+
`
|
|
29
|
+
: ``};
|
|
30
|
+
`;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React, { Fragment } from "react";
|
|
2
|
+
import { safeChildren } from "../../../util/general";
|
|
3
|
+
import {
|
|
4
|
+
SwitcherOuterContainer,
|
|
5
|
+
SwitcherInnerContainer
|
|
6
|
+
} from "./Switcher.styled";
|
|
7
|
+
|
|
8
|
+
/*
|
|
9
|
+
The Switcher is a component that is used to toggle between wide and narrow
|
|
10
|
+
layouts based on the size of the surrounding container. In the wide layout,
|
|
11
|
+
the children of the Switcher will be sized to the value specified by childSize.
|
|
12
|
+
The point at which the layout switches is specified by the breakpoint prop.
|
|
13
|
+
The space between child elements is specified with
|
|
14
|
+
|
|
15
|
+
In the wide layout, it is possible to specify that a particular child take up
|
|
16
|
+
more space than its siblings. The largeChild prop takes a child number and
|
|
17
|
+
applies the largeChildSize to its flex-grow property.
|
|
18
|
+
|
|
19
|
+
This component also accepts an optional maxChildren prop. This prop specifies the max
|
|
20
|
+
number of children allowed before the component toggles to a vertical list
|
|
21
|
+
layout.
|
|
22
|
+
|
|
23
|
+
In the narrow layout, the children of the Switcher will render as a vertical list
|
|
24
|
+
of width: 100%. This component is best used for scenarios when you want to bypass
|
|
25
|
+
intermediate layouts where children may size differently depending on the number of
|
|
26
|
+
children present in a given row.
|
|
27
|
+
|
|
28
|
+
Use cases for this component include any situation "in which each child element
|
|
29
|
+
should be considered equal, or part of a continuum. E.g., card components listing
|
|
30
|
+
products/services should share the same width no matter the orientation, otherwise
|
|
31
|
+
one or more cards could be perceived as highlighted or featured in some way. Or
|
|
32
|
+
a set of numbered steps in, for example, a list of items to complete or tasks to do."
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
const Switcher = ({
|
|
36
|
+
breakpoint = "30rem",
|
|
37
|
+
childGap = "1rem",
|
|
38
|
+
largeChild,
|
|
39
|
+
largeChildSize,
|
|
40
|
+
maxChildren,
|
|
41
|
+
maxChildrenOnly = false,
|
|
42
|
+
padding = "0",
|
|
43
|
+
children,
|
|
44
|
+
extraStyles,
|
|
45
|
+
...rest
|
|
46
|
+
}) => (
|
|
47
|
+
<SwitcherOuterContainer>
|
|
48
|
+
<SwitcherInnerContainer
|
|
49
|
+
breakpoint={breakpoint}
|
|
50
|
+
childGap={childGap}
|
|
51
|
+
largeChild={largeChild}
|
|
52
|
+
largeChildSize={largeChildSize}
|
|
53
|
+
maxChildren={maxChildren}
|
|
54
|
+
maxChildrenOnly={maxChildrenOnly}
|
|
55
|
+
padding={padding}
|
|
56
|
+
extraStyles={extraStyles}
|
|
57
|
+
{...rest}
|
|
58
|
+
>
|
|
59
|
+
{safeChildren(children, <Fragment />)}
|
|
60
|
+
</SwitcherInnerContainer>
|
|
61
|
+
</SwitcherOuterContainer>
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
export default Switcher;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import styled, { css } from "styled-components";
|
|
2
|
+
|
|
3
|
+
export const SwitcherOuterContainer = styled.div`
|
|
4
|
+
box-sizing: border-box;
|
|
5
|
+
display: block;
|
|
6
|
+
`;
|
|
7
|
+
|
|
8
|
+
export const SwitcherInnerContainer = styled.div`
|
|
9
|
+
box-sizing: border-box;
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-wrap: wrap;
|
|
12
|
+
overflow: hidden;
|
|
13
|
+
padding: ${({ padding }) => padding};
|
|
14
|
+
margin: ${({ childGap }) => `calc((${childGap} / 2) * -1)`};
|
|
15
|
+
|
|
16
|
+
> * {
|
|
17
|
+
flex-grow: 1;
|
|
18
|
+
${({ maxChildrenOnly, breakpoint, childGap }) =>
|
|
19
|
+
!maxChildrenOnly
|
|
20
|
+
? `flex-basis: calc((${breakpoint} - (100% - ${childGap})) * 999);`
|
|
21
|
+
: ``};
|
|
22
|
+
${({ childGap }) => `margin: calc(${childGap} / 2);`}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
${({ largeChild, largeChildSize }) =>
|
|
26
|
+
largeChild && largeChildSize
|
|
27
|
+
? `> :nth-child(${largeChild}) {
|
|
28
|
+
flex-grow: ${largeChildSize};
|
|
29
|
+
}`
|
|
30
|
+
: ``}
|
|
31
|
+
|
|
32
|
+
${({ maxChildren }) =>
|
|
33
|
+
maxChildren
|
|
34
|
+
? `> :nth-last-child(${maxChildren +
|
|
35
|
+
1}), > :nth-last-child(${maxChildren + 1}) ~ * {
|
|
36
|
+
flex-basis: 100%;
|
|
37
|
+
}`
|
|
38
|
+
: ``}
|
|
39
|
+
|
|
40
|
+
${({ extraStyles }) =>
|
|
41
|
+
css`
|
|
42
|
+
${extraStyles}
|
|
43
|
+
`}
|
|
44
|
+
`;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React, { Fragment } from "react";
|
|
2
|
+
import { FixedSize, FloatingLabel } from "./FixedSizeContainer.styled";
|
|
3
|
+
import { safeChildren } from "../../../../util/general";
|
|
4
|
+
import { TROUT_GREY } from "../../../../constants/colors";
|
|
5
|
+
|
|
6
|
+
const FixedSizeContainer = ({
|
|
7
|
+
width,
|
|
8
|
+
height = "auto",
|
|
9
|
+
border = `2px solid ${TROUT_GREY}`,
|
|
10
|
+
floatingLabel,
|
|
11
|
+
margin,
|
|
12
|
+
children
|
|
13
|
+
}) => (
|
|
14
|
+
<FixedSize width={width} height={height} border={border} margin={margin}>
|
|
15
|
+
{safeChildren(children)}
|
|
16
|
+
<Fragment>
|
|
17
|
+
<FloatingLabel>{floatingLabel}</FloatingLabel>
|
|
18
|
+
</Fragment>
|
|
19
|
+
</FixedSize>
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
export default FixedSizeContainer;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
import { TROUT_GREY } from "../../../../constants/colors";
|
|
3
|
+
|
|
4
|
+
export const FixedSize = styled.div`
|
|
5
|
+
box-sizing: border-box;
|
|
6
|
+
width: ${({ width }) => width};
|
|
7
|
+
height: ${({ height }) => height};
|
|
8
|
+
padding: 0.5rem;
|
|
9
|
+
border: ${({ border }) => border};
|
|
10
|
+
border-radius: 4px;
|
|
11
|
+
position: relative;
|
|
12
|
+
margin: ${({ margin }) => margin};
|
|
13
|
+
`;
|
|
14
|
+
|
|
15
|
+
export const FloatingLabel = styled.p`
|
|
16
|
+
position: absolute;
|
|
17
|
+
left: 0.5rem;
|
|
18
|
+
font-size: 1rem;
|
|
19
|
+
color: ${TROUT_GREY};
|
|
20
|
+
`;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { LayoutBlock } from "./LayoutContentBlock.styled";
|
|
3
|
+
import Text from "../../text";
|
|
4
|
+
|
|
5
|
+
const LayoutContentBlock = ({
|
|
6
|
+
layoutName,
|
|
7
|
+
bgColor = "#AAA",
|
|
8
|
+
textColor = "#111",
|
|
9
|
+
borderColor = "#666",
|
|
10
|
+
width = "100%",
|
|
11
|
+
height = "auto",
|
|
12
|
+
padding = "1rem",
|
|
13
|
+
margin
|
|
14
|
+
}) => (
|
|
15
|
+
<LayoutBlock
|
|
16
|
+
width={width}
|
|
17
|
+
height={height}
|
|
18
|
+
bgColor={bgColor}
|
|
19
|
+
borderColor={borderColor}
|
|
20
|
+
padding={padding}
|
|
21
|
+
margin={margin}
|
|
22
|
+
>
|
|
23
|
+
<Text color={textColor}>{layoutName}</Text>
|
|
24
|
+
</LayoutBlock>
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
export default LayoutContentBlock;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
|
|
3
|
+
export const LayoutBlock = styled.div`
|
|
4
|
+
box-sizing: border-box;
|
|
5
|
+
width: ${({ width }) => width};
|
|
6
|
+
height: ${({ height }) => height};
|
|
7
|
+
background-color: ${({ bgColor }) => bgColor};
|
|
8
|
+
border: 2px solid ${({ borderColor }) => borderColor};
|
|
9
|
+
display: flex;
|
|
10
|
+
justify-content: center;
|
|
11
|
+
align-items: center;
|
|
12
|
+
padding: ${({ padding }) => padding};
|
|
13
|
+
max-width: 100%;
|
|
14
|
+
margin: ${({ margin }) => margin};
|
|
15
|
+
`;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React, { useState, useRef, useEffect, Fragment } from "react";
|
|
2
|
+
import {
|
|
3
|
+
ResizeOuterContainer,
|
|
4
|
+
ResizeInnerContainer
|
|
5
|
+
} from "./ResizingContainer.styled";
|
|
6
|
+
import { safeChildren } from "../../../../util/general";
|
|
7
|
+
|
|
8
|
+
const ResizeContainer = ({
|
|
9
|
+
children,
|
|
10
|
+
animate = "pause",
|
|
11
|
+
containerMax = "500px",
|
|
12
|
+
containerMin = "100%",
|
|
13
|
+
padding = "0.5rem"
|
|
14
|
+
}) => {
|
|
15
|
+
const ref = useRef();
|
|
16
|
+
const [width, setWidth] = useState(0);
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
const resizeObserver = new ResizeObserver(entries => {
|
|
19
|
+
if (!Array.isArray(entries)) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
if (!entries.length) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const entry = entries[0];
|
|
26
|
+
setWidth(entry.contentRect.width);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
resizeObserver.observe(ref.current);
|
|
30
|
+
|
|
31
|
+
return () => resizeObserver.unobserve(ref.current);
|
|
32
|
+
}, []);
|
|
33
|
+
console.warn("width is", width);
|
|
34
|
+
return (
|
|
35
|
+
<ResizeOuterContainer>
|
|
36
|
+
<ResizeInnerContainer
|
|
37
|
+
ref={ref}
|
|
38
|
+
animate={animate}
|
|
39
|
+
containerMax={containerMax}
|
|
40
|
+
containerMin={containerMin}
|
|
41
|
+
padding={padding}
|
|
42
|
+
>
|
|
43
|
+
{safeChildren(children, <Fragment />)}
|
|
44
|
+
</ResizeInnerContainer>
|
|
45
|
+
</ResizeOuterContainer>
|
|
46
|
+
);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export default ResizeContainer;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import styled, { keyframes, css } from "styled-components";
|
|
2
|
+
import { TROUT_GREY } from "../../../../constants/colors";
|
|
3
|
+
|
|
4
|
+
const squeeze = (containerMin, containerMax) => keyframes`
|
|
5
|
+
0% {
|
|
6
|
+
width: ${containerMax};
|
|
7
|
+
}
|
|
8
|
+
100% {
|
|
9
|
+
width: ${containerMin};
|
|
10
|
+
}
|
|
11
|
+
`;
|
|
12
|
+
|
|
13
|
+
export const ResizeOuterContainer = styled.div`
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
width: 100%;
|
|
17
|
+
box-sizing: border-box;
|
|
18
|
+
`;
|
|
19
|
+
|
|
20
|
+
export const ResizeInnerContainer = styled.div`
|
|
21
|
+
border: 2px solid ${TROUT_GREY};
|
|
22
|
+
padding: ${({ padding }) => padding};
|
|
23
|
+
box-sizing: border-box;
|
|
24
|
+
margin-left: auto;
|
|
25
|
+
margin-right: auto;
|
|
26
|
+
height: auto;
|
|
27
|
+
overflow-y: auto;
|
|
28
|
+
display: flex;
|
|
29
|
+
flex-direction: column;
|
|
30
|
+
justify-content: center;
|
|
31
|
+
width: ${({ containerMax }) => containerMax};
|
|
32
|
+
${({ animate, containerMin, containerMax }) =>
|
|
33
|
+
animate === "play"
|
|
34
|
+
? css`
|
|
35
|
+
animation: 5s linear infinite alternate
|
|
36
|
+
${squeeze(containerMin, containerMax)};
|
|
37
|
+
`
|
|
38
|
+
: ``};
|
|
39
|
+
`;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { withKnobs, text, radios } from "@storybook/addon-knobs";
|
|
3
|
+
import ClusterExample from "./ClusterExample";
|
|
4
|
+
import Cover from "../../Cover";
|
|
5
|
+
import Center from "../../Center";
|
|
6
|
+
import FixedSizeContainer from "../FixedSizeContainer";
|
|
7
|
+
import ResizingContainer from "../ResizingContainer";
|
|
8
|
+
import LayoutContentBlock from "../LayoutContentBlock";
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
title: "Layouts|Basic Layouts/Cluster",
|
|
12
|
+
component: ClusterExample,
|
|
13
|
+
decorators: [
|
|
14
|
+
withKnobs,
|
|
15
|
+
storyFn => (
|
|
16
|
+
<Cover>
|
|
17
|
+
<div />
|
|
18
|
+
<Center>{storyFn()}</Center>
|
|
19
|
+
<div />
|
|
20
|
+
</Cover>
|
|
21
|
+
)
|
|
22
|
+
]
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const label = "Animate";
|
|
26
|
+
const options = {
|
|
27
|
+
play: "play",
|
|
28
|
+
pause: "pause"
|
|
29
|
+
};
|
|
30
|
+
const defaultValue = "pause";
|
|
31
|
+
const groupID = "RADIO-GROUP-1";
|
|
32
|
+
|
|
33
|
+
export const basicCluster = () => (
|
|
34
|
+
<ResizingContainer
|
|
35
|
+
animate={radios(label, options, defaultValue, groupID)}
|
|
36
|
+
containerMax={text("Container Max", "60rem")}
|
|
37
|
+
containerMin={text("Container Min", "20rem")}
|
|
38
|
+
>
|
|
39
|
+
<ClusterExample justify="space-between" align="center">
|
|
40
|
+
<LayoutContentBlock height="3.5rem" width="8rem" layoutName="City Logo" />
|
|
41
|
+
<ClusterExample justify="flex-start" align="center">
|
|
42
|
+
<LayoutContentBlock
|
|
43
|
+
height="2.5rem"
|
|
44
|
+
width="4.5rem"
|
|
45
|
+
layoutName="Profile"
|
|
46
|
+
/>
|
|
47
|
+
<LayoutContentBlock
|
|
48
|
+
height="2.5rem"
|
|
49
|
+
width="4.5rem"
|
|
50
|
+
layoutName="Settings"
|
|
51
|
+
/>
|
|
52
|
+
<LayoutContentBlock
|
|
53
|
+
height="2.5rem"
|
|
54
|
+
width="4.5rem"
|
|
55
|
+
layoutName="Accounts"
|
|
56
|
+
/>
|
|
57
|
+
</ClusterExample>
|
|
58
|
+
</ClusterExample>
|
|
59
|
+
</ResizingContainer>
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
basicCluster.story = {
|
|
63
|
+
name: "Resizing Nav Cluster"
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export const formButtonCluster = () => (
|
|
67
|
+
<FixedSizeContainer
|
|
68
|
+
width={text("Container Width", "40rem")}
|
|
69
|
+
floatingLabel="Cluster"
|
|
70
|
+
>
|
|
71
|
+
<ClusterExample justify="flex-end" align="center">
|
|
72
|
+
<LayoutContentBlock height="3rem" width="6rem" layoutName="Back" />
|
|
73
|
+
<LayoutContentBlock height="3rem" width="6rem" layoutName="Submit" />
|
|
74
|
+
</ClusterExample>
|
|
75
|
+
</FixedSizeContainer>
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
formButtonCluster.story = {
|
|
79
|
+
name: "Form Button Cluster"
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export const formInputCluster = () => (
|
|
83
|
+
<ResizingContainer
|
|
84
|
+
animate={radios(label, options, defaultValue, groupID)}
|
|
85
|
+
containerMax={text("Container Max", "40rem")}
|
|
86
|
+
containerMin={text("Container Min", "20rem")}
|
|
87
|
+
>
|
|
88
|
+
<ClusterExample justify="flex-start" align="center">
|
|
89
|
+
<LayoutContentBlock height="1.5rem" width="3rem" layoutName="Label" />
|
|
90
|
+
<LayoutContentBlock height="3rem" width="20rem" layoutName="Form Input" />
|
|
91
|
+
</ClusterExample>
|
|
92
|
+
</ResizingContainer>
|
|
93
|
+
);
|
|
94
|
+
|
|
95
|
+
formInputCluster.story = {
|
|
96
|
+
name: "Form Input Cluster"
|
|
97
|
+
};
|