@navinc/base-react-components
Version:
Nav's Pattern Library
85 lines (83 loc) • 8.51 kB
JavaScript
"use strict";
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.COVID19Resources = exports.Toggle = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const react_1 = require("react");
const styled_components_1 = __importDefault(require("styled-components"));
const utils_1 = require("@navinc/utils");
const header_js_1 = __importDefault(require("./header.js"));
const copy_1 = __importDefault(require("./copy"));
const text_1 = __importDefault(require("./text"));
const icon_js_1 = __importDefault(require("./icon.js"));
const aside_js_1 = __importDefault(require("./aside.js"));
const Toggle = (_a) => {
var { isToggleOpen = false } = _a, _b = _a.trackingContext, _c = _b === void 0 ? {} : _b, { context = 'toggle', category = 'toggle', type = `interaction_toggle_${context}`, options } = _c, payload = __rest(_c, ["context", "category", "type", "options"]), { children } = _a;
const [isOpen, setIsOpen] = (0, react_1.useState)(isToggleOpen);
const toggle = () => {
setIsOpen(!isOpen);
(0, utils_1.track)({
type,
payload: Object.assign({ category, label: 'toggle_click', name: 'toggle_click' }, payload),
options,
});
};
return children({
isOpen: isOpen,
toggle: toggle,
});
};
exports.Toggle = Toggle;
const Hr = styled_components_1.default.hr `
flex: 1;
width: 100%;
margin: 16px 0;
border: 0;
border-top: 1px solid ${({ theme }) => theme.neutral300};
`;
const SectionWrapper = styled_components_1.default.div `
padding: 18px;
`;
const StyledToggleWrapper = styled_components_1.default.div `
display: flex;
justify-content: space-between;
cursor: pointer;
`;
const StyledIconWrapper = styled_components_1.default.div `
text-align: right;
padding-top: 16px;
`;
const StyledHeaderWrapper = styled_components_1.default.div `
text-align: left;
`;
const Link = (0, styled_components_1.default)(text_1.default).attrs(() => ({ as: 'a' })) `
font-size: inherit;
color: ${({ theme }) => theme.azure};
text-decoration: none;
&:hover {
color: ${({ theme }) => theme.oceanBoat};
}
&:active {
color: ${({ theme }) => theme.oceanBoat};
}
`;
const COVID19Resources = ({ shouldShowSBAApplicationAndCalculatorSection, shouldShowBothSBAApplicationAndCalculator = shouldShowSBAApplicationAndCalculatorSection, shouldHideNavCaresActSection = false, className, links = {}, }) => {
const [toggled, setToggled] = (0, react_1.useState)(true);
const { pppForm, sbaLoanCalc, documentionChecklist } = links;
return ((0, jsx_runtime_1.jsx)(react_1.Fragment, Object.assign({ className: className }, { children: shouldHideNavCaresActSection ? null : shouldShowBothSBAApplicationAndCalculator ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(SectionWrapper, { children: [(0, jsx_runtime_1.jsxs)(StyledToggleWrapper, Object.assign({ onClick: () => setToggled(!toggled) }, { children: [(0, jsx_runtime_1.jsxs)(StyledHeaderWrapper, { children: [(0, jsx_runtime_1.jsx)(header_js_1.default, Object.assign({ size: "lg", id: "free-ppp-tools" }, { children: "Free PPP Tools" }), void 0), (0, jsx_runtime_1.jsx)(copy_1.default, Object.assign({ light: true, size: "sm" }, { children: "Updated January 11, 2021 | by Nav" }), void 0)] }, void 0), (0, jsx_runtime_1.jsx)(StyledIconWrapper, { children: (0, jsx_runtime_1.jsx)(icon_js_1.default, { name: `actions/carrot-${toggled ? 'up' : 'down'}` }, void 0) }, void 0)] }), void 0), toggled && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(copy_1.default, { children: [(0, jsx_runtime_1.jsx)(Link, Object.assign({ "data-testid": "covid-resourse:sba-loan-form:application-link1", href: pppForm, rel: "noopener noreferrer", target: "_blank" }, { children: "Need a PPP loan? Apply with a Nav lending partner in 15 minutes or less!" }), void 0), ' ', "- 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!"] }, void 0), (0, jsx_runtime_1.jsx)(copy_1.default, { children: (0, jsx_runtime_1.jsx)(Link, Object.assign({ "data-testid": "covid-resourse:sba-loan-form:application-link2", href: pppForm, rel: "noopener noreferrer", target: "_blank" }, { children: "Get started" }), void 0) }, void 0), (0, jsx_runtime_1.jsx)(aside_js_1.default, { 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." }, void 0), (0, jsx_runtime_1.jsx)("br", {}, void 0), (0, jsx_runtime_1.jsxs)(copy_1.default, { children: [(0, jsx_runtime_1.jsx)(Link, Object.assign({ "data-testid": "covid-resource:sba-loan-checklist:link1", href: documentionChecklist, rel: "noopener noreferrer", target: "_blank" }, { children: "PPP Documentation Checklist" }), void 0), ' ', "- 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."] }, void 0), (0, jsx_runtime_1.jsx)(copy_1.default, { children: (0, jsx_runtime_1.jsx)(Link, Object.assign({ "data-testid": "covid-resource:sba-loan-checklist:link2", href: documentionChecklist, rel: "noopener noreferrer", target: "_blank" }, { children: "See checklist" }), void 0) }, void 0), (0, jsx_runtime_1.jsxs)(copy_1.default, { children: [(0, jsx_runtime_1.jsx)(Link, Object.assign({ "data-testid": "covid-resourse:sba-loan-calculator:link1", href: sbaLoanCalc, rel: "noopener noreferrer", target: "_blank" }, { children: "PPP Loan Calculator and FAQ" }), void 0), ' ', "- Find out how much your business may qualify for with the new Paycheck Protection Loans."] }, void 0), (0, jsx_runtime_1.jsx)(copy_1.default, { children: (0, jsx_runtime_1.jsx)(Link, Object.assign({ "data-testid": "covid-resourse:sba-loan-calculator:link2", href: sbaLoanCalc, rel: "noopener noreferrer", target: "_blank" }, { children: "Go to calculator" }), void 0) }, void 0)] }, void 0))] }, void 0), (0, jsx_runtime_1.jsx)(Hr, {}, void 0)] }, void 0)) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(SectionWrapper, { children: [(0, jsx_runtime_1.jsxs)(StyledToggleWrapper, Object.assign({ onClick: () => setToggled(!toggled) }, { children: [(0, jsx_runtime_1.jsxs)(StyledHeaderWrapper, { children: [(0, jsx_runtime_1.jsx)(header_js_1.default, Object.assign({ size: "lg" }, { children: "CARES Act SBA Loan Calculator" }), void 0), (0, jsx_runtime_1.jsx)(copy_1.default, Object.assign({ light: true, size: "sm" }, { children: "Updated April 4, 2020 | by Nav" }), void 0)] }, void 0), (0, jsx_runtime_1.jsx)(StyledIconWrapper, { children: (0, jsx_runtime_1.jsx)(icon_js_1.default, { name: `actions/carrot-${toggled ? 'up' : 'down'}` }, void 0) }, void 0)] }), void 0), toggled && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(copy_1.default, { children: [(0, jsx_runtime_1.jsx)(Link, Object.assign({ "data-testid": "covid-resourse:sba-loan-calculator:link1", href: sbaLoanCalc, target: "_blank", rel: "noreferrer" }, { children: "CARES Act SBA Loan Calculator and FAQ" }), void 0), ' ', "- Find out how much your business may qualify for with the new Paycheck Protection Loans."] }, void 0), (0, jsx_runtime_1.jsx)(copy_1.default, { children: (0, jsx_runtime_1.jsx)(Link, Object.assign({ "data-testid": "covid-resourse:sba-loan-calculator:link2", href: sbaLoanCalc, target: "_blank", rel: "noreferrer" }, { children: "Go to calculator" }), void 0) }, void 0)] }, void 0))] }, void 0), (0, jsx_runtime_1.jsx)(Hr, {}, void 0)] }, void 0)) }), void 0));
};
exports.COVID19Resources = COVID19Resources;
//# sourceMappingURL=sba-resources.js.map