Compare commits
2 Commits
fb38ac69df
...
6ec834ddc5
Author | SHA1 | Date | |
---|---|---|---|
6ec834ddc5 | |||
e40c78e9b9 |
@ -3,38 +3,38 @@ import { Tooltip, TooltipContent, TooltipTrigger } from "./ui/Tooltip";
|
|||||||
|
|
||||||
interface ButtonProps {
|
interface ButtonProps {
|
||||||
text?: JSX.Element | string;
|
text?: JSX.Element | string;
|
||||||
url?: string;
|
|
||||||
icon?: JSX.Element;
|
icon?: JSX.Element;
|
||||||
color?: string;
|
color?: string;
|
||||||
tooltip?: React.ReactNode;
|
tooltip?: React.ReactNode;
|
||||||
className?: string;
|
className?: string;
|
||||||
|
ariaLabel?: string;
|
||||||
onClick?: () => void;
|
onClick?: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function Button({
|
export default function Button({
|
||||||
text,
|
text,
|
||||||
url,
|
|
||||||
icon,
|
icon,
|
||||||
color,
|
color,
|
||||||
tooltip,
|
tooltip,
|
||||||
className,
|
className,
|
||||||
|
ariaLabel = "Default button label",
|
||||||
onClick,
|
onClick,
|
||||||
}: ButtonProps) {
|
}: ButtonProps) {
|
||||||
if (!color) color = "bg-blue-500";
|
if (!color) color = "bg-blue-500";
|
||||||
|
|
||||||
const base = (
|
const base = (
|
||||||
<a href={url} onClick={onClick}>
|
<button
|
||||||
<p
|
|
||||||
className={clsx(
|
className={clsx(
|
||||||
"font-md flex w-fit transform-gpu flex-row items-center gap-1 rounded-md p-1 transition-all hover:opacity-80",
|
"flex items-center justify-center gap-2 rounded-md px-4 py-2",
|
||||||
className,
|
|
||||||
color,
|
color,
|
||||||
|
className,
|
||||||
)}
|
)}
|
||||||
|
onClick={onClick}
|
||||||
|
aria-label={ariaLabel}
|
||||||
>
|
>
|
||||||
{icon}
|
{icon}
|
||||||
{text}
|
{text}
|
||||||
</p>
|
</button>
|
||||||
</a>
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (tooltip) {
|
if (tooltip) {
|
||||||
|
@ -136,6 +136,7 @@ export default function PlayerInfo({ playerData }: PlayerInfoProps) {
|
|||||||
onClick={claimProfile}
|
onClick={claimProfile}
|
||||||
tooltip={<p>Set as your Profile</p>}
|
tooltip={<p>Set as your Profile</p>}
|
||||||
icon={<HomeIcon width={24} height={24} />}
|
icon={<HomeIcon width={24} height={24} />}
|
||||||
|
ariaLabel="Set as your Profile"
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
@ -147,6 +148,7 @@ export default function PlayerInfo({ playerData }: PlayerInfoProps) {
|
|||||||
tooltip={<p>Add as Friend</p>}
|
tooltip={<p>Add as Friend</p>}
|
||||||
icon={<UserIcon width={24} height={24} />}
|
icon={<UserIcon width={24} height={24} />}
|
||||||
color="bg-green-500"
|
color="bg-green-500"
|
||||||
|
ariaLabel="Add Friend"
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
@ -156,6 +158,7 @@ export default function PlayerInfo({ playerData }: PlayerInfoProps) {
|
|||||||
tooltip={<p>Remove Friend</p>}
|
tooltip={<p>Remove Friend</p>}
|
||||||
icon={<XMarkIcon width={24} height={24} />}
|
icon={<XMarkIcon width={24} height={24} />}
|
||||||
color="bg-red-500"
|
color="bg-red-500"
|
||||||
|
ariaLabel="Remove Friend"
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
|
Reference in New Issue
Block a user