fix: styling of dropdown component (#6440)

* fix: styling of dropdown component

Signed-off-by: Udit Takkar <[email protected]>

* Apply suggestions from code review

* fix: use dropdown item in all pages

Signed-off-by: Udit Takkar <[email protected]>

* chore: undo

Signed-off-by: Udit Takkar <[email protected]>

Signed-off-by: Udit Takkar <[email protected]>
Co-authored-by: Peer Richelsen <[email protected]>
This commit is contained in:
Udit TakkarandPeer Richelsen authored and GitHub committed 2023-01-15 11:40:40 +00:00
1 parent 34a61214d3
commit 636e88d467
17 files changed
+189 -183

No files matched your search

+50 -67
View File
@@ -30,6 +30,7 @@ import {
Dropdown,
DropdownMenuContent,
DropdownMenuItem,
DropdownItem,
DropdownMenuPortal,
DropdownMenuSeparator,
DropdownMenuTrigger,
@@ -295,114 +296,96 @@ function UserDropdown({ small }: { small?: boolean }) {
) : (
<>
<DropdownMenuItem>
<button
<DropdownItem
type="button"
StartIcon={(props) => (
<Icon.FiMoon
className={classNames(
user.away
? "text-purple-500 group-hover:text-purple-700"
: "text-gray-500 group-hover:text-gray-700",
props.className
)}
aria-hidden="true"
/>
)}
onClick={() => {
mutation.mutate({ away: !user?.away });
utils.viewer.me.invalidate();
}}
className="flex w-full min-w-max cursor-pointer items-center px-4 py-2 text-sm ltr:flex-row rtl:flex-row-reverse">
<Icon.FiMoon
className={classNames(
user.away
? "text-purple-500 group-hover:text-purple-700"
: "text-gray-500 group-hover:text-gray-700",
"h-4 w-4 flex-shrink-0 ltr:mr-2 rtl:ml-2"
)}
aria-hidden="true"
/>
}}>
{user.away ? t("set_as_free") : t("set_as_away")}
</button>
</DropdownItem>
</DropdownMenuItem>
<DropdownMenuSeparator className="h-px bg-gray-200" />
<DropdownMenuSeparator />
{user.username && (
<>
<DropdownMenuItem>
<a
<DropdownItem
target="_blank"
rel="noopener noreferrer"
href={`${process.env.NEXT_PUBLIC_WEBSITE_URL}/${user.username}`}
className="flex items-center px-4 py-2 text-sm text-gray-700 ltr:flex-row rtl:flex-row-reverse">
<Icon.FiExternalLink className="h-4 w-4 text-gray-500 ltr:mr-2 rtl:ml-2" />{" "}
StartIcon={Icon.FiExternalLink}>
{t("view_public_page")}
</a>
</DropdownItem>
</DropdownMenuItem>
<DropdownMenuItem>
<a
href="#"
<DropdownItem
type="button"
StartIcon={Icon.FiLink}
onClick={(e) => {
e.preventDefault();
navigator.clipboard.writeText(
`${process.env.NEXT_PUBLIC_WEBSITE_URL}/${user.username}`
);
showToast(t("link_copied"), "success");
}}
className="flex items-center px-4 py-2 text-sm text-gray-700 ltr:flex-row rtl:flex-row-reverse">
<Icon.FiLink className="h-4 w-4 text-gray-500 ltr:mr-2 rtl:ml-2" />{" "}
}}>
{t("copy_public_page_link")}
</a>
</DropdownItem>
</DropdownMenuItem>
</>
)}
<DropdownMenuSeparator className="h-px bg-gray-200" />
<DropdownMenuSeparator />
<DropdownMenuItem>
<a
href={JOIN_SLACK}
<DropdownItem
StartIcon={(props) => <Icon.FiSlack strokeWidth={1.5} {...props} />}
target="_blank"
rel="noreferrer"
className="flex items-center px-4 py-2 text-sm text-gray-700 ltr:flex-row rtl:flex-row-reverse">
<Icon.FiSlack strokeWidth={1.5} className="h-4 w-4 text-gray-500 ltr:mr-2 rtl:ml-2" />{" "}
href={JOIN_SLACK}>
{t("join_our_slack")}
</a>
</DropdownItem>
</DropdownMenuItem>
<DropdownMenuItem>
<a
target="_blank"
rel="noopener noreferrer"
href={ROADMAP}
className="flex items-center px-4 py-2 text-sm text-gray-700 ltr:flex-row rtl:flex-row-reverse">
<Icon.FiMap className="h-4 w-4 text-gray-500 ltr:mr-2 rtl:ml-2" /> {t("visit_roadmap")}
</a>
<DropdownItem StartIcon={Icon.FiMap} target="_blank" href={ROADMAP}>
{t("visit_roadmap")}
</DropdownItem>
</DropdownMenuItem>
<DropdownMenuItem>
<button
onClick={() => setHelpOpen(true)}
className="flex w-full items-center px-4 py-2 text-sm text-gray-700 ltr:flex-row rtl:flex-row-reverse">
<Icon.FiHelpCircle
className={classNames(
"text-gray-500 group-hover:text-gray-500",
"h-4 w-4 flex-shrink-0 ltr:mr-2 rtl:ml-2"
)}
aria-hidden="true"
/>
<DropdownItem
type="button"
StartIcon={(props) => <Icon.FiHelpCircle aria-hidden="true" {...props} />}
onClick={() => setHelpOpen(true)}>
{t("help")}
</button>
</DropdownItem>
</DropdownMenuItem>
<DropdownMenuItem>
<a
<DropdownItem
StartIcon={Icon.FiDownload}
target="_blank"
rel="noopener noreferrer"
href={DESKTOP_APP_LINK}
className="desktop-hidden hidden items-center px-4 py-2 text-sm text-gray-700 ltr:flex-row rtl:flex-row-reverse lg:flex">
<Icon.FiDownload className="h-4 w-4 text-gray-500 ltr:mr-2 rtl:ml-2" />{" "}
rel="noreferrer"
className="desktop-hidden hidden lg:flex"
href={DESKTOP_APP_LINK}>
{t("download_desktop_app")}
</a>
</DropdownItem>
</DropdownMenuItem>
<DropdownMenuSeparator className="h-px bg-gray-200" />
<DropdownMenuSeparator />
<DropdownMenuItem>
<a
onClick={() => signOut({ callbackUrl: "/auth/logout" })}
className="flex cursor-pointer items-center px-4 py-2 text-sm hover:bg-gray-100 hover:text-gray-900 ltr:flex-row rtl:flex-row-reverse">
<Icon.FiLogOut
className={classNames(
"text-gray-500 group-hover:text-gray-700",
"h-4 w-4 flex-shrink-0 ltr:mr-2 rtl:ml-2"
)}
aria-hidden="true"
/>
<DropdownItem
type="button"
StartIcon={(props) => <Icon.FiLogOut aria-hidden="true" {...props} />}
onClick={() => signOut({ callbackUrl: "/auth/logout" })}>
{t("sign_out")}
</a>
</DropdownItem>
</DropdownMenuItem>
</>
)}