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:
1 parent
34a61214d3
commit
636e88d467
17 files changed
+189
-183
No files matched your search
@@ -165,21 +165,20 @@ export default function MemberListItem(props: Props) {
|
||||
type="button"
|
||||
onClick={() => setShowChangeMemberRoleModal(true)}
|
||||
StartIcon={Icon.FiEdit2}>
|
||||
{t("edit") as string}
|
||||
{t("edit")}
|
||||
</DropdownItem>
|
||||
</DropdownMenuItem>
|
||||
{impersonationMode && (
|
||||
<>
|
||||
<DropdownMenuItem>
|
||||
<Button
|
||||
<DropdownItem
|
||||
type="button"
|
||||
onClick={() => setShowImpersonateModal(true)}
|
||||
color="minimal"
|
||||
StartIcon={Icon.FiLock}
|
||||
className="w-full flex-shrink-0 font-normal">
|
||||
StartIcon={Icon.FiLock}>
|
||||
{t("impersonate")}
|
||||
</Button>
|
||||
</DropdownItem>
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuSeparator className="h-px bg-gray-200" />
|
||||
<DropdownMenuSeparator />
|
||||
</>
|
||||
)}
|
||||
<DropdownMenuItem>
|
||||
|
||||
@@ -10,6 +10,7 @@ import {
|
||||
Dropdown,
|
||||
DropdownMenuContent,
|
||||
DropdownMenuItem,
|
||||
DropdownItem,
|
||||
DropdownMenuTrigger,
|
||||
Icon,
|
||||
} from "@calcom/ui";
|
||||
@@ -110,22 +111,18 @@ export default function TeamInviteListItem(props: Props) {
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent>
|
||||
<DropdownMenuItem>
|
||||
<Button
|
||||
color="destructive"
|
||||
className="w-full rounded-none font-medium"
|
||||
StartIcon={Icon.FiCheck}
|
||||
onClick={acceptInvite}>
|
||||
<DropdownItem type="button" StartIcon={Icon.FiCheck} onClick={acceptInvite}>
|
||||
{t("accept")}
|
||||
</Button>
|
||||
</DropdownItem>
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem>
|
||||
<Button
|
||||
<DropdownItem
|
||||
color="destructive"
|
||||
className="w-full rounded-none font-medium"
|
||||
type="button"
|
||||
StartIcon={Icon.FiX}
|
||||
onClick={declineInvite}>
|
||||
{t("reject")}
|
||||
</Button>
|
||||
</DropdownItem>
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</Dropdown>
|
||||
|
||||
@@ -119,22 +119,18 @@ export default function TeamListItem(props: Props) {
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent>
|
||||
<DropdownMenuItem>
|
||||
<Button
|
||||
color="minimal"
|
||||
className="w-full rounded-none font-medium"
|
||||
StartIcon={Icon.FiCheck}
|
||||
onClick={acceptInvite}>
|
||||
<DropdownItem type="button" StartIcon={Icon.FiCheck} onClick={acceptInvite}>
|
||||
{t("accept")}
|
||||
</Button>
|
||||
</DropdownItem>
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem>
|
||||
<Button
|
||||
<DropdownItem
|
||||
color="destructive"
|
||||
className="w-full rounded-none font-medium"
|
||||
type="button"
|
||||
StartIcon={Icon.FiX}
|
||||
onClick={declineInvite}>
|
||||
{t("reject")}
|
||||
</Button>
|
||||
</DropdownItem>
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</Dropdown>
|
||||
@@ -186,20 +182,20 @@ export default function TeamListItem(props: Props) {
|
||||
</DropdownItem>
|
||||
</DropdownMenuItem>
|
||||
)}
|
||||
<DropdownMenuSeparator className="h-px bg-gray-200" />
|
||||
<DropdownMenuSeparator />
|
||||
{isOwner && (
|
||||
<DropdownMenuItem>
|
||||
<Dialog open={hideDropdown} onOpenChange={setHideDropdown}>
|
||||
<DialogTrigger asChild>
|
||||
<Button
|
||||
<DropdownItem
|
||||
color="destructive"
|
||||
type="button"
|
||||
StartIcon={Icon.FiTrash}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
}}
|
||||
color="destructive"
|
||||
className="rounded-none px-3 font-normal"
|
||||
StartIcon={Icon.FiTrash}>
|
||||
}}>
|
||||
{t("disband_team")}
|
||||
</Button>
|
||||
</DropdownItem>
|
||||
</DialogTrigger>
|
||||
<ConfirmationDialogContent
|
||||
variety="danger"
|
||||
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
Dropdown,
|
||||
DropdownMenuContent,
|
||||
DropdownMenuItem,
|
||||
DropdownItem,
|
||||
DropdownMenuTrigger,
|
||||
Icon,
|
||||
TextField,
|
||||
@@ -54,7 +55,7 @@ export const TimeTimeUnitInput = (props: Props) => {
|
||||
<DropdownMenuContent>
|
||||
{timeUnitOptions.map((option, index) => (
|
||||
<DropdownMenuItem key={index} className="outline-none">
|
||||
<button
|
||||
{/* <button
|
||||
key={index}
|
||||
type="button"
|
||||
className="h-8 w-20 justify-start pl-3 text-left text-sm"
|
||||
@@ -63,7 +64,16 @@ export const TimeTimeUnitInput = (props: Props) => {
|
||||
form.setValue("timeUnit", option.value);
|
||||
}}>
|
||||
{option.label}
|
||||
</button>
|
||||
</button> */}
|
||||
<DropdownItem
|
||||
key={index}
|
||||
type="button"
|
||||
onClick={() => {
|
||||
setTimeUnit(option.value);
|
||||
form.setValue("timeUnit", option.value);
|
||||
}}>
|
||||
{option.label}
|
||||
</DropdownItem>
|
||||
</DropdownMenuItem>
|
||||
))}
|
||||
</DropdownMenuContent>
|
||||
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
Dropdown,
|
||||
DropdownMenuContent,
|
||||
DropdownMenuItem,
|
||||
DropdownItem,
|
||||
DropdownMenuTrigger,
|
||||
Icon,
|
||||
showToast,
|
||||
@@ -172,24 +173,24 @@ export default function WorkflowListPage({ workflows }: Props) {
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent>
|
||||
<DropdownMenuItem>
|
||||
<Button
|
||||
<DropdownItem
|
||||
type="button"
|
||||
color="minimal"
|
||||
StartIcon={Icon.FiEdit2}
|
||||
onClick={async () => await router.replace("/workflows/" + workflow.id)}>
|
||||
{t("edit")}
|
||||
</Button>
|
||||
</DropdownItem>
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem>
|
||||
<Button
|
||||
<DropdownItem
|
||||
type="button"
|
||||
color="destructive"
|
||||
StartIcon={Icon.FiTrash2}
|
||||
onClick={() => {
|
||||
setDeleteDialogOpen(true);
|
||||
setwWorkflowToDeleteId(workflow.id);
|
||||
}}
|
||||
color="minimal"
|
||||
StartIcon={Icon.FiTrash2}>
|
||||
}}>
|
||||
{t("delete")}
|
||||
</Button>
|
||||
</DropdownItem>
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</Dropdown>
|
||||
|
||||
@@ -25,6 +25,7 @@ import {
|
||||
Dropdown,
|
||||
DropdownMenuContent,
|
||||
DropdownMenuItem,
|
||||
DropdownItem,
|
||||
DropdownMenuTrigger,
|
||||
EmailField,
|
||||
Icon,
|
||||
@@ -298,7 +299,10 @@ export default function WorkflowStepContainer(props: WorkflowStepProps) {
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent>
|
||||
<DropdownMenuItem>
|
||||
<Button
|
||||
<DropdownItem
|
||||
type="button"
|
||||
StartIcon={Icon.FiTrash2}
|
||||
color="destructive"
|
||||
onClick={() => {
|
||||
const steps = form.getValues("steps");
|
||||
const updatedSteps = steps
|
||||
@@ -314,13 +318,9 @@ export default function WorkflowStepContainer(props: WorkflowStepProps) {
|
||||
if (setReload) {
|
||||
setReload(!reload);
|
||||
}
|
||||
}}
|
||||
color="secondary"
|
||||
size="base"
|
||||
StartIcon={Icon.FiTrash2}
|
||||
className="w-full rounded-none">
|
||||
}}>
|
||||
{t("delete")}
|
||||
</Button>
|
||||
</DropdownItem>
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</Dropdown>
|
||||
|
||||
@@ -24,6 +24,7 @@ import {
|
||||
Dropdown,
|
||||
DropdownMenuContent,
|
||||
DropdownMenuItem,
|
||||
DropdownItem,
|
||||
DropdownMenuLabel,
|
||||
DropdownMenuSeparator,
|
||||
DropdownMenuTrigger,
|
||||
@@ -304,19 +305,22 @@ export default function CreateEventTypeButton(props: CreateEventTypeBtnProps) {
|
||||
<DropdownMenuLabel>
|
||||
<div className="max-w-48">{t("new_event_subtitle")}</div>
|
||||
</DropdownMenuLabel>
|
||||
<DropdownMenuSeparator className="h-px bg-gray-200" />
|
||||
<DropdownMenuSeparator />
|
||||
{props.options.map((option) => (
|
||||
<DropdownMenuItem
|
||||
key={option.slug}
|
||||
className="flex cursor-pointer items-center px-3 py-2 hover:bg-neutral-100 focus:outline-none"
|
||||
onSelect={() => openModal(option)}>
|
||||
<Avatar
|
||||
alt={option.name || ""}
|
||||
imageSrc={option.image || `${WEBAPP_URL}/${option.slug}/avatar.png`} // if no image, use default avatar
|
||||
size="sm"
|
||||
className="inline ltr:mr-4 rtl:ml-4"
|
||||
/>
|
||||
<span className="px-4">{option.name ? option.name : option.slug}</span>
|
||||
<DropdownMenuItem key={option.slug}>
|
||||
<DropdownItem
|
||||
type="button"
|
||||
StartIcon={(props: any) => (
|
||||
<Avatar
|
||||
alt={option.name || ""}
|
||||
imageSrc={option.image || `${WEBAPP_URL}/${option.slug}/avatar.png`} // if no image, use default avatar
|
||||
size="sm"
|
||||
{...props}
|
||||
/>
|
||||
)}
|
||||
onClick={() => openModal(option)}>
|
||||
<span>{option.name ? option.name : option.slug}</span>
|
||||
</DropdownItem>
|
||||
</DropdownMenuItem>
|
||||
))}
|
||||
</DropdownMenuContent>
|
||||
@@ -359,7 +363,7 @@ export function CreateEventTypeTrigger(props: CreateEventTypeTrigger) {
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="end">
|
||||
<DropdownMenuLabel>{t("new_event_subtitle")}</DropdownMenuLabel>
|
||||
<DropdownMenuSeparator className="h-px bg-gray-200" />
|
||||
<DropdownMenuSeparator />
|
||||
{props.options.map((option) => (
|
||||
<CreateEventTeamsItem
|
||||
key={option.slug}
|
||||
|
||||
@@ -2,18 +2,16 @@ import Link from "next/link";
|
||||
import { Fragment } from "react";
|
||||
|
||||
import { availabilityAsString } from "@calcom/lib/availability";
|
||||
import classNames from "@calcom/lib/classNames";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { Availability } from "@calcom/prisma/client";
|
||||
import { RouterOutputs } from "@calcom/trpc/react";
|
||||
import { trpc } from "@calcom/trpc/react";
|
||||
import { Schedule } from "@calcom/types/schedule";
|
||||
import {
|
||||
Badge,
|
||||
Button,
|
||||
Dropdown,
|
||||
DropdownMenuContent,
|
||||
DropdownMenuItem,
|
||||
DropdownItem,
|
||||
DropdownMenuTrigger,
|
||||
Icon,
|
||||
} from "@calcom/ui";
|
||||
@@ -81,11 +79,8 @@ export function ScheduleListItem({
|
||||
<DropdownMenuContent>
|
||||
<DropdownMenuItem className="min-w-40 focus:ring-gray-100">
|
||||
{!schedule.isDefault && (
|
||||
<Button
|
||||
<DropdownItem
|
||||
type="button"
|
||||
color="minimal"
|
||||
className="w-full rounded-b-none border-none font-normal"
|
||||
disabled={schedule.isDefault}
|
||||
onClick={() => {
|
||||
updateDefault({
|
||||
scheduleId: schedule.id,
|
||||
@@ -93,24 +88,20 @@ export function ScheduleListItem({
|
||||
});
|
||||
}}>
|
||||
{t("set_as_default")}
|
||||
</Button>
|
||||
</DropdownItem>
|
||||
)}
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem className="min-w-40 focus:ring-gray-100">
|
||||
<Button
|
||||
<DropdownItem
|
||||
type="button"
|
||||
color="destructive"
|
||||
onClick={() => {
|
||||
deleteFunction({
|
||||
scheduleId: schedule.id,
|
||||
});
|
||||
}}
|
||||
type="button"
|
||||
color="destructive"
|
||||
className={classNames(
|
||||
"w-full border-none font-normal",
|
||||
!schedule.isDefault && "rounded-t-none"
|
||||
)}>
|
||||
}}>
|
||||
{t("delete")}
|
||||
</Button>
|
||||
</DropdownItem>
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
)}
|
||||
|
||||
@@ -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>
|
||||
</>
|
||||
)}
|
||||
|
||||
Reference in new issue
Block a user