@@ -2,39 +2,58 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
22import { IconProp } from "@fortawesome/fontawesome-svg-core" ;
33
44type ButtonProps = {
5- text : string ;
6- onClick : ( ) => void ;
7- className ?: string ;
8- logo ?: IconProp ;
9- logoPosition ?: 'left' | 'right' ;
10- disabled ?: boolean ;
11- type ?: "button" | "submit" | "reset" ;
12- }
13-
5+ text : string ;
6+ onClick : ( ) => void ;
7+ className ?: string ;
8+ logo ?: IconProp ;
9+ logoPosition ?: "left" | "right" | "center" ;
10+ disabled ?: boolean ;
11+ type ?: "button" | "submit" | "reset" ;
12+ } ;
1413
1514// Button component where you can pass in text, onClick handler, optional className
1615// for styling, and an optional logo with its position.
1716//Styling is default, but can be overridden by passing in a className prop
18- export default function Button ( { text, onClick, className, logo, logoPosition, disabled, type } : ButtonProps ) {
17+ export default function Button ( {
18+ text,
19+ onClick,
20+ className,
21+ logo,
22+ logoPosition,
23+ disabled,
24+ type,
25+ } : ButtonProps ) {
1926 return (
20- < button onClick = { onClick } disabled = { disabled || false } type = { type || "button" }
21- className = { `
22- px-4 py-2 rounded-3xl font-medium text-black border-2 active:bg-primary-900 active:border-primary-900 active:text-white
23- h-fit flex items-center justify-center transition-opacity
24- ${ className } ${ disabled
25- ? "cursor-not-allowed opacity-50"
26- : "hover:opacity-90" }
27+ < button
28+ onClick = { onClick }
29+ disabled = { disabled || false }
30+ type = { type || "button" }
31+ className = { `
32+ px-4 py-2 rounded-3xl font-medium text-black border-2
33+ active:bg-primary-900 active:border-primary-900 active:text-white
34+ h-fit flex-grow-0 items-center justify-center
35+ transition-opacity flex whitespace-nowrap
36+ ${ className } ${
37+ disabled ? "cursor-not-allowed opacity-50" : "hover:opacity-90"
38+ }
2739 ` }
2840 >
29- { logo && logoPosition === 'left' &&
30- < span className = "mr-2" >
31- < FontAwesomeIcon icon = { logo } className = "text-lg w-4 h-4" />
32- </ span > }
41+ { logo && logoPosition === "left" && (
42+ < span className = "mr-2" >
43+ < FontAwesomeIcon icon = { logo } className = "" />
44+ </ span >
45+ ) }
3346 { text }
34- { logo && logoPosition === 'right' &&
35- < span className = "ml-2" >
36- < FontAwesomeIcon icon = { logo } className = "text-lg w-4 h-4" />
37- </ span > }
47+ { logo && logoPosition === "right" && (
48+ < span className = "ml-2" >
49+ < FontAwesomeIcon icon = { logo } className = "" />
50+ </ span >
51+ ) }
52+ { logo && logoPosition === "center" && (
53+ < span className = "" >
54+ < FontAwesomeIcon icon = { logo } className = "" />
55+ </ span >
56+ ) }
3857 </ button >
3958 ) ;
40- }
59+ }
0 commit comments