-
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.
- Loading branch information
Showing
30 changed files
with
513 additions
and
249 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 |
---|---|---|
@@ -1,27 +1,45 @@ | ||
import { ButtonHTMLAttributes } from "react"; | ||
import { ButtonHTMLAttributes, ReactNode } from "react"; | ||
|
||
interface Props extends ButtonHTMLAttributes<HTMLButtonElement> { | ||
text: string; | ||
interface Props extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "title"> { | ||
title: ReactNode; | ||
description?: string; | ||
customStyle?: string; | ||
bold?: boolean; | ||
disabled?: boolean; | ||
} | ||
|
||
interface ButtonTitleProps { | ||
title: ReactNode; | ||
bold?: boolean; | ||
} | ||
|
||
export default function Button({ | ||
text, | ||
title, | ||
description, | ||
type, | ||
disabled, | ||
onClick, | ||
customStyle, | ||
bold, | ||
...rest | ||
}: Props) { | ||
return ( | ||
<button | ||
{...rest} | ||
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`} | ||
} m-auto block rounded-full hover:opacity-75 disabled:bg-gray-400 disabled:opacity-75`} | ||
> | ||
{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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import { SelectHTMLAttributes } from "react"; | ||
|
||
import { ChevronDownIcon } from "@heroicons/react/solid"; | ||
|
||
interface Option { | ||
key: any; | ||
name: string; | ||
} | ||
|
||
interface Props extends SelectHTMLAttributes<HTMLSelectElement> { | ||
text: string; | ||
options: Option[]; | ||
customStyle?: string; | ||
fgColor: string; | ||
bgColor: string; | ||
enabled?: boolean; | ||
} | ||
|
||
export default function Select({ | ||
id, | ||
text, | ||
options, | ||
enabled, | ||
fgColor, | ||
bgColor, | ||
customStyle, | ||
...rest | ||
}: Props) { | ||
let textColor = `text-${fgColor}`; | ||
let backColor = `bg-${bgColor}`; | ||
let disabled = enabled == false; | ||
|
||
return ( | ||
<div> | ||
<label | ||
htmlFor={id} | ||
className={`pl-6 font-iregular text-${fgColor} mt-5 block text-sm`} | ||
> | ||
{text} | ||
</label> | ||
<div | ||
className={`text-iregular relative mt-2 flex ${textColor} ${backColor} block w-full appearance-none rounded-full border border-gray-300 py-2 placeholder-gray-400 shadow-sm focus:outline-none sm:text-sm`} | ||
> | ||
<select | ||
id={id} | ||
disabled={disabled} | ||
className={`text-iregular ${ | ||
disabled ? "text-gray-500" : textColor | ||
} ${backColor} block w-full appearance-none rounded-full px-3 pr-10 pl-6 placeholder-gray-400 opacity-100 focus:outline-none sm:text-sm`} | ||
{...rest} | ||
> | ||
{options.map((option) => ( | ||
<option key={option.key} value={option.key}>{option.name}</option> | ||
))} | ||
</select> | ||
<ChevronDownIcon | ||
className={`${ | ||
!disabled ? "block" : "hidden" | ||
} pointer-events-none absolute top-0 bottom-0 right-3 m-auto h-7 text-${fgColor}`} | ||
aria-hidden="true" | ||
/> | ||
</div> | ||
</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
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.