-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
391 additions
and
617 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,17 @@ | ||
/* eslint-disable jsx-a11y/alt-text */ | ||
import { ConnectKitButton } from 'connectkit'; | ||
import { useAuth } from 'src/hooks/useAuth'; | ||
|
||
export const LoginButton = () => { | ||
const { user } = useAuth(); | ||
|
||
return ( | ||
<ConnectKitButton.Custom> | ||
{({ | ||
isConnected, | ||
isConnecting, | ||
show, | ||
hide, | ||
address, | ||
ensName, | ||
chain, | ||
}) => { | ||
return ( | ||
<button | ||
className="group flex items-center justify-center rounded-lg bg-gray-100 p-2 font-bold transition hover:brightness-95" | ||
onClick={show} | ||
> | ||
Connect App | ||
</button> | ||
); | ||
<button | ||
className="group flex items-center justify-center rounded-lg bg-gray-100 p-2 font-bold transition hover:brightness-95" | ||
onClick={() => { | ||
console.log('login'); | ||
}} | ||
</ConnectKitButton.Custom> | ||
> | ||
Connect App | ||
</button> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* eslint-disable react/display-name */ | ||
import { toComponent } from '@utils/toComponent'; | ||
import { FC } from 'react'; | ||
import { FiArrowRight } from 'react-icons/fi'; | ||
|
||
export const SelectableAccount: FC<{ | ||
data: { name: string; avatar: string }; | ||
}> = ({ data }) => { | ||
return ( | ||
<li key={'account-' + data.name}> | ||
<button className="group flex w-full items-center gap-x-2 rounded-xl p-2 font-bold outline-neutral-400 transition hover:bg-gray-100 focus:bg-gray-100"> | ||
<div className="h-8 w-8 overflow-hidden rounded-full bg-gray-200"> | ||
<img | ||
src={data.avatar} | ||
className="h-8 w-8 rounded-full" | ||
alt="" | ||
/> | ||
</div> | ||
<span className="grow text-left">{data.name}</span> | ||
<FiArrowRight className="-translate-x-3 opacity-0 transition-all group-hover:translate-x-0 group-hover:opacity-100 group-focus:translate-x-0 group-focus:opacity-100" /> | ||
</button> | ||
</li> | ||
); | ||
}; | ||
|
||
export const toSelectableAccount = toComponent(SelectableAccount); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* eslint-disable react/display-name */ | ||
import { FC } from 'react'; | ||
|
||
export type DataFromComponent<T> = T extends FC<{ data: infer O }> ? O : never; | ||
|
||
export const toComponent = | ||
<C, O = DataFromComponent<C>>(Component: C) => | ||
(object: O, index: number) => | ||
( | ||
// @ts-ignore | ||
<Component data={object} key={index} /> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters