Skip to content

Commit

Permalink
feat: buttons now have distinct icons for different types
Browse files Browse the repository at this point in the history
  • Loading branch information
cnasc committed Feb 22, 2024
1 parent 26a59cd commit aceb790
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
17 changes: 15 additions & 2 deletions framegear/components/Frame/Frame.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { postFrame } from '@/utils/postFrame';
import { frameResultsAtom } from '@/utils/store';
import { ExternalLinkIcon, RocketIcon, TokensIcon } from '@radix-ui/react-icons';
import { useAtom } from 'jotai';
import { PropsWithChildren, useCallback, useMemo } from 'react';

Expand Down Expand Up @@ -119,14 +120,26 @@ function FrameButton({
}
// TODO: implement other actions
}, [button, setResults]);
const buttonIcon = useMemo(() => {
switch (button?.action) {
case 'link':
return <ExternalLinkIcon />;
case 'post_redirect':
return <RocketIcon />;
case 'mint':
return <TokensIcon />;
default:
return null;
}
}, [button?.action]);
return (
<button
className="border-button w-[45%] grow rounded-lg border bg-white p-2 text-black"
className="border-button flex w-[45%] grow items-center justify-center gap-1 rounded-lg border bg-white p-2 text-black"
type="button"
onClick={handleClick}
disabled={button?.action !== 'post'}
>
<span>{children}</span>
<span>{children}</span> {buttonIcon}
</button>
);
}
4 changes: 2 additions & 2 deletions framegear/components/Header/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { APP_NAME } from '@/utils/constants';
import { ArrowTopRightIcon } from '@radix-ui/react-icons';
import { ExternalLinkIcon } from '@radix-ui/react-icons';
import Link from 'next/link';

export function Header() {
Expand Down Expand Up @@ -31,7 +31,7 @@ function Banner() {
className="bg-link-button flex items-center gap-1 rounded-full px-4 py-2"
href="https://docs.farcaster.xyz/reference/frames/spec"
>
<span>Farcaster Frames specs</span> <ArrowTopRightIcon />
<span>Farcaster Frames specs</span> <ExternalLinkIcon />
</Link>
</div>
);
Expand Down

0 comments on commit aceb790

Please sign in to comment.