Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FB-324-332-website-changes-and-remove-FOUC #57

Merged
merged 5 commits into from
Jul 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4,948 changes: 4,472 additions & 476 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"@material-ui/core": "4.9.5",
"@material-ui/styles": "4.9.0",
"@mdx-js/react": "1.6.22",
"clsx": "1.2.1",
"clsx": "2.0.0",
"docusaurus-plugin-hotjar": "0.0.2",
"lodash": "4.17.21",
"lottie-react": "2.4.0",
Expand Down
122 changes: 13 additions & 109 deletions src/components/Button/Button.tsx
mkaliszewski marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,122 +1,26 @@
import noop from 'lodash/noop';
import { rem } from 'polished';
// eslint-disable-next-line no-unused-vars -- false positive error
import React, { ReactNode, MouseEvent } from 'react';
import styled, { css } from 'styled-components';

const resetDefault = css`
padding: 0;
border: none;
outline: none;
font: inherit;
color: inherit;
background: none;
`;

const commonStyles = css`
cursor: pointer;
font-weight: 700;
min-width: 180px;
padding: 16px;
border-radius: 32px;
transition: all 0.2s ease-out;
&:hover {
text-decoration: none;
}

${({ theme, variant, reversed }) => {
if (reversed && variant === 'solid') {
return css`
background-color: ${theme.color.primary};
color: ${theme.color.white};
border: 2px solid white;
&:hover {
background-color: ${theme.color.white};
color: ${theme.color.primary};
border: 2px solid ${({ theme }) => theme.color.primary};
}
`;
} else if (variant === 'solid') {
return css`
background-color: ${theme.color.black};
color: ${theme.color.white};
border: 2px solid ${theme.color.black};
&:hover {
background-color: inherit;
color: ${theme.color.black};
}
`;
} else if (variant === 'outlined') {
return css`
color: ${theme.color.black};
border: 2px solid ${theme.color.black};
&:hover {
background-color: ${theme.color.black};
color: ${theme.color.white};
}
`;
}
return css``;
}}

${({ size }) => {
if (size === 'md') {
return css`
font-size: ${rem('16px')};
line-height: ${rem('26px')};
`;
} else if (size === 'sm') {
return css`
font-size: ${rem('14px')};
line-height: ${rem('24px')};
`;
} else if (size === 'lg') {
return css`
font-size: ${rem('18px')};
line-height: ${rem('28px')};
`;
}
return css``;
}}
`;

const StyledButton = styled.button`
${resetDefault}
${commonStyles}
`;
import clsx from 'clsx';
import React, { ButtonHTMLAttributes } from 'react';

type ButtonProps = {
children: ReactNode;
className?: string;
disabled?: boolean;
onClick?: (event: MouseEvent<HTMLButtonElement>) => void;
reversed?: boolean;
size?: string;
type?: string;
variant?: string;
};
} & ButtonHTMLAttributes<HTMLButtonElement>;

export const Button = ({
children,
className,
disabled = false,
onClick = noop,
reversed = false,
size = 'md',
type = 'button',
variant = 'solid',
variant,
...props
}: ButtonProps) => {
return (
<StyledButton
className={className}
disabled={disabled}
onClick={onClick}
reversed={reversed}
size={size}
type={type}
variant={variant}
<button
className={clsx(className, 'button', {
button__solid: variant === 'solid',
button__outlined: variant === 'outlined',
button__pricing: variant === 'pricing',
})}
{...props}
>
{children}
</StyledButton>
</button>
);
};
11 changes: 3 additions & 8 deletions src/components/Card/Card.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
import React from 'react';

import { ReactNode } from "react";
import React, { ReactNode } from 'react';
import styled from 'styled-components';
import { BOX_BORDER_RADIUS } from '../../globalStyles/sharedStyles/box';

const CardComponent = styled.div`
width: 100%;
padding: 36px 48px;
text-align: center;
background-color: #eee;
${BOX_BORDER_RADIUS};
border-radius: 8px;
`;

