-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
eebffc6
commit 222b98f
Showing
15 changed files
with
226 additions
and
41 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,8 +17,7 @@ | |
|
||
<link rel="preconnect" href="https://fonts.googleapis.com"> | ||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> | ||
<link href="https://fonts.googleapis.com/css2?family=Source+Code+Pro:ital,wght@0,200..900;1,200..900&display=swap" | ||
rel="stylesheet"> | ||
<link href="https://fonts.googleapis.com/css2?family=Source+Code+Pro:[email protected]&family=Urbanist:ital,wght@0,100..900;1,100..900&display=swap" rel="stylesheet"> | ||
</head> | ||
|
||
<body> | ||
|
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
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,25 @@ | ||
import { Typography } from '../Typography' | ||
|
||
type Props = { | ||
label: string | ||
onClick: () => void | ||
isLoading?: boolean | ||
isDisabled?: boolean | ||
classNames?: string | ||
} | ||
|
||
export const Button = ({ label, onClick, isDisabled, isLoading, classNames }: Props) => { | ||
return ( | ||
<button | ||
onClick={onClick} | ||
disabled={isDisabled || isLoading} | ||
className={`border-[1px] rounded-full h-full w-full flex justify-center items-center ${classNames}`} | ||
> | ||
{isLoading ? ( | ||
<div className="animate-spin h-[25px] w-[25px] border-[2px] rounded-full border-black/50 border-t-black"></div> | ||
) : ( | ||
<Typography text={label} /> | ||
)} | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { PropsWithChildren } from 'react' | ||
|
||
import { useTranslation } from 'react-i18next' | ||
|
||
type Props = PropsWithChildren<{ | ||
text?: string | ||
classNames?: string | ||
}> | ||
|
||
export const Typography = (props: Props) => { | ||
const { i18n } = useTranslation() | ||
|
||
const language = i18n.language as 'en' | 'ru' | ||
|
||
const fontFamilyMap = { | ||
en: 'text-en', | ||
ru: 'text-ru', | ||
} | ||
|
||
return ( | ||
<div className={`${fontFamilyMap[language]} ${props.classNames}`}> | ||
{props.text ?? props.children} | ||
</div> | ||
) | ||
} |
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,28 +1,35 @@ | ||
import { ForwardedRef, forwardRef } from 'react' | ||
|
||
import { useCustomTranslation } from '~/feature/translation' | ||
import { Button } from '~/shared/ui' | ||
|
||
type Props = { | ||
labelKey: string | ||
onClick: () => void | ||
isLoading?: boolean | ||
isDisabled?: boolean | ||
classNames?: string | ||
} | ||
|
||
export const LoginButton = ({ onClick, isLoading, labelKey, isDisabled }: Props) => { | ||
const { t } = useCustomTranslation() | ||
export const LoginButton = forwardRef( | ||
( | ||
{ onClick, isLoading, labelKey, isDisabled, classNames }: Props, | ||
ref: ForwardedRef<HTMLDivElement>, | ||
) => { | ||
const { t } = useCustomTranslation() | ||
|
||
return ( | ||
<div className="w-[300px] h-[45px]"> | ||
<button | ||
onClick={onClick} | ||
disabled={isDisabled || isLoading} | ||
className="border-[1px] rounded-full bg-green border-black h-full w-full flex justify-center items-center" | ||
> | ||
{isLoading ? ( | ||
<div className="animate-spin h-[25px] w-[25px] border-[2px] rounded-full border-black/50 border-t-black"></div> | ||
) : ( | ||
t(labelKey) | ||
)} | ||
</button> | ||
</div> | ||
) | ||
} | ||
return ( | ||
<div ref={ref} className="w-[300px] h-[45px]"> | ||
<Button | ||
label={t(labelKey)} | ||
onClick={onClick} | ||
isLoading={isLoading} | ||
isDisabled={isDisabled} | ||
classNames={classNames} | ||
/> | ||
</div> | ||
) | ||
}, | ||
) | ||
|
||
LoginButton.displayName = 'LoginButton' |
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
Oops, something went wrong.