@navinc/base-react-components
Version:
Nav's Pattern Library
63 lines (62 loc) • 6.68 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
import { Fragment, useState } from 'react';
import styled, { useTheme } from 'styled-components';
import Header from './header.js';
import Copy from './copy.js';
import Link from './link.js';
import Icon from './icon.js';
import BlockQuote from './aside.js';
import isRebrand from './is-rebrand.js';
export const Toggle = ({ isToggleOpen = false, children }) => {
const [isOpen, setIsOpen] = useState(isToggleOpen);
const toggle = () => {
setIsOpen(!isOpen);
};
return children({
isOpen,
toggle,
});
};
const Hr = styled.hr.withConfig({ displayName: "brc-sc-Hr", componentId: "brc-sc-mqwzlk" }) `
flex: 1;
width: 100%;
margin: 16px 0;
border: 0;
border-top: 1px solid ${({ theme }) => theme.neutral300};
`;
const SectionWrapper = styled.div.withConfig({ displayName: "brc-sc-SectionWrapper", componentId: "brc-sc-fmq332" }) `
padding: 18px;
`;
const SubSection = styled.div.withConfig({ displayName: "brc-sc-SubSection", componentId: "brc-sc-h4t6pl" }) `
& ~ & {
margin-top: ${({ theme }) => (isRebrand(theme) ? '24px' : '0')};
}
& ${Copy} {
margin-top: ${({ theme }) => (isRebrand(theme) ? '8px' : '0')};
}
`;
const StyledToggleWrapper = styled.div.withConfig({ displayName: "brc-sc-StyledToggleWrapper", componentId: "brc-sc-1qjznd" }) `
display: flex;
justify-content: space-between;
cursor: pointer;
`;
const StyledIconWrapper = styled.div.withConfig({ displayName: "brc-sc-StyledIconWrapper", componentId: "brc-sc-1os25fh" }) `
text-align: right;
padding-top: 16px;
`;
const StyledHeaderWrapper = styled.div.withConfig({ displayName: "brc-sc-StyledHeaderWrapper", componentId: "brc-sc-47pr0m" }) `
text-align: left;
`;
export const COVID19Resources = ({ shouldShowSBAApplicationAndCalculatorSection, shouldShowBothSBAApplicationAndCalculator = shouldShowSBAApplicationAndCalculatorSection, shouldHideNavCaresActSection = false, className, links = {}, }) => {
const [toggled, setToggled] = useState(true);
const { pppForm, sbaLoanCalc, documentionChecklist } = links;
const theme = useTheme();
const rebrand = isRebrand(theme);
if (shouldHideNavCaresActSection) {
return _jsx(Fragment, Object.assign({ className: className }, { children: null }));
}
else {
return (_jsx(Fragment, Object.assign({ className: className }, { children: shouldShowBothSBAApplicationAndCalculator ? (_jsxs(_Fragment, { children: [_jsxs(SectionWrapper, { children: [_jsxs(StyledToggleWrapper, Object.assign({ onClick: () => setToggled(!toggled) }, { children: [_jsxs(StyledHeaderWrapper, { children: [_jsx(Header, Object.assign({ size: rebrand ? 'xs' : 'lg', id: "free-ppp-tools" }, { children: "Free PPP Tools" })), _jsx(Copy, Object.assign({ light: true, size: "sm" }, { children: "Updated Dec 20, 2022 | by Nav" }))] }), _jsx(StyledIconWrapper, { children: _jsx(Icon, { name: `actions/carrot-${toggled ? 'up' : 'down'}` }) })] })), toggled && (_jsxs(_Fragment, { children: [_jsxs(SubSection, { children: [_jsxs(Copy, { children: [_jsx(Link, Object.assign({ "data-testid": "covid-resourse:sba-loan-form:application-link1", href: pppForm, rel: "noopener noreferrer", target: "_blank", bold: isRebrand(theme) }, { children: "Need a PPP loan? Apply with a Nav lending partner in 15 minutes or less!" })), ' ', "- Don\u2019t miss out on PPP funds - whether it\u2019s your first or second draw. Fill out Nav\u2019s form today to get matched instantly to a PPP lender. Once you see your match, complete your PPP application with the lender in 15 minutes or less!"] }), _jsx(Copy, { children: _jsx(Link, Object.assign({ "data-testid": "covid-resourse:sba-loan-form:application-link2", href: pppForm, rel: "noopener noreferrer", target: "_blank", bold: rebrand }, { children: "Get started" })) })] }), _jsx(SubSection, { children: _jsx(BlockQuote, { children: "Note: Information and/or an application submitted to one of Nav\u2019s partners does not guarantee you will receive/be approved for a PPP loan." }) }), _jsxs(SubSection, { children: [_jsxs(Copy, { children: [_jsx(Link, Object.assign({ "data-testid": "covid-resource:sba-loan-checklist:link1", href: documentionChecklist, rel: "noopener noreferrer", target: "_blank", bold: rebrand }, { children: "PPP Documentation Checklist" })), ' ', "- Use this checklist to gather the documentation that you need to complete your PPP loan application. Having these ready will speed up the application process."] }), _jsx(Copy, { children: _jsx(Link, Object.assign({ "data-testid": "covid-resource:sba-loan-checklist:link2", href: documentionChecklist, rel: "noopener noreferrer", target: "_blank", bold: rebrand }, { children: "See checklist" })) })] }), _jsxs(SubSection, { children: [_jsxs(Copy, { children: [_jsx(Link, Object.assign({ "data-testid": "covid-resourse:sba-loan-calculator:link1", href: sbaLoanCalc, rel: "noopener noreferrer", target: "_blank", bold: rebrand }, { children: "PPP Loan Calculator and FAQ" })), ' ', "- Find out how much your business may qualify for with the new Paycheck Protection Loans."] }), _jsx(Copy, { children: _jsx(Link, Object.assign({ "data-testid": "covid-resourse:sba-loan-calculator:link2", href: sbaLoanCalc, rel: "noopener noreferrer", target: "_blank", bold: rebrand }, { children: "Go to calculator" })) })] })] }))] }), !rebrand && _jsx(Hr, {})] })) : (_jsxs(_Fragment, { children: [_jsxs(SectionWrapper, { children: [_jsxs(StyledToggleWrapper, Object.assign({ onClick: () => setToggled(!toggled) }, { children: [_jsxs(StyledHeaderWrapper, { children: [_jsx(Header, Object.assign({ size: isRebrand(theme) ? 'xs' : 'lg' }, { children: "CARES Act SBA Loan Calculator" })), _jsx(Copy, Object.assign({ light: true, size: "sm" }, { children: "Updated Dec 20, 2022 | by Nav" }))] }), _jsx(StyledIconWrapper, { children: _jsx(Icon, { name: `actions/carrot-${toggled ? 'up' : 'down'}` }) })] })), toggled && (_jsxs(SubSection, { children: [_jsxs(Copy, { children: [_jsx(Link, Object.assign({ "data-testid": "covid-resourse:sba-loan-calculator:link1", href: sbaLoanCalc, target: "_blank", rel: "noreferrer", bold: rebrand }, { children: "CARES Act SBA Loan Calculator and FAQ" })), ' ', "- Find out how much your business may qualify for with the new Paycheck Protection Loans."] }), _jsx(Copy, { children: _jsx(Link, Object.assign({ "data-testid": "covid-resourse:sba-loan-calculator:link2", href: sbaLoanCalc, target: "_blank", rel: "noreferrer", bold: rebrand }, { children: "Go to calculator" })) })] }))] }), !rebrand && _jsx(Hr, {})] })) })));
}
};
//# sourceMappingURL=sba-resources.js.map