@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,49 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import Grid from "../../Grid";
|
|
4
|
+
import Stack from "../../Stack";
|
|
5
|
+
import FixedSizeContainer from "../FixedSizeContainer";
|
|
6
|
+
import LayoutContentBlock from "../LayoutContentBlock";
|
|
7
|
+
|
|
8
|
+
const generateChildren = number => {
|
|
9
|
+
let childArray = [];
|
|
10
|
+
for (let count = 0; count < number; count++) {
|
|
11
|
+
childArray = [
|
|
12
|
+
...childArray,
|
|
13
|
+
<FixedSizeContainer
|
|
14
|
+
key={`card-${count}`}
|
|
15
|
+
width="12rem"
|
|
16
|
+
height="14rem"
|
|
17
|
+
margin="0 0 1rem 0"
|
|
18
|
+
>
|
|
19
|
+
<Stack fullHeight bottomItem={3}>
|
|
20
|
+
<LayoutContentBlock key="1" height="2rem" layoutName="Card Title" />
|
|
21
|
+
<LayoutContentBlock
|
|
22
|
+
key="2"
|
|
23
|
+
height="6rem"
|
|
24
|
+
layoutName={`Card Content ${count + 1}`}
|
|
25
|
+
/>
|
|
26
|
+
<LayoutContentBlock key="3" height="2rem" layoutName="Card Footer" />
|
|
27
|
+
</Stack>
|
|
28
|
+
</FixedSizeContainer>
|
|
29
|
+
];
|
|
30
|
+
}
|
|
31
|
+
return childArray;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const GridExample = ({
|
|
35
|
+
minColWidth,
|
|
36
|
+
maxColWidth,
|
|
37
|
+
columnGap = "0.5rem",
|
|
38
|
+
numChildren
|
|
39
|
+
}) => (
|
|
40
|
+
<Grid
|
|
41
|
+
minColWidth={minColWidth}
|
|
42
|
+
maxColWidth={maxColWidth}
|
|
43
|
+
columnGap={columnGap}
|
|
44
|
+
>
|
|
45
|
+
{generateChildren(numChildren)}
|
|
46
|
+
</Grid>
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
export default GridExample;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { withKnobs, text, radios, number } from "@storybook/addon-knobs";
|
|
3
|
+
import GridExample from "./GridExample";
|
|
4
|
+
import Cover from "../../Cover";
|
|
5
|
+
import Center from "../../Center";
|
|
6
|
+
import ResizingContainer from "../ResizingContainer";
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
title: "Layouts|Basic Layouts/Grid",
|
|
10
|
+
component: GridExample,
|
|
11
|
+
decorators: [
|
|
12
|
+
withKnobs,
|
|
13
|
+
storyFn => (
|
|
14
|
+
<Cover>
|
|
15
|
+
<div />
|
|
16
|
+
<Center>{storyFn()}</Center>
|
|
17
|
+
<div />
|
|
18
|
+
</Cover>
|
|
19
|
+
)
|
|
20
|
+
]
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const label = "Animate";
|
|
24
|
+
const options = {
|
|
25
|
+
play: "play",
|
|
26
|
+
pause: "pause"
|
|
27
|
+
};
|
|
28
|
+
const defaultValue = "pause";
|
|
29
|
+
const groupID = "RADIO-GROUP-1";
|
|
30
|
+
|
|
31
|
+
export const basicGrid = () => (
|
|
32
|
+
<ResizingContainer
|
|
33
|
+
animate={radios(label, options, defaultValue, groupID)}
|
|
34
|
+
containerMax={text("Container Max", "60rem")}
|
|
35
|
+
containerMin={text("Container Min", "25rem")}
|
|
36
|
+
padding={"1rem"}
|
|
37
|
+
>
|
|
38
|
+
<GridExample numChildren={number("Number of Cards", 8)} minColWidth={13} />
|
|
39
|
+
</ResizingContainer>
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
basicGrid.story = {
|
|
43
|
+
name: "Grid of cards"
|
|
44
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import Sidebar from "../../Sidebar";
|
|
4
|
+
|
|
5
|
+
const SidebarExample = ({ width, onRight, childGap, children }) => (
|
|
6
|
+
<Sidebar width={width} onRight={onRight} childGap={childGap}>
|
|
7
|
+
{children}
|
|
8
|
+
</Sidebar>
|
|
9
|
+
);
|
|
10
|
+
|
|
11
|
+
export default SidebarExample;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { withKnobs, text, radios } from "@storybook/addon-knobs";
|
|
3
|
+
import SidebarExample from "./SidebarExample";
|
|
4
|
+
//import Stack from "../../Stack";
|
|
5
|
+
import Switcher from "../../Switcher";
|
|
6
|
+
import Cover from "../../Cover";
|
|
7
|
+
import Center from "../../Center";
|
|
8
|
+
import FixedSizeContainer from "../FixedSizeContainer";
|
|
9
|
+
import ResizingContainer from "../ResizingContainer";
|
|
10
|
+
import LayoutContentBlock from "../LayoutContentBlock";
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
title: "Layouts|Basic Layouts/Sidebar",
|
|
14
|
+
component: SidebarExample,
|
|
15
|
+
decorators: [
|
|
16
|
+
withKnobs,
|
|
17
|
+
storyFn => (
|
|
18
|
+
<Cover>
|
|
19
|
+
<div />
|
|
20
|
+
<Center>{storyFn()}</Center>
|
|
21
|
+
<div />
|
|
22
|
+
</Cover>
|
|
23
|
+
)
|
|
24
|
+
]
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const label = "Animate";
|
|
28
|
+
const options = {
|
|
29
|
+
play: "play",
|
|
30
|
+
pause: "pause"
|
|
31
|
+
};
|
|
32
|
+
const defaultValue = "pause";
|
|
33
|
+
const groupID = "RADIO-GROUP-1";
|
|
34
|
+
|
|
35
|
+
export const basicSidebar = () => (
|
|
36
|
+
<ResizingContainer
|
|
37
|
+
animate={radios(label, options, defaultValue, groupID)}
|
|
38
|
+
containerMax={text("Container Max", "60rem")}
|
|
39
|
+
containerMin={text("Container Min", "25rem")}
|
|
40
|
+
padding={"1rem"}
|
|
41
|
+
>
|
|
42
|
+
<SidebarExample childGap="0.5rem" width="15rem">
|
|
43
|
+
<FixedSizeContainer>
|
|
44
|
+
<Switcher breakpoint={"15rem"}>
|
|
45
|
+
<LayoutContentBlock
|
|
46
|
+
height="3rem"
|
|
47
|
+
width="2rem"
|
|
48
|
+
layoutName="First Tab"
|
|
49
|
+
/>
|
|
50
|
+
<LayoutContentBlock
|
|
51
|
+
height="3rem"
|
|
52
|
+
width="2rem"
|
|
53
|
+
layoutName="Second Tab"
|
|
54
|
+
/>
|
|
55
|
+
<LayoutContentBlock
|
|
56
|
+
height="3rem"
|
|
57
|
+
width="2rem"
|
|
58
|
+
layoutName="Third Tab"
|
|
59
|
+
/>
|
|
60
|
+
</Switcher>
|
|
61
|
+
{/*<Stack fullHeight bottomItem={4}>
|
|
62
|
+
<LayoutContentBlock height="3rem" layoutName="First Tab" />
|
|
63
|
+
<LayoutContentBlock height="3rem" layoutName="Second Tab" />
|
|
64
|
+
<LayoutContentBlock height="3rem" layoutName="Third Tab" />
|
|
65
|
+
<LayoutContentBlock height="3.5rem" layoutName="Cool Button" />
|
|
66
|
+
</Stack>*/}
|
|
67
|
+
</FixedSizeContainer>
|
|
68
|
+
<FixedSizeContainer>
|
|
69
|
+
<Cover minHeight="75vh">
|
|
70
|
+
<div />
|
|
71
|
+
<Center>
|
|
72
|
+
<LayoutContentBlock
|
|
73
|
+
layoutName="Some great content"
|
|
74
|
+
width="20rem"
|
|
75
|
+
height="400px"
|
|
76
|
+
/>
|
|
77
|
+
</Center>
|
|
78
|
+
<div />
|
|
79
|
+
</Cover>
|
|
80
|
+
</FixedSizeContainer>
|
|
81
|
+
</SidebarExample>
|
|
82
|
+
</ResizingContainer>
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
basicSidebar.story = {
|
|
86
|
+
name: "Sidebar and content"
|
|
87
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import Stack from "../../Stack";
|
|
4
|
+
import LayoutContentBlock from "../LayoutContentBlock";
|
|
5
|
+
|
|
6
|
+
const generateChildren = number => {
|
|
7
|
+
let childArray = [];
|
|
8
|
+
for (let count = 0; count < number; count++) {
|
|
9
|
+
childArray = [
|
|
10
|
+
...childArray,
|
|
11
|
+
<LayoutContentBlock
|
|
12
|
+
height="2.5rem"
|
|
13
|
+
layoutName={`Element ${count + 1}`}
|
|
14
|
+
key={`count ${count}`}
|
|
15
|
+
/>
|
|
16
|
+
];
|
|
17
|
+
}
|
|
18
|
+
return childArray;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const StackExample = ({ numChildren, childGap, bottomItem, fullHeight }) => (
|
|
22
|
+
<Stack childGap={childGap} bottomItem={bottomItem} fullHeight={fullHeight}>
|
|
23
|
+
{generateChildren(numChildren)}
|
|
24
|
+
</Stack>
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
export default StackExample;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { withKnobs, text, number, boolean } from "@storybook/addon-knobs";
|
|
3
|
+
import StackExample from "./StackExample";
|
|
4
|
+
import Cover from "../../Cover";
|
|
5
|
+
import Center from "../../Center";
|
|
6
|
+
import FixedSizeContainer from "../FixedSizeContainer";
|
|
7
|
+
import { TROUT_GREY } from "../../../../../constants/colors";
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
title: "Layouts|Basic Layouts/Stack",
|
|
11
|
+
component: StackExample,
|
|
12
|
+
decorators: [
|
|
13
|
+
withKnobs,
|
|
14
|
+
storyFn => (
|
|
15
|
+
<Cover>
|
|
16
|
+
<div />
|
|
17
|
+
<Center>{storyFn()}</Center>
|
|
18
|
+
<div />
|
|
19
|
+
</Cover>
|
|
20
|
+
)
|
|
21
|
+
]
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const basicStack = () => (
|
|
25
|
+
<FixedSizeContainer
|
|
26
|
+
width={text("Container Width", "30rem")}
|
|
27
|
+
height={text("Container Height", "auto")}
|
|
28
|
+
border={text("Container Border", `2px solid ${TROUT_GREY}`)}
|
|
29
|
+
>
|
|
30
|
+
<StackExample
|
|
31
|
+
numChildren={number("Number of children", 4)}
|
|
32
|
+
childGap={text("Space between children", "1rem")}
|
|
33
|
+
bottomItem={text("Bottom item", "")}
|
|
34
|
+
fullHeight={boolean("Full height", false)}
|
|
35
|
+
/>
|
|
36
|
+
</FixedSizeContainer>
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
basicStack.story = {
|
|
40
|
+
name: "Basic Stack"
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const bottomItemStack = () => (
|
|
44
|
+
<FixedSizeContainer
|
|
45
|
+
width={"30rem"}
|
|
46
|
+
height={"20rem"}
|
|
47
|
+
border={text("Container Border", `2px solid ${TROUT_GREY}`)}
|
|
48
|
+
>
|
|
49
|
+
<StackExample numChildren={4} bottomItem={4} fullHeight={true} />
|
|
50
|
+
</FixedSizeContainer>
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
bottomItemStack.story = {
|
|
54
|
+
name: "Bottom Item Stack"
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export const splitStack = () => (
|
|
58
|
+
<FixedSizeContainer
|
|
59
|
+
width={"30rem"}
|
|
60
|
+
height={"20rem"}
|
|
61
|
+
border={text("Container Border", `2px solid ${TROUT_GREY}`)}
|
|
62
|
+
>
|
|
63
|
+
<StackExample numChildren={4} bottomItem={3} fullHeight={true} />
|
|
64
|
+
</FixedSizeContainer>
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
splitStack.story = {
|
|
68
|
+
name: "Split Stack"
|
|
69
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import Switcher from "../../Switcher";
|
|
4
|
+
import LayoutContentBlock from "../LayoutContentBlock";
|
|
5
|
+
|
|
6
|
+
const generateChildren = number => {
|
|
7
|
+
let childArray = [];
|
|
8
|
+
for (let count = 0; count < number; count++) {
|
|
9
|
+
childArray = [
|
|
10
|
+
...childArray,
|
|
11
|
+
<LayoutContentBlock
|
|
12
|
+
height="3rem"
|
|
13
|
+
layoutName={`Element ${count + 1}`}
|
|
14
|
+
key={`count ${count}`}
|
|
15
|
+
/>
|
|
16
|
+
];
|
|
17
|
+
}
|
|
18
|
+
return childArray;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const SwitcherExample = ({
|
|
22
|
+
numChildren,
|
|
23
|
+
breakpoint,
|
|
24
|
+
largeChild,
|
|
25
|
+
largeChildSize,
|
|
26
|
+
maxChildren
|
|
27
|
+
}) => (
|
|
28
|
+
<Switcher
|
|
29
|
+
breakpoint={breakpoint}
|
|
30
|
+
largeChild={largeChild}
|
|
31
|
+
largeChildSize={largeChildSize}
|
|
32
|
+
maxChildren={maxChildren}
|
|
33
|
+
>
|
|
34
|
+
{generateChildren(numChildren)}
|
|
35
|
+
</Switcher>
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
export default SwitcherExample;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { withKnobs, text, radios, number } from "@storybook/addon-knobs";
|
|
3
|
+
import SwitcherExample from "./SwitcherExample";
|
|
4
|
+
import Cover from "../../Cover";
|
|
5
|
+
import Center from "../../Center";
|
|
6
|
+
import FixedSizeContainer from "../FixedSizeContainer";
|
|
7
|
+
import ResizingContainer from "../ResizingContainer";
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
title: "Layouts|Basic Layouts/Switcher",
|
|
11
|
+
component: SwitcherExample,
|
|
12
|
+
decorators: [
|
|
13
|
+
withKnobs,
|
|
14
|
+
storyFn => (
|
|
15
|
+
<Cover>
|
|
16
|
+
<div />
|
|
17
|
+
<Center>{storyFn()}</Center>
|
|
18
|
+
<div />
|
|
19
|
+
</Cover>
|
|
20
|
+
)
|
|
21
|
+
]
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const label = "Animate";
|
|
25
|
+
const options = {
|
|
26
|
+
play: "play",
|
|
27
|
+
pause: "pause"
|
|
28
|
+
};
|
|
29
|
+
const defaultValue = "pause";
|
|
30
|
+
const groupID = "RADIO-GROUP-1";
|
|
31
|
+
|
|
32
|
+
export const basicSwitcher = () => (
|
|
33
|
+
<ResizingContainer
|
|
34
|
+
animate={radios(label, options, defaultValue, groupID)}
|
|
35
|
+
containerMax={text("Container Max", "45rem")}
|
|
36
|
+
containerMin={text("Container Min", "12.5rem")}
|
|
37
|
+
>
|
|
38
|
+
<SwitcherExample
|
|
39
|
+
numChildren={4}
|
|
40
|
+
breakpoint={text("Switcher Breakpoint", "30rem")}
|
|
41
|
+
/>
|
|
42
|
+
</ResizingContainer>
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
basicSwitcher.story = {
|
|
46
|
+
name: "Resizing Switcher"
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const childLimitSwitcher = () => (
|
|
50
|
+
<FixedSizeContainer
|
|
51
|
+
width={text("Container Width", "40rem")}
|
|
52
|
+
floatingLabel={"Switcher"}
|
|
53
|
+
>
|
|
54
|
+
<SwitcherExample
|
|
55
|
+
numChildren={number("Number of Children", 4)}
|
|
56
|
+
maxChildren={number("Max Children", 6)}
|
|
57
|
+
largeChild={number("Large Child", 2)}
|
|
58
|
+
largeChildSize={number("Large Child Size", 1)}
|
|
59
|
+
/>
|
|
60
|
+
</FixedSizeContainer>
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
childLimitSwitcher.story = {
|
|
64
|
+
name: "Limited Children Switcher"
|
|
65
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import Box from "./Box.js";
|
|
2
|
+
import Center from "./Center.js";
|
|
3
|
+
import Cluster from "./Cluster.js";
|
|
4
|
+
import Grid from "./Grid.js";
|
|
5
|
+
import Sidebar from "./Sidebar.js";
|
|
6
|
+
import Stack from "./Stack.js";
|
|
7
|
+
import Cover from "./Cover.js";
|
|
8
|
+
import Frame from "./Frame.js";
|
|
9
|
+
import Switcher from "./Switcher.js";
|
|
10
|
+
import Imposter from "./Imposter.js";
|
|
11
|
+
import Motion from "./Motion.js";
|
|
12
|
+
import Reel from "./Reel.js";
|
|
13
|
+
|
|
14
|
+
export {
|
|
15
|
+
Box,
|
|
16
|
+
Center,
|
|
17
|
+
Cluster,
|
|
18
|
+
Grid,
|
|
19
|
+
Sidebar,
|
|
20
|
+
Stack,
|
|
21
|
+
Cover,
|
|
22
|
+
Frame,
|
|
23
|
+
Switcher,
|
|
24
|
+
Imposter,
|
|
25
|
+
Motion,
|
|
26
|
+
Reel
|
|
27
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Cluster, Stack } from "../layouts";
|
|
3
|
+
import Paragraph from "../paragraph";
|
|
4
|
+
import { themeComponent } from "../../../util/themeUtils";
|
|
5
|
+
import { fallbackValues } from "./LineItem.theme";
|
|
6
|
+
|
|
7
|
+
const LineItem = ({ description, subDescription, amount, themeValues }) => (
|
|
8
|
+
<Cluster justify="space-between" align="start">
|
|
9
|
+
<Stack childGap="0px">
|
|
10
|
+
<Paragraph
|
|
11
|
+
variant={themeValues.paragraphVariant}
|
|
12
|
+
weight={themeValues.weightTitle}
|
|
13
|
+
>
|
|
14
|
+
{description}
|
|
15
|
+
</Paragraph>
|
|
16
|
+
<Paragraph variant={themeValues.paragraphVariant} weight="400">
|
|
17
|
+
{subDescription}
|
|
18
|
+
</Paragraph>
|
|
19
|
+
</Stack>
|
|
20
|
+
<Paragraph
|
|
21
|
+
variant={themeValues.paragraphVariant}
|
|
22
|
+
weight="600"
|
|
23
|
+
extraStyles="margin: 0;"
|
|
24
|
+
>
|
|
25
|
+
{amount}
|
|
26
|
+
</Paragraph>
|
|
27
|
+
</Cluster>
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
export default themeComponent(LineItem, "LineItem", fallbackValues, "default");
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React, { useContext } from "react";
|
|
2
|
+
import { ThemeContext } from "styled-components";
|
|
3
|
+
import { fallbackValues } from "./Link.theme";
|
|
4
|
+
import { createThemeValues } from "../../../util/themeUtils";
|
|
5
|
+
import { StyledExternalLink } from "./ExternalLink.styled";
|
|
6
|
+
import { FONT_WEIGHT_REGULAR } from "../../../constants/style_constants";
|
|
7
|
+
import { CONGRESS_BLUE, SCIENCE_BLUE } from "../../../constants/colors";
|
|
8
|
+
import { safeChildren } from "../../../util/general";
|
|
9
|
+
|
|
10
|
+
const ExternalLink = ({
|
|
11
|
+
href = "",
|
|
12
|
+
newTab = false,
|
|
13
|
+
color = CONGRESS_BLUE,
|
|
14
|
+
size = "1rem",
|
|
15
|
+
lineHeight = "1.5rem",
|
|
16
|
+
weight = FONT_WEIGHT_REGULAR,
|
|
17
|
+
hoverColor = SCIENCE_BLUE,
|
|
18
|
+
extraStyles = ``,
|
|
19
|
+
variant = "primary",
|
|
20
|
+
tabIndex = "0",
|
|
21
|
+
children
|
|
22
|
+
}) => {
|
|
23
|
+
const themeContext = useContext(ThemeContext);
|
|
24
|
+
const themeValues = createThemeValues(
|
|
25
|
+
themeContext,
|
|
26
|
+
fallbackValues,
|
|
27
|
+
"Link",
|
|
28
|
+
variant
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<StyledExternalLink
|
|
33
|
+
href={href}
|
|
34
|
+
target={newTab ? "_blank" : ""}
|
|
35
|
+
color={color}
|
|
36
|
+
size={size}
|
|
37
|
+
lineheight={lineHeight}
|
|
38
|
+
weight={weight}
|
|
39
|
+
hovercolor={hoverColor}
|
|
40
|
+
fontFamily={themeValues.fontFamily}
|
|
41
|
+
tabIndex={tabIndex}
|
|
42
|
+
extrastyles={extraStyles}
|
|
43
|
+
rel={newTab ? "noopener" : ""}
|
|
44
|
+
>
|
|
45
|
+
{safeChildren(children, <span />)}
|
|
46
|
+
</StyledExternalLink>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export default ExternalLink;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import styled from "styled-components";
|
|
3
|
+
|
|
4
|
+
/*
|
|
5
|
+
The extracting of props and the disabling of the eslint rule is to stop React from complaining about
|
|
6
|
+
unrecognized DOM attributes.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/* eslint-disable no-unused-vars */
|
|
10
|
+
export const StyledExternalLink = styled(
|
|
11
|
+
({ hoverColor, extraStyles, ...props }) => <a {...props} />
|
|
12
|
+
)`
|
|
13
|
+
display: flex;
|
|
14
|
+
font-size: ${({ size }) => size};
|
|
15
|
+
color: ${({ color }) => color};
|
|
16
|
+
font-weight: ${({ weight }) => weight};
|
|
17
|
+
font-family: ${({ fontFamily }) => fontFamily};
|
|
18
|
+
line-height: ${({ lineheight }) => lineheight};
|
|
19
|
+
|
|
20
|
+
&:hover {
|
|
21
|
+
color: ${({ hovercolor }) => hovercolor};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
${({ extrastyles }) => extrastyles}
|
|
25
|
+
`;
|
|
26
|
+
/* eslint-enable no-unused-vars */
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React, { useContext } from "react";
|
|
2
|
+
import { ThemeContext } from "styled-components";
|
|
3
|
+
import { fallbackValues } from "./Link.theme";
|
|
4
|
+
import { createThemeValues } from "../../../util/themeUtils";
|
|
5
|
+
import { StyledInternalLink } from "./InternalLink.styled";
|
|
6
|
+
import { safeChildren } from "../../../util/general";
|
|
7
|
+
|
|
8
|
+
const InternalLink = ({
|
|
9
|
+
to = "",
|
|
10
|
+
color,
|
|
11
|
+
children,
|
|
12
|
+
activeStyles,
|
|
13
|
+
active,
|
|
14
|
+
fontSize,
|
|
15
|
+
lineheight,
|
|
16
|
+
fontWeight,
|
|
17
|
+
variant = "primary",
|
|
18
|
+
margin,
|
|
19
|
+
hoverStyles,
|
|
20
|
+
tabIndex = "0",
|
|
21
|
+
extraStyles = ``
|
|
22
|
+
}) => {
|
|
23
|
+
const themeContext = useContext(ThemeContext);
|
|
24
|
+
const themeValues = createThemeValues(
|
|
25
|
+
themeContext,
|
|
26
|
+
fallbackValues,
|
|
27
|
+
"Link",
|
|
28
|
+
variant
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<StyledInternalLink
|
|
33
|
+
to={to}
|
|
34
|
+
color={color}
|
|
35
|
+
lineheight={lineheight}
|
|
36
|
+
activeStyles={activeStyles}
|
|
37
|
+
active={active}
|
|
38
|
+
fontWeight={fontWeight}
|
|
39
|
+
fontSize={fontSize}
|
|
40
|
+
fontFamily={themeValues.fontFamily}
|
|
41
|
+
margin={margin}
|
|
42
|
+
hoverStyles={hoverStyles}
|
|
43
|
+
tabIndex={tabIndex}
|
|
44
|
+
extrastyles={extraStyles}
|
|
45
|
+
>
|
|
46
|
+
{safeChildren(children, <span />)}
|
|
47
|
+
</StyledInternalLink>
|
|
48
|
+
);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export default InternalLink;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import styled, { css } from "styled-components";
|
|
3
|
+
import { Link } from "react-router-dom";
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
The extracting of props and the disabling of the eslint rule is to stop React from complaining about
|
|
7
|
+
unrecognized DOM attributes.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/* eslint-disable no-unused-vars */
|
|
11
|
+
export const StyledInternalLink = styled(
|
|
12
|
+
({ hoverStyles, activeStyles, active, ...props }) => <Link {...props} />
|
|
13
|
+
)`
|
|
14
|
+
display: flex;
|
|
15
|
+
color: ${({ color }) => color};
|
|
16
|
+
font-weight: ${({ fontWeight }) => fontWeight};
|
|
17
|
+
line-height: ${({ lineheight }) => lineheight};
|
|
18
|
+
font-size: ${({ fontSize }) => fontSize};
|
|
19
|
+
font-family: ${({ fontFamily }) => fontFamily};
|
|
20
|
+
margin: ${({ margin }) => margin};
|
|
21
|
+
|
|
22
|
+
&:hover {
|
|
23
|
+
${({ hoverStyles }) =>
|
|
24
|
+
css`
|
|
25
|
+
${hoverStyles}
|
|
26
|
+
`}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
${({ activeStyles, active }) =>
|
|
30
|
+
active === "true" &&
|
|
31
|
+
css`
|
|
32
|
+
${activeStyles}
|
|
33
|
+
cursor: default;
|
|
34
|
+
pointer-events: none;
|
|
35
|
+
`}
|
|
36
|
+
|
|
37
|
+
${({ extrastyles }) => extrastyles}
|
|
38
|
+
`;
|
|
39
|
+
/* eslint-enable no-unused-vars */
|