@npm_leadtech/legal-lib-components 7.63.10 → 7.63.11
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/dist/css/styles.css +18 -0
- package/dist/src/components/atoms/Logo/Logo.js +2 -4
- package/dist/src/components/atoms/Logo/Logo.tsx +2 -4
- package/dist/src/components/atoms/index.d.ts +0 -2
- package/dist/src/components/atoms/index.js +0 -2
- package/dist/src/components/atoms/index.ts +0 -2
- package/dist/src/components/molecules/index.d.ts +0 -1
- package/dist/src/components/molecules/index.js +0 -1
- package/dist/src/components/molecules/index.ts +0 -1
- package/dist/src/components/organisms/index.d.ts +0 -1
- package/dist/src/components/organisms/index.js +0 -1
- package/dist/src/components/organisms/index.ts +0 -1
- package/dist/src/components/pages/index.d.ts +0 -1
- package/dist/src/components/pages/index.js +0 -1
- package/dist/src/components/pages/index.ts +0 -1
- package/dist/src/globalStyles/themes.scss +27 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -2
- package/dist/src/components/atoms/FeatureItem/FeatureItem.d.ts +0 -3
- package/dist/src/components/atoms/FeatureItem/FeatureItem.js +0 -5
- package/dist/src/components/atoms/FeatureItem/FeatureItem.styled.d.ts +0 -1
- package/dist/src/components/atoms/FeatureItem/FeatureItem.styled.js +0 -18
- package/dist/src/components/atoms/FeatureItem/FeatureItem.styled.ts +0 -19
- package/dist/src/components/atoms/FeatureItem/FeatureItem.tsx +0 -12
- package/dist/src/components/atoms/FeatureItem/FeatureItemProps.d.ts +0 -9
- package/dist/src/components/atoms/FeatureItem/FeatureItemProps.js +0 -1
- package/dist/src/components/atoms/FeatureItem/FeatureItemProps.ts +0 -10
- package/dist/src/components/atoms/FeatureItem/index.d.ts +0 -2
- package/dist/src/components/atoms/FeatureItem/index.js +0 -2
- package/dist/src/components/atoms/FeatureItem/index.ts +0 -2
- package/dist/src/components/atoms/Logo/svg/legalfinity-logo.svg +0 -15
- package/dist/src/components/atoms/Logo/svg/legalfinity-white-logo.svg +0 -15
- package/dist/src/components/atoms/PlanCard/PlanCard.d.ts +0 -3
- package/dist/src/components/atoms/PlanCard/PlanCard.js +0 -6
- package/dist/src/components/atoms/PlanCard/PlanCard.styled.d.ts +0 -8
- package/dist/src/components/atoms/PlanCard/PlanCard.styled.js +0 -75
- package/dist/src/components/atoms/PlanCard/PlanCard.styled.ts +0 -83
- package/dist/src/components/atoms/PlanCard/PlanCard.tsx +0 -42
- package/dist/src/components/atoms/PlanCard/PlanCardProps.d.ts +0 -23
- package/dist/src/components/atoms/PlanCard/PlanCardProps.js +0 -1
- package/dist/src/components/atoms/PlanCard/PlanCardProps.ts +0 -26
- package/dist/src/components/atoms/PlanCard/index.d.ts +0 -2
- package/dist/src/components/atoms/PlanCard/index.js +0 -2
- package/dist/src/components/atoms/PlanCard/index.ts +0 -2
- package/dist/src/components/molecules/StickyPlanBar/StickyPlanBar.d.ts +0 -3
- package/dist/src/components/molecules/StickyPlanBar/StickyPlanBar.js +0 -5
- package/dist/src/components/molecules/StickyPlanBar/StickyPlanBar.styled.d.ts +0 -3
- package/dist/src/components/molecules/StickyPlanBar/StickyPlanBar.styled.js +0 -69
- package/dist/src/components/molecules/StickyPlanBar/StickyPlanBar.styled.ts +0 -72
- package/dist/src/components/molecules/StickyPlanBar/StickyPlanBar.tsx +0 -23
- package/dist/src/components/molecules/StickyPlanBar/StickyPlanBarProps.d.ts +0 -6
- package/dist/src/components/molecules/StickyPlanBar/StickyPlanBarProps.js +0 -1
- package/dist/src/components/molecules/StickyPlanBar/StickyPlanBarProps.ts +0 -7
- package/dist/src/components/molecules/StickyPlanBar/index.d.ts +0 -2
- package/dist/src/components/molecules/StickyPlanBar/index.js +0 -2
- package/dist/src/components/molecules/StickyPlanBar/index.ts +0 -2
- package/dist/src/components/organisms/PricingPageHeader/PricingPageHeader.d.ts +0 -3
- package/dist/src/components/organisms/PricingPageHeader/PricingPageHeader.js +0 -7
- package/dist/src/components/organisms/PricingPageHeader/PricingPageHeader.styled.d.ts +0 -3
- package/dist/src/components/organisms/PricingPageHeader/PricingPageHeader.styled.js +0 -35
- package/dist/src/components/organisms/PricingPageHeader/PricingPageHeader.styled.tsx +0 -38
- package/dist/src/components/organisms/PricingPageHeader/PricingPageHeader.tsx +0 -21
- package/dist/src/components/organisms/PricingPageHeader/PricingPageHeaderProps.d.ts +0 -4
- package/dist/src/components/organisms/PricingPageHeader/PricingPageHeaderProps.js +0 -1
- package/dist/src/components/organisms/PricingPageHeader/PricingPageHeaderProps.ts +0 -4
- package/dist/src/components/organisms/PricingPageHeader/index.d.ts +0 -2
- package/dist/src/components/organisms/PricingPageHeader/index.js +0 -2
- package/dist/src/components/organisms/PricingPageHeader/index.ts +0 -2
- package/dist/src/components/pages/PricingPlansPage/PricingPlansPage.d.ts +0 -3
- package/dist/src/components/pages/PricingPlansPage/PricingPlansPage.js +0 -58
- package/dist/src/components/pages/PricingPlansPage/PricingPlansPage.styled.d.ts +0 -16
- package/dist/src/components/pages/PricingPlansPage/PricingPlansPage.styled.js +0 -88
- package/dist/src/components/pages/PricingPlansPage/PricingPlansPage.styled.ts +0 -107
- package/dist/src/components/pages/PricingPlansPage/PricingPlansPage.tsx +0 -128
- package/dist/src/components/pages/PricingPlansPage/PricingPlansPageProps.d.ts +0 -9
- package/dist/src/components/pages/PricingPlansPage/PricingPlansPageProps.js +0 -1
- package/dist/src/components/pages/PricingPlansPage/PricingPlansPageProps.ts +0 -10
- package/dist/src/components/pages/PricingPlansPage/index.d.ts +0 -2
- package/dist/src/components/pages/PricingPlansPage/index.js +0 -2
- package/dist/src/components/pages/PricingPlansPage/index.ts +0 -2
- package/dist/src/utils/throttle.d.ts +0 -1
- package/dist/src/utils/throttle.js +0 -10
- package/dist/src/utils/throttle.ts +0 -11
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { FeatureItem, PlanCard } from '../../atoms';
|
|
3
|
-
import { FeaturesGrid, FeaturesSection, PlanSelector, PlanWrapper, PlansWrapper, PricingContainerStyled, SelectorButton } from './PricingPlansPage.styled';
|
|
4
|
-
import { PricingPageHeader } from '../../organisms';
|
|
5
|
-
import React from 'react';
|
|
6
|
-
import { StickyPlanBar } from '../../molecules/StickyPlanBar';
|
|
7
|
-
import { throttle } from '../../../utils/throttle';
|
|
8
|
-
export const PricingPlansPage = ({ subscriptionPlans, features, onPlanSelect, headerDivider, siteName = 'Legalfinity', phoneNumber }) => {
|
|
9
|
-
const [activePlanIndex, setActivePlanIndex] = React.useState(0);
|
|
10
|
-
const plansWrapperRef = React.useRef(null);
|
|
11
|
-
const lastScrollYRef = React.useRef(0);
|
|
12
|
-
const [showStickyBar, setShowStickyBar] = React.useState(false);
|
|
13
|
-
const activePlan = subscriptionPlans[activePlanIndex];
|
|
14
|
-
React.useEffect(() => {
|
|
15
|
-
const handleScroll = () => {
|
|
16
|
-
if (!plansWrapperRef.current)
|
|
17
|
-
return;
|
|
18
|
-
const currentScrollY = window.scrollY;
|
|
19
|
-
const isMobile = window.innerWidth < 720;
|
|
20
|
-
if (!isMobile) {
|
|
21
|
-
if (showStickyBar) {
|
|
22
|
-
setShowStickyBar(false);
|
|
23
|
-
}
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
const isScrollingUp = currentScrollY < lastScrollYRef.current - 10 ? 'up' : null;
|
|
27
|
-
const scrollDirection = currentScrollY > lastScrollYRef.current + 10 ? 'down' : isScrollingUp;
|
|
28
|
-
if (!scrollDirection)
|
|
29
|
-
return;
|
|
30
|
-
const targetRect = plansWrapperRef.current.getBoundingClientRect();
|
|
31
|
-
const isPastWrapper = targetRect.bottom < 400;
|
|
32
|
-
if (scrollDirection === 'down' && isPastWrapper) {
|
|
33
|
-
if (!showStickyBar) {
|
|
34
|
-
setShowStickyBar(true);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
else if (scrollDirection === 'up' || !isPastWrapper) {
|
|
38
|
-
if (showStickyBar && !isPastWrapper) {
|
|
39
|
-
setShowStickyBar(false);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
lastScrollYRef.current = currentScrollY;
|
|
43
|
-
};
|
|
44
|
-
const handleResize = () => {
|
|
45
|
-
if (window.innerWidth >= 720) {
|
|
46
|
-
setShowStickyBar(false);
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
const throttledHandleScroll = throttle(handleScroll, 100);
|
|
50
|
-
window.addEventListener('scroll', throttledHandleScroll);
|
|
51
|
-
window.addEventListener('resize', handleResize);
|
|
52
|
-
return () => {
|
|
53
|
-
window.removeEventListener('scroll', throttledHandleScroll);
|
|
54
|
-
window.removeEventListener('resize', handleResize);
|
|
55
|
-
};
|
|
56
|
-
}, [showStickyBar]);
|
|
57
|
-
return (_jsxs(_Fragment, { children: [_jsx(PricingPageHeader, { siteName: siteName, phoneNumber: phoneNumber }), headerDivider, subscriptionPlans?.length > 0 && (_jsxs(PricingContainerStyled, { children: [_jsx(PlanSelector, { children: subscriptionPlans.map((plan, index) => (_jsx(SelectorButton, { isActive: index === activePlanIndex, onClick: () => setActivePlanIndex(index), dataQa: `selector-${plan.subscription_type?.name.replaceAll(' ', '')}`, children: plan?.subscription_type?.name }, `selector-${plan?.pricingLabel}`))) }), _jsx(PlansWrapper, { ref: plansWrapperRef, children: subscriptionPlans.map((plan, index) => (_jsx(PlanWrapper, { isHighlighted: plan.highlightPlan, isActive: index === activePlanIndex, className: `pricing-plan__element-container ${plan?.highlightPlan ? 'highlight' : ''} ${index === activePlanIndex ? 'active' : ''}`, children: _jsx(PlanCard, { onSelect: onPlanSelect ?? (() => { }), plan: plan }) }, plan.pricingLabel))) }), features && features.length > 0 && (_jsx(FeaturesSection, { children: _jsx(FeaturesGrid, { children: features.map((feature) => (_jsx(FeatureItem, { feature: feature }, feature.description))) }) })), _jsx(StickyPlanBar, { activePlan: activePlan, showStickyBar: showStickyBar, onPlanSelect: onPlanSelect })] }))] }));
|
|
58
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
type PlanWrapperProps = {
|
|
2
|
-
isActive: boolean;
|
|
3
|
-
isHighlighted?: boolean;
|
|
4
|
-
};
|
|
5
|
-
type SelectorButton = {
|
|
6
|
-
isActive: boolean;
|
|
7
|
-
dataQa: string;
|
|
8
|
-
};
|
|
9
|
-
export declare const PricingContainerStyled: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, never>> & string;
|
|
10
|
-
export declare const PlanSelector: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
11
|
-
export declare const SelectorButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, SelectorButton>> & string;
|
|
12
|
-
export declare const PlansWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
13
|
-
export declare const PlanWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, PlanWrapperProps>> & string;
|
|
14
|
-
export declare const FeaturesSection: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
15
|
-
export declare const FeaturesGrid: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLUListElement>, HTMLUListElement>, never>> & string;
|
|
16
|
-
export {};
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import styled, { css } from 'styled-components';
|
|
2
|
-
import { size } from '../../../globalStyles/breakpoints';
|
|
3
|
-
export const PricingContainerStyled = styled.section `
|
|
4
|
-
margin: 0 auto 0 auto;
|
|
5
|
-
display: flex;
|
|
6
|
-
flex-direction: column;
|
|
7
|
-
justify-content: center;
|
|
8
|
-
align-items: center;
|
|
9
|
-
max-width: 996px;
|
|
10
|
-
gap: 1.5rem;
|
|
11
|
-
margin-bottom: 3rem;
|
|
12
|
-
padding: 0 1.5rem;
|
|
13
|
-
`;
|
|
14
|
-
export const PlanSelector = styled.div `
|
|
15
|
-
display: flex;
|
|
16
|
-
justify-content: center;
|
|
17
|
-
gap: 0.5rem;
|
|
18
|
-
border-radius: 1rem;
|
|
19
|
-
padding: 0.5rem;
|
|
20
|
-
|
|
21
|
-
@media (min-width: ${size.sm}) {
|
|
22
|
-
display: none;
|
|
23
|
-
}
|
|
24
|
-
`;
|
|
25
|
-
export const SelectorButton = styled.button `
|
|
26
|
-
padding: 0.5rem;
|
|
27
|
-
border-radius: 0.5rem;
|
|
28
|
-
border: none;
|
|
29
|
-
outline: inherit;
|
|
30
|
-
flex: 1;
|
|
31
|
-
font-size: 12px;
|
|
32
|
-
font-weight: 700;
|
|
33
|
-
background-color: var(--neutral-neutral-4);
|
|
34
|
-
color: var(--neutral-neutral-1);
|
|
35
|
-
cursor: pointer;
|
|
36
|
-
transition: background-color 0.3s;
|
|
37
|
-
|
|
38
|
-
${({ isActive }) => isActive &&
|
|
39
|
-
css `
|
|
40
|
-
background-color: var(--primary-main);
|
|
41
|
-
color: white;
|
|
42
|
-
`}
|
|
43
|
-
`;
|
|
44
|
-
export const PlansWrapper = styled.div `
|
|
45
|
-
display: flex;
|
|
46
|
-
height: 100%;
|
|
47
|
-
gap: 1rem;
|
|
48
|
-
width: 100%;
|
|
49
|
-
max-width: 327px;
|
|
50
|
-
|
|
51
|
-
@media (min-width: ${size.sm}) {
|
|
52
|
-
max-width: none;
|
|
53
|
-
gap: 20px;
|
|
54
|
-
}
|
|
55
|
-
`;
|
|
56
|
-
export const PlanWrapper = styled.div `
|
|
57
|
-
max-width: 327px;
|
|
58
|
-
border-radius: 1rem;
|
|
59
|
-
flex: 1;
|
|
60
|
-
display: ${({ isActive }) => (isActive ? 'block' : 'none')};
|
|
61
|
-
background-color: white;
|
|
62
|
-
|
|
63
|
-
${({ isHighlighted }) => isHighlighted &&
|
|
64
|
-
css `
|
|
65
|
-
border: 2px solid var(--primary-main);
|
|
66
|
-
`}
|
|
67
|
-
|
|
68
|
-
@media (min-width: ${size.sm}) {
|
|
69
|
-
display: block;
|
|
70
|
-
max-width: none;
|
|
71
|
-
}
|
|
72
|
-
`;
|
|
73
|
-
export const FeaturesSection = styled.div `
|
|
74
|
-
width: 100%;
|
|
75
|
-
`;
|
|
76
|
-
export const FeaturesGrid = styled.ul `
|
|
77
|
-
display: grid;
|
|
78
|
-
grid-template-columns: repeat(2, 1fr);
|
|
79
|
-
gap: 0.5rem;
|
|
80
|
-
list-style: none;
|
|
81
|
-
padding: 0;
|
|
82
|
-
margin: 0;
|
|
83
|
-
|
|
84
|
-
@media (min-width: ${size.sm}) {
|
|
85
|
-
display: flex;
|
|
86
|
-
justify-content: center;
|
|
87
|
-
}
|
|
88
|
-
`;
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import styled, { css } from 'styled-components'
|
|
2
|
-
import { size } from '../../../globalStyles/breakpoints'
|
|
3
|
-
|
|
4
|
-
type PlanWrapperProps = {
|
|
5
|
-
isActive: boolean
|
|
6
|
-
isHighlighted?: boolean
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
type SelectorButton = {
|
|
10
|
-
isActive: boolean
|
|
11
|
-
dataQa: string
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export const PricingContainerStyled = styled.section`
|
|
15
|
-
margin: 0 auto 0 auto;
|
|
16
|
-
display: flex;
|
|
17
|
-
flex-direction: column;
|
|
18
|
-
justify-content: center;
|
|
19
|
-
align-items: center;
|
|
20
|
-
max-width: 996px;
|
|
21
|
-
gap: 1.5rem;
|
|
22
|
-
margin-bottom: 3rem;
|
|
23
|
-
padding: 0 1.5rem;
|
|
24
|
-
`
|
|
25
|
-
|
|
26
|
-
export const PlanSelector = styled.div`
|
|
27
|
-
display: flex;
|
|
28
|
-
justify-content: center;
|
|
29
|
-
gap: 0.5rem;
|
|
30
|
-
border-radius: 1rem;
|
|
31
|
-
padding: 0.5rem;
|
|
32
|
-
|
|
33
|
-
@media (min-width: ${size.sm}) {
|
|
34
|
-
display: none;
|
|
35
|
-
}
|
|
36
|
-
`
|
|
37
|
-
|
|
38
|
-
export const SelectorButton = styled.button<SelectorButton>`
|
|
39
|
-
padding: 0.5rem;
|
|
40
|
-
border-radius: 0.5rem;
|
|
41
|
-
border: none;
|
|
42
|
-
outline: inherit;
|
|
43
|
-
flex: 1;
|
|
44
|
-
font-size: 12px;
|
|
45
|
-
font-weight: 700;
|
|
46
|
-
background-color: var(--neutral-neutral-4);
|
|
47
|
-
color: var(--neutral-neutral-1);
|
|
48
|
-
cursor: pointer;
|
|
49
|
-
transition: background-color 0.3s;
|
|
50
|
-
|
|
51
|
-
${({ isActive }) =>
|
|
52
|
-
isActive &&
|
|
53
|
-
css`
|
|
54
|
-
background-color: var(--primary-main);
|
|
55
|
-
color: white;
|
|
56
|
-
`}
|
|
57
|
-
`
|
|
58
|
-
|
|
59
|
-
export const PlansWrapper = styled.div`
|
|
60
|
-
display: flex;
|
|
61
|
-
height: 100%;
|
|
62
|
-
gap: 1rem;
|
|
63
|
-
width: 100%;
|
|
64
|
-
max-width: 327px;
|
|
65
|
-
|
|
66
|
-
@media (min-width: ${size.sm}) {
|
|
67
|
-
max-width: none;
|
|
68
|
-
gap: 20px;
|
|
69
|
-
}
|
|
70
|
-
`
|
|
71
|
-
|
|
72
|
-
export const PlanWrapper = styled.div<PlanWrapperProps>`
|
|
73
|
-
max-width: 327px;
|
|
74
|
-
border-radius: 1rem;
|
|
75
|
-
flex: 1;
|
|
76
|
-
display: ${({ isActive }) => (isActive ? 'block' : 'none')};
|
|
77
|
-
background-color: white;
|
|
78
|
-
|
|
79
|
-
${({ isHighlighted }) =>
|
|
80
|
-
isHighlighted &&
|
|
81
|
-
css`
|
|
82
|
-
border: 2px solid var(--primary-main);
|
|
83
|
-
`}
|
|
84
|
-
|
|
85
|
-
@media (min-width: ${size.sm}) {
|
|
86
|
-
display: block;
|
|
87
|
-
max-width: none;
|
|
88
|
-
}
|
|
89
|
-
`
|
|
90
|
-
|
|
91
|
-
export const FeaturesSection = styled.div`
|
|
92
|
-
width: 100%;
|
|
93
|
-
`
|
|
94
|
-
|
|
95
|
-
export const FeaturesGrid = styled.ul`
|
|
96
|
-
display: grid;
|
|
97
|
-
grid-template-columns: repeat(2, 1fr);
|
|
98
|
-
gap: 0.5rem;
|
|
99
|
-
list-style: none;
|
|
100
|
-
padding: 0;
|
|
101
|
-
margin: 0;
|
|
102
|
-
|
|
103
|
-
@media (min-width: ${size.sm}) {
|
|
104
|
-
display: flex;
|
|
105
|
-
justify-content: center;
|
|
106
|
-
}
|
|
107
|
-
`
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import { FeatureItem, PlanCard } from '../../atoms'
|
|
2
|
-
import {
|
|
3
|
-
FeaturesGrid,
|
|
4
|
-
FeaturesSection,
|
|
5
|
-
PlanSelector,
|
|
6
|
-
PlanWrapper,
|
|
7
|
-
PlansWrapper,
|
|
8
|
-
PricingContainerStyled,
|
|
9
|
-
SelectorButton
|
|
10
|
-
} from './PricingPlansPage.styled'
|
|
11
|
-
import { PricingPageHeader } from '../../organisms'
|
|
12
|
-
import { PricingPlansPageProps } from './PricingPlansPageProps'
|
|
13
|
-
import React from 'react'
|
|
14
|
-
import { StickyPlanBar } from '../../molecules/StickyPlanBar'
|
|
15
|
-
import { throttle } from '../../../utils/throttle'
|
|
16
|
-
|
|
17
|
-
export const PricingPlansPage: React.FC<PricingPlansPageProps> = ({
|
|
18
|
-
subscriptionPlans,
|
|
19
|
-
features,
|
|
20
|
-
onPlanSelect,
|
|
21
|
-
headerDivider,
|
|
22
|
-
siteName = 'Legalfinity',
|
|
23
|
-
phoneNumber
|
|
24
|
-
}) => {
|
|
25
|
-
const [activePlanIndex, setActivePlanIndex] = React.useState(0)
|
|
26
|
-
const plansWrapperRef = React.useRef<HTMLDivElement | null>(null)
|
|
27
|
-
const lastScrollYRef = React.useRef(0)
|
|
28
|
-
const [showStickyBar, setShowStickyBar] = React.useState(false)
|
|
29
|
-
|
|
30
|
-
const activePlan = subscriptionPlans[activePlanIndex]
|
|
31
|
-
|
|
32
|
-
React.useEffect(() => {
|
|
33
|
-
const handleScroll = () => {
|
|
34
|
-
if (!plansWrapperRef.current) return
|
|
35
|
-
|
|
36
|
-
const currentScrollY = window.scrollY
|
|
37
|
-
const isMobile = window.innerWidth < 720
|
|
38
|
-
|
|
39
|
-
if (!isMobile) {
|
|
40
|
-
if (showStickyBar) {
|
|
41
|
-
setShowStickyBar(false)
|
|
42
|
-
}
|
|
43
|
-
return
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const isScrollingUp = currentScrollY < lastScrollYRef.current - 10 ? 'up' : null
|
|
47
|
-
|
|
48
|
-
const scrollDirection = currentScrollY > lastScrollYRef.current + 10 ? 'down' : isScrollingUp
|
|
49
|
-
if (!scrollDirection) return
|
|
50
|
-
|
|
51
|
-
const targetRect = plansWrapperRef.current.getBoundingClientRect()
|
|
52
|
-
const isPastWrapper = targetRect.bottom < 400
|
|
53
|
-
|
|
54
|
-
if (scrollDirection === 'down' && isPastWrapper) {
|
|
55
|
-
if (!showStickyBar) {
|
|
56
|
-
setShowStickyBar(true)
|
|
57
|
-
}
|
|
58
|
-
} else if (scrollDirection === 'up' || !isPastWrapper) {
|
|
59
|
-
if (showStickyBar && !isPastWrapper) {
|
|
60
|
-
setShowStickyBar(false)
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
lastScrollYRef.current = currentScrollY
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const handleResize = () => {
|
|
68
|
-
if (window.innerWidth >= 720) {
|
|
69
|
-
setShowStickyBar(false)
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const throttledHandleScroll = throttle(handleScroll, 100)
|
|
74
|
-
|
|
75
|
-
window.addEventListener('scroll', throttledHandleScroll)
|
|
76
|
-
window.addEventListener('resize', handleResize)
|
|
77
|
-
|
|
78
|
-
return () => {
|
|
79
|
-
window.removeEventListener('scroll', throttledHandleScroll)
|
|
80
|
-
window.removeEventListener('resize', handleResize)
|
|
81
|
-
}
|
|
82
|
-
}, [showStickyBar])
|
|
83
|
-
|
|
84
|
-
return (
|
|
85
|
-
<>
|
|
86
|
-
<PricingPageHeader siteName={siteName} phoneNumber={phoneNumber} />
|
|
87
|
-
{headerDivider}
|
|
88
|
-
{subscriptionPlans?.length > 0 && (
|
|
89
|
-
<PricingContainerStyled>
|
|
90
|
-
<PlanSelector>
|
|
91
|
-
{subscriptionPlans.map((plan, index) => (
|
|
92
|
-
<SelectorButton
|
|
93
|
-
key={`selector-${plan?.pricingLabel}`}
|
|
94
|
-
isActive={index === activePlanIndex}
|
|
95
|
-
onClick={() => setActivePlanIndex(index)}
|
|
96
|
-
dataQa={`selector-${plan.subscription_type?.name.replaceAll(' ', '')}`}
|
|
97
|
-
>
|
|
98
|
-
{plan?.subscription_type?.name}
|
|
99
|
-
</SelectorButton>
|
|
100
|
-
))}
|
|
101
|
-
</PlanSelector>
|
|
102
|
-
<PlansWrapper ref={plansWrapperRef}>
|
|
103
|
-
{subscriptionPlans.map((plan, index) => (
|
|
104
|
-
<PlanWrapper
|
|
105
|
-
key={plan.pricingLabel}
|
|
106
|
-
isHighlighted={plan.highlightPlan}
|
|
107
|
-
isActive={index === activePlanIndex}
|
|
108
|
-
className={`pricing-plan__element-container ${plan?.highlightPlan ? 'highlight' : ''} ${index === activePlanIndex ? 'active' : ''}`}
|
|
109
|
-
>
|
|
110
|
-
<PlanCard onSelect={onPlanSelect ?? (() => {})} plan={plan} />
|
|
111
|
-
</PlanWrapper>
|
|
112
|
-
))}
|
|
113
|
-
</PlansWrapper>
|
|
114
|
-
{features && features.length > 0 && (
|
|
115
|
-
<FeaturesSection>
|
|
116
|
-
<FeaturesGrid>
|
|
117
|
-
{features.map((feature) => (
|
|
118
|
-
<FeatureItem feature={feature} key={feature.description} />
|
|
119
|
-
))}
|
|
120
|
-
</FeaturesGrid>
|
|
121
|
-
</FeaturesSection>
|
|
122
|
-
)}
|
|
123
|
-
<StickyPlanBar activePlan={activePlan} showStickyBar={showStickyBar} onPlanSelect={onPlanSelect} />
|
|
124
|
-
</PricingContainerStyled>
|
|
125
|
-
)}
|
|
126
|
-
</>
|
|
127
|
-
)
|
|
128
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { FeatureItemProp, SubscriptionPlan } from '../../atoms';
|
|
2
|
-
export interface PricingPlansPageProps {
|
|
3
|
-
subscriptionPlans: SubscriptionPlan[];
|
|
4
|
-
features?: FeatureItemProp[];
|
|
5
|
-
onPlanSelect?: (sku: string) => void;
|
|
6
|
-
headerDivider?: React.ReactNode;
|
|
7
|
-
siteName?: string;
|
|
8
|
-
phoneNumber?: string;
|
|
9
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { FeatureItemProp, SubscriptionPlan } from '../../atoms'
|
|
2
|
-
|
|
3
|
-
export interface PricingPlansPageProps {
|
|
4
|
-
subscriptionPlans: SubscriptionPlan[]
|
|
5
|
-
features?: FeatureItemProp[]
|
|
6
|
-
onPlanSelect?: (sku: string) => void
|
|
7
|
-
headerDivider?: React.ReactNode
|
|
8
|
-
siteName?: string
|
|
9
|
-
phoneNumber?: string
|
|
10
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function throttle<T extends (...args: unknown[]) => unknown>(func: T, limit: number): (this: ThisParameterType<T>, ...args: Parameters<T>) => void;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export function throttle<T extends (...args: unknown[]) => unknown>(func: T, limit: number) {
|
|
2
|
-
let inThrottle: boolean | undefined
|
|
3
|
-
|
|
4
|
-
return function (this: ThisParameterType<T>, ...args: Parameters<T>): void {
|
|
5
|
-
if (!inThrottle) {
|
|
6
|
-
func.apply(this, args)
|
|
7
|
-
inThrottle = true
|
|
8
|
-
setTimeout(() => (inThrottle = false), limit)
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
}
|