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

Implement Fund Card component #1718

Open
wants to merge 61 commits into
base: main
Choose a base branch
from
Open

Implement Fund Card component #1718

wants to merge 61 commits into from

Conversation

rustam-cb
Copy link
Contributor

@rustam-cb rustam-cb commented Dec 11, 2024

What changed? Why?
Implemented a new component FundCard
P/PS: https://docs.google.com/document/d/1y57fxsga2ZLF8-ieH2OY7jvqx5468txQuek1WTYPBxE/edit?tab=t.0

Usage:

FundCard assetSymbol="ETH" /> 

Component is customizable and there are few components that can be passed into it.

  AmountInputComponent 
  HeaderComponent
  AmountInputTypeSwithComponent
  PaymentMethodSelectorDropdownComponent
  SubmitButtonComponent
Fiat input Crypto input
Screenshot 2024-12-17 at 9 38 52 PM Screenshot 2024-12-17 at 9 39 06 PM
No input (default) payment method dropdown
Screenshot 2024-12-17 at 9 38 41 PM Screenshot 2024-12-17 at 9 39 20 PM

Notes to reviewers
Overall component structure:

  • FundCard
    • HeaderComponent
    • AmountInputComponent
    • PaymentMethodDropdownComponent
    • SubmitButtonComponent

How has it been tested?

  • Unit tests
  • Manual testing

Copy link

vercel bot commented Dec 11, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
onchainkit-coverage ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 20, 2024 11:36pm
onchainkit-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 20, 2024 11:36pm
onchainkit-routes ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 20, 2024 11:36pm

`}
</style>

<div className="flex" style={{ height: '78px' }}>
Copy link
Contributor

Choose a reason for hiding this comment

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

Stick to tailwind classes for consistency

Copy link
Contributor

Choose a reason for hiding this comment

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

preferably h-20 here

className={cn(
text.body,
'border-none bg-transparent',
'text-[3.75rem] leading-none outline-none',
Copy link
Contributor

Choose a reason for hiding this comment

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

should be text-6xl instead of arbitrary

className={cn(
text.body,
'border-none bg-transparent',
'text-[3.75rem] leading-none outline-none',
Copy link
Contributor

Choose a reason for hiding this comment

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

text-6xl

Comment on lines +158 to +163
style={{
position: 'absolute',
opacity: 0,
whiteSpace: 'nowrap',
pointerEvents: 'none',
}}
Copy link
Contributor

Choose a reason for hiding this comment

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

move into Tailwind utilities for consistency

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dschlabach Where is the Tailwing utilities? I can't find any in the codebase. (The css I see is autogenerated and I can't add anything there)

Copy link
Contributor

Choose a reason for hiding this comment

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

All Tailwind utilities are accessible anywhere in /src. You can apply them directly as classes. https://tailwindcss.com/docs/utility-first

@@ -11,7 +13,7 @@ export const successSvg = (
<title>Success SVG</title>
<path
d="M8 0C3.58 0 0 3.58 0 8C0 12.42 3.58 16 8 16C12.42 16 16 12.42 16 8C16 3.58 12.42 0 8 0ZM6.72667 11.5333L3.73333 8.54L4.67333 7.6L6.72667 9.65333L11.44 4.94L12.38 5.88L6.72667 11.5333Z"
fill="#65A30D"
className={className}
Copy link
Contributor

Choose a reason for hiding this comment

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

This will break color styling

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dschlabach It used to be hardcoded 65A30D, and now I'm using icon.success. Do you mean that icon.success is a different tone than 65A30D ?

Copy link
Contributor

Choose a reason for hiding this comment

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

This is likely hardcoded because the icon fill color should not update based off of themes / modes

@@ -11,7 +13,7 @@ export const errorSvg = (
<title>Error SVG</title>
<path
d="M8 16C12.4183 16 16 12.4183 16 8C16 3.58171 12.4183 0 8 0C3.58172 0 0 3.58171 0 8C0 12.4183 3.58172 16 8 16ZM11.7576 5.0909L8.84853 8L11.7576 10.9091L10.9091 11.7576L8 8.84851L5.09093 11.7576L4.2424 10.9091L7.15147 8L4.2424 5.0909L5.09093 4.24239L8 7.15145L10.9091 4.24239L11.7576 5.0909Z"
fill="#E11D48"
className={className}
Copy link
Contributor

Choose a reason for hiding this comment

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

This will break color styling

@@ -12,7 +14,7 @@ export const coinbasePaySvg = (
fillRule="evenodd"
clipRule="evenodd"
d="M10.0145 14.1666C7.82346 14.1666 6.04878 12.302 6.04878 9.99996C6.04878 7.69788 7.82346 5.83329 10.0145 5.83329C11.9776 5.83329 13.6069 7.33677 13.9208 9.30552H17.9163C17.5793 5.02774 14.172 1.66663 10.0145 1.66663C5.63568 1.66663 2.08301 5.39926 2.08301 9.99996C2.08301 14.6007 5.63568 18.3333 10.0145 18.3333C14.172 18.3333 17.5793 14.9722 17.9163 10.6944H13.9208C13.6069 12.6632 11.9776 14.1666 10.0145 14.1666Z"
fill="#f9fafb"
className={className}
Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't this break default styling in things like CheckoutButton?

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 have set color icon.foreground by default

Copy link
Contributor

Choose a reason for hiding this comment

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

This will break the default styling for this SVG when themes are applied. If you need a CoinbasePaySVG to update then we might have to create a new SVG for that

@@ -49,6 +51,7 @@ export function TextInput({

return (
<input
style={style}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need to add an inline style attribute here? We should try to stick to className for consistency

Comment on lines 91 to 94
/**
* Fetches and sets the exchange rate for the asset
*/
useExchangeRate(assetSymbol);
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be moved into the provider or is there a reason it's here? A bit hard to tell what side effect it's having

Comment on lines 7 to 8
width="16"
height="16"
Copy link
Contributor

Choose a reason for hiding this comment

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

We should lean towards width 100% and height 100% - This allows for more flexible icons, leaving the sizing to the parent component.

@cpcramer
Copy link
Contributor

I recommend splitting this into smaller PRs, it will make reviewing and updating a lot easier and faster!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation pkg: fund pkg: styles pkg: swap root
Development

Successfully merging this pull request may close these issues.

4 participants