-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:cesium/seium.org into dg/infinite_s…
…croll_badgedex
- Loading branch information
Showing
82 changed files
with
1,018 additions
and
548 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
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,27 +1,36 @@ | ||
import { ButtonHTMLAttributes } from "react"; | ||
import { ButtonHTMLAttributes, ReactNode } from "react"; | ||
|
||
interface Props extends ButtonHTMLAttributes<HTMLButtonElement> { | ||
text: string; | ||
customStyle?: string; | ||
interface Props extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "title"> { | ||
title: ReactNode; | ||
description?: string; | ||
bold?: boolean; | ||
} | ||
|
||
interface ButtonTitleProps { | ||
title: ReactNode; | ||
bold?: boolean; | ||
} | ||
|
||
export default function Button({ | ||
text, | ||
type, | ||
disabled, | ||
onClick, | ||
customStyle, | ||
title, | ||
description, | ||
bold = false, | ||
...rest | ||
}: Props) { | ||
return ( | ||
<button | ||
onClick={onClick} | ||
type={type} | ||
disabled={disabled} | ||
className={`${ | ||
customStyle || "" | ||
} w-full items-center rounded-full border px-4 py-4 text-center font-iregular text-sm shadow-sm`} | ||
{...rest} | ||
className={`m-auto block select-none rounded-full hover:opacity-75 disabled:bg-gray-400 disabled:opacity-75 ${ | ||
rest.className || "" | ||
}`} | ||
> | ||
{text} | ||
<ButtonTitle title={title} bold={bold} /> | ||
<p className="font-iregular">{description}</p> | ||
</button> | ||
); | ||
} | ||
|
||
function ButtonTitle({ title, bold }: ButtonTitleProps) { | ||
const className = bold ? "font-ibold" : "font-iregular"; | ||
return <div className={className}>{title}</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
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,45 @@ | ||
import { forwardRef, useState } from "react"; | ||
|
||
import { InputBase, InputDefaultProps } from "@components/Input"; | ||
|
||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; | ||
import { faEye, faEyeSlash } from "@fortawesome/free-solid-svg-icons"; | ||
|
||
export default forwardRef<HTMLInputElement, InputDefaultProps>( | ||
function PasswordInput( | ||
{ text, id, name, type, fgColor, bgColor, enabled, ...rest }, | ||
ref | ||
) { | ||
const [isPasswordVisible, setIsPasswordVisible] = useState(false); | ||
|
||
const togglePasswordVisibility = () => { | ||
setIsPasswordVisible(!isPasswordVisible); | ||
}; | ||
|
||
return ( | ||
<InputBase | ||
text={text} | ||
id={id} | ||
fgColor={fgColor} | ||
bgColor={bgColor} | ||
enabled={enabled} | ||
> | ||
<input | ||
id={id} | ||
name={name} | ||
type={isPasswordVisible ? "text" : "password"} | ||
required | ||
className="w-full bg-transparent outline-none" | ||
disabled={enabled == false} | ||
ref={ref} | ||
{...rest} | ||
/> | ||
<FontAwesomeIcon | ||
className="mx-2 cursor-pointer" | ||
onClick={togglePasswordVisibility} | ||
icon={isPasswordVisible ? faEyeSlash : faEye} | ||
/> | ||
</InputBase> | ||
); | ||
} | ||
); |
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.