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

Conversation

paulinabjacykowska
Copy link
Contributor

This PR contains:

…classNames to the buttons and change styling
package.json Outdated Show resolved Hide resolved
src/components/Button/Button.tsx Outdated Show resolved Hide resolved
src/components/Button/Button.tsx Outdated Show resolved Hide resolved
src/components/Button/Button.tsx Show resolved Hide resolved
src/sections/Pricing/Pricing.tsx Outdated Show resolved Hide resolved
src/sections/Pricing/Pricing.tsx Outdated Show resolved Hide resolved
@@ -26,64 +27,91 @@ const DescriptionComponent = styled.div`
margin-bottom: 32px;
`;

type PricingCard = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it the same type as PricingCardProps? But as I mentioned in a previous comment - I'm not sure we need it at all.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, for now it is but for example what if we will want to pass another prop to the PricingCard component that is not related to this array? Also, this component and array are in different files and I am worried that it would be less readable if we will reuse this PricingCardProps type. But maybe I am wrong about this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, let's leave this array typed, but I'd change it a bit around.

For PricingCard.tsx let's do the following:

export type PricingCardData = {
  color: string;
  buttonText: string;
  buttonLink: string;
  title: string;
  price?: string;
  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;
  1. Let's add an additional check for btnClassName (as I understand it's for analytics reasons, so let's have it strictly typed)
  2. Let's move the type of PricingCardProps to PricingCardData (it will be easier to understand the import of this type in Pricing.tsx)
  3. We can say the PricingCardProps is PricingCardData. If we want to add additional props, we can just do type PricingCardProps = { someOtherProp: string } & PricingCardData.

Last of all we can get rid of PricingCard type from Pricing.tsx and import the one from PricingCard.tsx -> we will have only a single source of type, I think it's much less confusing than having 2 different types saying basically the same.

What do you think about that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I super much like that idea! ❤️

@paulinabjacykowska paulinabjacykowska merged commit ae45b13 into master Jul 31, 2023
@paulinabjacykowska paulinabjacykowska deleted the FB-324-332-part-1 branch July 31, 2023 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants