Skip to content

Commit fc5bfd5

Browse files
committed
Add extenral link icon to dropdown
1 parent e3983ef commit fc5bfd5

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

apps/client/src/components/Dropdown/DropdownItem.tsx

+14-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import classNames from 'classnames';
22
import React from 'react';
33
import { IconType } from 'react-icons';
4+
import { BsBoxArrowUpRight } from 'react-icons/bs';
45

56
type ButtonProps = React.DetailedHTMLProps<
67
React.ButtonHTMLAttributes<HTMLButtonElement>,
@@ -9,22 +10,33 @@ type ButtonProps = React.DetailedHTMLProps<
910

1011
export interface DropdownItemProps extends ButtonProps {
1112
icon?: IconType;
13+
externalLink?: boolean;
1214
children: string;
1315
}
1416

15-
function DropdownItem({ children, icon, className, ...props }: DropdownItemProps) {
17+
function DropdownItem({
18+
children,
19+
icon,
20+
className,
21+
externalLink = false,
22+
...props
23+
}: DropdownItemProps) {
1624
const iconElement = icon ? React.createElement(icon) : null;
1725

1826
return (
1927
<button
2028
className={classNames(
2129
'flex w-full items-center gap-3 px-4 py-2.5 text-gray-700 hover:bg-gray-150',
30+
'justify-center',
2231
className,
2332
)}
2433
{...props}
2534
>
2635
{iconElement}
27-
<span>{children}</span>
36+
<div className="flex flex-1 items-center justify-between">
37+
<span>{children}</span>
38+
{externalLink && <BsBoxArrowUpRight />}
39+
</div>
2840
</button>
2941
);
3042
}

apps/client/src/components/UserInfo.tsx

+6-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,12 @@ function UserInfo() {
3232
to="https://github.com/MrBartusek/stocked-up/issues"
3333
target="_blank"
3434
>
35-
<DropdownItem icon={BsExclamationOctagon}>Report issue</DropdownItem>
35+
<DropdownItem
36+
icon={BsExclamationOctagon}
37+
externalLink
38+
>
39+
Report issue
40+
</DropdownItem>
3641
</Link>
3742
<DropdownItem
3843
icon={BsBoxArrowLeft}

0 commit comments

Comments
 (0)