const TitleComponent = styled.div`
Expand Down Expand Up @@ -43,9 +40,7 @@ export const Card = ({ icon, title, description }: CardProps) => {
<CardComponent>
<IconComponent>{icon}</IconComponent>
<TitleComponent>{title}</TitleComponent>
<DescriptionComponent>
{description}
</DescriptionComponent>
<DescriptionComponent>{description}</DescriptionComponent>
</CardComponent>
);
};
4 changes: 2 additions & 2 deletions src/components/ListCard/ListCard.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { BOX_BORDER_RADIUS } from '../../globalStyles/sharedStyles/box';
import styled from 'styled-components';

import media from '../../globalStyles/media';
import CheckmarkIcon from '../../images/svg/checkmark.svg';

Expand All @@ -13,7 +13,7 @@ const CardComponent = styled.div`
width: 100%;
padding: 36px 48px;
background-color: #eee;
${BOX_BORDER_RADIUS};
border-radius: 8px;
${media.lessThan('md')`
padding: 24px;
`}
Expand Down
44 changes: 26 additions & 18 deletions src/components/PricingCard/PricingCard.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { Link } from '@material-ui/core';
import React from 'react';
import styled from 'styled-components';

import CheckmarkIcon from '../../images/svg/checkmark.svg';
import TalkIcon from '../../images/svg/talk.svg';
import { Link } from '@material-ui/core';
import { Button } from '../Button';

type PricingCardProps = {
export type PricingCardData = {
color: string;
buttonText: string;
buttonLink: string;
Expand All @@ -13,8 +15,16 @@ type PricingCardProps = {
denominator?: string;
isMostPopular?: boolean;
benefits: string[] | string;
btnClassName:
| 'btn-trial'
| 'btn-buy-monthly'
| 'btn-buy-yearly'
| 'btn-buy-lifelong'
| 'btn-buy-custom';
};

type PricingCardProps = PricingCardData;

const TitleComponent = styled.div`
font-weight: 900;
font-size: 28px;
Expand Down Expand Up @@ -50,6 +60,8 @@ const BulletpointWrapComponent = styled.div`
`;

const LinkComponent = styled(Link)`
display: flex;
justify-content: center;
&:hover {
text-decoration: none !important;
}
Expand Down Expand Up @@ -80,7 +92,7 @@ const BadgeComponent = styled.div`
`;

const BenefitsComponent = styled.div`
text-align: ${({ isBenefitsList }) => isBenefitsList ? 'center' : 'left'};
text-align: ${({ isBenefitsList }) => (isBenefitsList ? 'center' : 'left')};
display: flex;
flex-flow: column;
flex-grow: 1;
Expand All @@ -101,19 +113,6 @@ const BulletPointComponent = styled.div`
}
`;

const ButtonComponent = styled.button`
background-color: ${({ color }) => color};
display: block;
margin: auto;
color: white;
border-radius: 30px;
border: 0px;
padding: 15px 30px;
font-weight: 700;
font-size: 18px;
cursor: pointer;
`;

export const PricingCard = ({
color,
title,
Expand All @@ -123,12 +122,15 @@ export const PricingCard = ({
denominator,
isMostPopular,
buttonLink,
btnClassName,
}: PricingCardProps) => {
const isBenefitsList = typeof benefits === 'string';

return (
<CardComponent color={color}>
{isMostPopular && <BadgeComponent color={color}>Most popular</BadgeComponent>}
{isMostPopular && (
<BadgeComponent color={color}>Most popular</BadgeComponent>
)}
<TitleComponent>{title}</TitleComponent>
{price ? (
<PriceComponent>
Expand Down Expand Up @@ -161,7 +163,13 @@ export const PricingCard = ({
))}
</BenefitsComponent>
<LinkComponent href={buttonLink}>
<ButtonComponent color={color}>{buttonText}</ButtonComponent>
<Button
className={btnClassName}
variant="pricing"
style={{ backgroundColor: color }}
>
{buttonText}
</Button>
</LinkComponent>
</CardComponent>
);
Expand Down
6 changes: 5 additions & 1 deletion src/components/SectionLayout/SectionLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ export const SectionLayout = ({
}: SectionLayoutProps) => (
<Section alternativeBackground={alternativeBackground} id={id}>
<Container>
{heading && <AccentHeading isStrong size="lg" center={centerHeading}>{heading}</AccentHeading>}
{heading && (
<AccentHeading size="lg" center={centerHeading} isStrong>
{heading}
</AccentHeading>
)}
{children}
</Container>
</Section>
Expand Down
Loading