-
Notifications
You must be signed in to change notification settings - Fork 13
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
feat(wallet-dashboard): style my coins #3726
Conversation
…shboard/style-balance-box
…shboard/style-balance-box
This pull request has been deployed to Vercel. Latest commit: 440291f ✅ Preview: https://wallet-dashboard-a225fcfa1e2f852205a61a7cd1d5d93e92-1ju5atfhi.vercel.app |
This pull request has been deployed to Vercel. Latest commit: 440291f ✅ Preview: https://iota-rebased-explorer-092603f1de8088243ccb8b861b23e-3wyv69kf1.vercel.app |
This pull request has been deployed to Vercel. Latest commit: 440291f ✅ Preview: https://apps-backend-29a719c9ccbdb9b80c97b599a599d8953354da-8hduol76m.vercel.app |
This pull request has been deployed to Vercel. Latest commit: b832e54 ✅ Preview: https://apps-backend-29a719c9ccbdb9b80c97b599a599d8953354da-hcidf5295.vercel.app |
This pull request has been deployed to Vercel. Latest commit: b832e54 ✅ Preview: https://wallet-dashboard-a225fcfa1e2f852205a61a7cd1d5d93e92-aok0j6gcv.vercel.app |
This pull request has been deployed to Vercel. Latest commit: b832e54 ✅ Preview: https://iota-rebased-explorer-092603f1de8088243ccb8b861b23e-lrg61lrmt.vercel.app |
apps/wallet-dashboard/app/(protected)/components/top-nav/TopNav.tsx
…oard/style-my-coins
…oard/style-my-coins
This pull request has been deployed to Vercel. Latest commit: 99c6e14 ✅ Preview: https://wallet-dashboard-a225fcfa1e2f852205a61a7cd1d5d93e92-p17n7pvya.vercel.app |
export interface ImageIconProps { | ||
src: string | null | undefined; | ||
label: string; | ||
fallback: string; | ||
alt?: string; | ||
rounded?: boolean; | ||
size?: ImageIconSize; | ||
} | ||
|
||
function FallBackAvatar({ | ||
str, | ||
rounded, | ||
size = ImageIconSize.Large, | ||
}: { | ||
str: string; | ||
rounded?: boolean; | ||
size?: ImageIconSize; | ||
}) { | ||
function generateTextSize(size: ImageIconSize) { | ||
switch (size) { | ||
case ImageIconSize.Small: | ||
return 'text-label-sm'; | ||
case ImageIconSize.Medium: | ||
return 'text-label-md'; | ||
case ImageIconSize.Large: | ||
return 'text-title-md'; | ||
case ImageIconSize.Full: | ||
return 'text-title-lg'; | ||
} | ||
} | ||
return ( | ||
<div | ||
className={cn( | ||
'flex h-full w-full items-center justify-center bg-neutral-96 bg-gradient-to-r capitalize dark:bg-neutral-20', | ||
{ 'rounded-full': rounded }, | ||
generateTextSize(size), | ||
)} | ||
> | ||
{str?.slice(0, 2)} | ||
</div> | ||
); | ||
} | ||
|
||
export function ImageIcon({ src, label, alt = label, fallback, rounded, size }: ImageIconProps) { | ||
const [error, setError] = useState(false); | ||
return ( | ||
<div role="img" aria-label={label} className={size}> | ||
{error || !src ? ( | ||
<FallBackAvatar rounded={rounded} str={fallback} size={size} /> | ||
) : ( | ||
<Image | ||
src={src} | ||
alt={alt} | ||
className="flex h-full w-full items-center justify-center rounded-full object-cover" | ||
onError={() => setError(true)} | ||
layout="fill" | ||
objectFit="cover" | ||
/> | ||
)} | ||
</div> | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export interface ImageIconProps { | |
src: string | null | undefined; | |
label: string; | |
fallback: string; | |
alt?: string; | |
rounded?: boolean; | |
size?: ImageIconSize; | |
} | |
function FallBackAvatar({ | |
str, | |
rounded, | |
size = ImageIconSize.Large, | |
}: { | |
str: string; | |
rounded?: boolean; | |
size?: ImageIconSize; | |
}) { | |
function generateTextSize(size: ImageIconSize) { | |
switch (size) { | |
case ImageIconSize.Small: | |
return 'text-label-sm'; | |
case ImageIconSize.Medium: | |
return 'text-label-md'; | |
case ImageIconSize.Large: | |
return 'text-title-md'; | |
case ImageIconSize.Full: | |
return 'text-title-lg'; | |
} | |
} | |
return ( | |
<div | |
className={cn( | |
'flex h-full w-full items-center justify-center bg-neutral-96 bg-gradient-to-r capitalize dark:bg-neutral-20', | |
{ 'rounded-full': rounded }, | |
generateTextSize(size), | |
)} | |
> | |
{str?.slice(0, 2)} | |
</div> | |
); | |
} | |
export function ImageIcon({ src, label, alt = label, fallback, rounded, size }: ImageIconProps) { | |
const [error, setError] = useState(false); | |
return ( | |
<div role="img" aria-label={label} className={size}> | |
{error || !src ? ( | |
<FallBackAvatar rounded={rounded} str={fallback} size={size} /> | |
) : ( | |
<Image | |
src={src} | |
alt={alt} | |
className="flex h-full w-full items-center justify-center rounded-full object-cover" | |
onError={() => setError(true)} | |
layout="fill" | |
objectFit="cover" | |
/> | |
)} | |
</div> | |
); | |
} | |
interface FallBackAvatarProps { | |
text: string; | |
rounded?: boolean; | |
size?: ImageIconSize; | |
} | |
function FallBackAvatar({ | |
text, | |
rounded, | |
size = ImageIconSize.Large, | |
}: FallBackAvatarProps ) { | |
const textSize = (() => { | |
switch (size) { | |
case ImageIconSize.Small: | |
return 'text-label-sm'; | |
case ImageIconSize.Medium: | |
return 'text-label-md'; | |
case ImageIconSize.Large: | |
return 'text-title-md'; | |
case ImageIconSize.Full: | |
return 'text-title-lg'; | |
} | |
})(); | |
return ( | |
<div | |
className={cn( | |
'flex h-full w-full items-center justify-center bg-neutral-96 bg-gradient-to-r capitalize dark:bg-neutral-20', | |
{ 'rounded-full': rounded }, | |
textSize , | |
)} | |
> | |
{text.slice(0, 2)} | |
</div> | |
); | |
} | |
export interface ImageIconProps { | |
src: string | null | undefined; | |
label: string; | |
fallbackText: string; | |
alt?: string; | |
rounded?: boolean; | |
size?: ImageIconSize; | |
} | |
export function ImageIcon({ src, label, alt = label, fallbackText, rounded, size }: ImageIconProps) { | |
const [error, setError] = useState(false); | |
return ( | |
<div role="img" aria-label={label} className={size}> | |
{error || !src ? ( | |
<FallBackAvatar rounded={rounded} text={fallbackText} size={size} /> | |
) : ( | |
<Image | |
src={src} | |
alt={alt} | |
className="flex h-full w-full items-center justify-center rounded-full object-cover" | |
onError={() => setError(true)} | |
layout="fill" | |
objectFit="cover" | |
/> | |
)} | |
</div> | |
); | |
} |
<ImageIcon | ||
src={coinMeta?.iconUrl} | ||
label={coinMeta?.name || coinType} | ||
fallback={coinMeta?.name || coinType} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fallback={coinMeta?.name || coinType} | |
fallbackText={coinMeta?.name || coinType} |
This pull request has been deployed to Vercel. Latest commit: 2820b8c ✅ Preview: https://wallet-dashboard-a225fcfa1e2f852205a61a7cd1d5d93e92-iufe1hvtx.vercel.app |
This pull request has been deployed to Vercel. Latest commit: c62c21b ✅ Preview: https://wallet-dashboard-a225fcfa1e2f852205a61a7cd1d5d93e92-5qmcgecy7.vercel.app |
This pull request has been deployed to Vercel. Latest commit: 7638ded ✅ Preview: https://wallet-dashboard-a225fcfa1e2f852205a61a7cd1d5d93e92-hipcudzm7.vercel.app |
This pull request has been deployed to Vercel. Latest commit: db68f79 ✅ Preview: https://wallet-dashboard-a225fcfa1e2f852205a61a7cd1d5d93e92-bagxjfzkb.vercel.app |
This pull request has been deployed to Vercel. Latest commit: 7b93192 ✅ Preview: https://wallet-dashboard-a225fcfa1e2f852205a61a7cd1d5d93e92-hkwljez9n.vercel.app |
This pull request has been deployed to Vercel. Latest commit: 751ceca ✅ Preview: https://wallet-dashboard-a225fcfa1e2f852205a61a7cd1d5d93e92-ocvbkpmos.vercel.app |
Description of change
Please write a summary of your changes and why you made them.
Links to any relevant issues
fixes #3684
Type of change
Choose a type of change, and delete any options that are not relevant.
How the change has been tested
Describe the tests that you ran to verify your changes.
Make sure to provide instructions for the maintainer as well as any relevant configurations.
Change checklist
Tick the boxes that are relevant to your changes, and delete any items that are not.