This repository has been archived by the owner on Oct 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
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
Vadim
committed
Dec 12, 2022
1 parent
181016f
commit cfa0b01
Showing
8 changed files
with
1,944 additions
and
367 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export class Signer { | ||
|
||
} |
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,33 @@ | ||
export interface UserData { | ||
name: string; | ||
addressByIndex: string; | ||
} | ||
|
||
export interface Provider { | ||
user: UserData | null; | ||
|
||
on<EVENT extends keyof AuthEvents>( | ||
event: EVENT, | ||
handler: Handler<AuthEvents[EVENT]> | ||
): Provider; | ||
|
||
once<EVENT extends keyof AuthEvents>( | ||
event: EVENT, | ||
handler: Handler<AuthEvents[EVENT]> | ||
): Provider; | ||
|
||
off<EVENT extends keyof AuthEvents>( | ||
event: EVENT, | ||
handler: Handler<AuthEvents[EVENT]> | ||
): Provider; | ||
/** | ||
* Logs in user using provider | ||
*/ | ||
login(): Promise<UserData>; | ||
} | ||
export type Handler<T> = (data: T) => any; | ||
|
||
export type AuthEvents = { | ||
login: Readonly<UserData>; | ||
logout: void; | ||
}; |
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,57 @@ | ||
import React, { ReactElement, useMemo } from 'react'; | ||
|
||
type ButtonProps = { | ||
title: string | ReactElement; | ||
disabled?: boolean; | ||
mode: 'gradient' | 'icon_transparent' | 'transparent'; | ||
className?: string; | ||
iconLeft?: JSX.Element; | ||
iconRight?: JSX.Element; | ||
onClick?: () => void; | ||
}; | ||
|
||
export const Button: React.FC<ButtonProps> = ({ | ||
mode, | ||
title, | ||
disabled, | ||
className, | ||
iconLeft, | ||
iconRight, | ||
onClick, | ||
}) => { | ||
const cn = useMemo(() => { | ||
if (mode === 'gradient' && !disabled) | ||
return `w-[100%] button_gradient text-white text_button ext:py-[7px] tablet:py-[14px] rounded-[15px] ${className}`; | ||
|
||
if (mode === 'gradient' && disabled) | ||
return `w-[100%] button_gradient_disabled text-white-0.3 text_button ext:py-[7px] tablet:py-[14px] rounded-[15px] ${className}`; | ||
|
||
if (mode === 'transparent' && !disabled) | ||
return `w-[100%] bg-brown text-white text_button border-[1px] border-solid border-dark_grey ext:py-[7px] tablet:py-[14px] rounded-[15px] | ||
hover:bg-gradient-to-r hover:from-[rgba(139,228,217,0.15)] hover:to-[rgba(255,144,47,0.15] | ||
${className}`; | ||
|
||
if (mode === 'transparent' && disabled) | ||
return `w-[100%] bg-brown text-light_brown text_button border-[1px] border-solid border-dark_grey ext:py-[7px] tablet:py-[14px] rounded-[15px] | ||
${className}`; | ||
}, [className, mode, disabled]); | ||
|
||
if (mode === 'icon_transparent') | ||
return ( | ||
<button | ||
disabled={disabled} | ||
onClick={onClick} | ||
className={`flex text_button items-center justify-center text-light_grey ${className}`} | ||
> | ||
<span>{iconLeft}</span> | ||
<span>{title}</span> | ||
{iconRight && <span className="ml-[6px]">{iconRight}</span>} | ||
</button> | ||
); | ||
|
||
return ( | ||
<button disabled={disabled} onClick={onClick} className={`${cn}`}> | ||
{title} | ||
</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
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
Oops, something went wrong.