feat: Add transition to hover background in multiple components (#16216)

* chore: Add transition to hover background in multiple components

* chore: Add transition to hover background in multiple components
This commit is contained in:
Hichem Fantar authored and GitHub committed 2024-08-20 07:23:09 +00:00
1 parent 4ff2ce90f9
commit 50c4578c2e
39 files changed
+63 -57

No files matched your search

@@ -69,7 +69,7 @@ function UserToInviteItem({
key={member.userId}
onClick={() => onChange()} // We handle this on click on the div also - for a11y we handle it with label and checkbox below
className={classNames(
"flex cursor-pointer items-center rounded-md px-2 py-1",
"flex cursor-pointer items-center rounded-md px-2 py-1 transition",
isSelected ? "bg-emphasis" : "hover:bg-subtle "
)}>
<div className="flex items-center space-x-2 rtl:space-x-reverse">
@@ -62,7 +62,7 @@ export default function OtherTeamListItem(props: Props) {
return (
<li>
<div className="hover:bg-muted group flex items-center justify-between">
<div className="hover:bg-muted group flex items-center justify-between transition">
{teamInfo}
<div className="px-5 py-5">
<div className="flex space-x-2 rtl:space-x-reverse">
@@ -32,7 +32,7 @@ export default function ContactMenuItem(props: ContactMenuItem) {
<a
href={JOIN_COMMUNITY}
target="_blank"
className="hover:bg-subtle hover:text-emphasis text-default flex w-full px-5 py-2 pr-4 text-sm font-medium">
className="hover:bg-subtle hover:text-emphasis text-default flex w-full px-5 py-2 pr-4 text-sm font-medium transition">
{t("community_support")}{" "}
<Icon
name="external-link"
@@ -61,7 +61,7 @@ export default function HelpMenuItem({ onHelpItemSelect }: HelpMenuItemProps) {
onClick={() => onHelpItemSelect()}
href="https://cal.com/docs/"
target="_blank"
className="hover:bg-subtle hover:text-emphasis text-default flex w-full px-5 py-2 pr-4 text-sm font-medium"
className="hover:bg-subtle hover:text-emphasis text-default flex w-full px-5 py-2 pr-4 text-sm font-medium transition"
rel="noreferrer">
{t("documentation")}
<Icon
@@ -22,7 +22,7 @@ export default function FreshChatMenuItem(props: FreshChatMenuItemProps) {
setActive(true);
onHelpItemSelect();
}}
className="hover:bg-subtle hover:text-emphasis text-default flex w-full px-5 py-2 pr-4 text-sm font-medium">
className="hover:bg-subtle hover:text-emphasis text-default flex w-full px-5 py-2 pr-4 text-sm font-medium transition">
{t("contact_support")}
</button>
</>
@@ -27,7 +27,7 @@ export default function HelpscoutMenuItem(props: HelpscoutMenuItemProps) {
<>
<button
onClick={handleClick}
className="hover:bg-subtle hover:text-emphasis text-default flex w-full px-5 py-2 pr-4 text-sm font-medium">
className="hover:bg-subtle hover:text-emphasis text-default flex w-full px-5 py-2 pr-4 text-sm font-medium transition">
{t("contact_support")}
</button>
@@ -24,7 +24,7 @@ export default function ZendeskMenuItem(props: ZendeskMenuItemProps) {
setActive(true);
onHelpItemSelect();
}}
className="hover:bg-subtle hover:text-emphasis text-default flex w-full px-5 py-2 pr-4 text-sm font-medium">
className="hover:bg-subtle hover:text-emphasis text-default flex w-full px-5 py-2 pr-4 text-sm font-medium transition">
{t("contact_support")}
</button>
{active && (
@@ -116,7 +116,7 @@ export default function WorkflowListPage({ workflows }: Props) {
{!(lastItem && lastItem.id === workflow.id) && (
<ArrowButton onClick={() => moveWorkflow(index, 1)} arrowDirection="down" />
)}
<div className="first-line:group hover:bg-muted flex w-full items-center justify-between p-4 sm:px-6">
<div className="first-line:group hover:bg-muted flex w-full items-center justify-between p-4 transition sm:px-6">
<Link href={`/workflows/${workflow.id}`} className="flex-grow cursor-pointer">
<div className="rtl:space-x-reverse">
<div className="flex">
@@ -136,7 +136,7 @@ const Filter = (props: {
return (
<div className={classNames("-mb-2", noFilter ? "w-16" : "w-[100px]")}>
<AnimatedPopover text={noFilter ? "All" : "Filtered"}>
<div className="item-center focus-within:bg-subtle hover:bg-muted flex px-4 py-[6px] hover:cursor-pointer">
<div className="item-center focus-within:bg-subtle hover:bg-muted flex px-4 py-[6px] transition hover:cursor-pointer">
<Avatar
imageSrc={userAvatar || ""}
size="sm"
@@ -171,7 +171,7 @@ const Filter = (props: {
</div>
{teams.map((profile) => (
<div
className="item-center focus-within:bg-subtle hover:bg-muted flex px-4 py-[6px] hover:cursor-pointer"
className="item-center focus-within:bg-subtle hover:bg-muted flex px-4 py-[6px] transition hover:cursor-pointer"
key={`${profile.teamId || 0}`}>
<Avatar
imageSrc={profile.image || ""}
+1 -1
View File
@@ -114,7 +114,7 @@ const ChooseEmbedTypesDialogContent = ({ types }: { types: EmbedTypes }) => {
<div className="items-start space-y-2 md:flex md:space-y-0">
{types.map((embed, index) => (
<button
className="hover:bg-subtle bg-muted w-full self-stretch rounded-md border border-transparent p-6 text-left hover:rounded-md ltr:mr-4 ltr:last:mr-0 rtl:ml-4 rtl:last:ml-0 lg:w-1/3"
className="hover:bg-subtle bg-muted w-full self-stretch rounded-md border border-transparent p-6 text-left transition hover:rounded-md ltr:mr-4 ltr:last:mr-0 rtl:ml-4 rtl:last:ml-0 lg:w-1/3"
key={index}
data-testid={embed.type}
onClick={() => {
@@ -143,7 +143,7 @@ type Props = InputHTMLAttributes<HTMLInputElement> & {
export const FilterCheckboxField = forwardRef<HTMLInputElement, Props>(({ label, icon, ...rest }, ref) => {
return (
<div className="hover:bg-muted flex items-center py-2 pl-3 pr-2.5 hover:cursor-pointer">
<div className="hover:bg-muted flex items-center py-2 pl-3 pr-2.5 transition hover:cursor-pointer">
<label className="flex w-full max-w-full items-center justify-between hover:cursor-pointer">
<div className="flex items-center truncate">
{icon && (
@@ -443,7 +443,7 @@ export const Components: Record<FieldType, Component> = {
type="radio"
disabled={readOnly}
name={name}
className="bg-default after:bg-default border-emphasis focus:ring-brand-default hover:bg-subtle hover:after:bg-subtle dark:checked:after:bg-brand-accent flex h-4 w-4 cursor-pointer items-center justify-center text-[--cal-brand] after:h-[6px] after:w-[6px] after:rounded-full after:content-[''] after:hover:block focus:ring-2 focus:ring-offset-0 ltr:mr-2 rtl:ml-2 dark:checked:hover:text-[--cal-brand]"
className="bg-default after:bg-default border-emphasis focus:ring-brand-default hover:bg-subtle hover:after:bg-subtle dark:checked:after:bg-brand-accent flex h-4 w-4 cursor-pointer items-center justify-center text-[--cal-brand] transition after:h-[6px] after:w-[6px] after:rounded-full after:content-[''] after:hover:block focus:ring-2 focus:ring-offset-0 ltr:mr-2 rtl:ml-2 dark:checked:hover:text-[--cal-brand]"
value={option.value}
onChange={(e) => {
setValue({
@@ -180,7 +180,7 @@ export const FormBuilder = function FormBuilder({
<li
key={field.name}
data-testid={`field-${field.name}`}
className="hover:bg-muted group relative flex items-center justify-between p-4 ">
className="hover:bg-muted group relative flex items-center justify-between p-4 transition">
{!disabled && (
<>
{index >= 1 && (
@@ -238,7 +238,7 @@ export const FormBuilder = function FormBuilder({
onCheckedChange={(checked) => {
update(index, { ...field, hidden: !checked });
}}
classNames={{ container: "p-2 hover:bg-subtle rounded" }}
classNames={{ container: "p-2 hover:bg-subtle rounded transition" }}
tooltip={t("show_on_booking_page")}
/>
)}
@@ -714,7 +714,7 @@ function VariantFields({
onCheckedChange={(checked) => {
fieldForm.setValue("variant", checked ? otherVariant : defaultVariant);
}}
classNames={{ container: "p-2 mt-2 sm:hover:bg-muted rounded" }}
classNames={{ container: "p-2 mt-2 sm:hover:bg-muted rounded transition" }}
tooltip={t("Toggle Variant")}
/>
) : (
@@ -48,7 +48,9 @@ export const EventTypeList = memo(() => {
<AnimatedPopover text={getPopoverText()}>
<FilterCheckboxFieldsContainer>
{filterOptions?.map((eventType) => (
<div key={eventType.value} className="item-center hover:bg-muted flex cursor-pointer px-4 py-2">
<div
key={eventType.value}
className="item-center hover:bg-muted flex cursor-pointer px-4 py-2 transition">
<CheckboxField
checked={eventTypeValue?.value === eventType.value}
onChange={(e) => {
+1 -1
View File
@@ -301,7 +301,7 @@ const DisplayShortcuts = (item: shortcutArrayType) => {
return (
<kbd
key={shortcut}
className="bg-default hover:bg-subtle text-emphasis rounded-sm border px-2 py-1">
className="bg-default hover:bg-subtle text-emphasis rounded-sm border px-2 py-1 transition">
{shortcut}
</kbd>
);
@@ -284,7 +284,7 @@ const TeamListCollapsible = () => {
}>
<CollapsibleTrigger asChild>
<div
className="hover:bg-subtle [&[aria-current='page']]:bg-emphasis [&[aria-current='page']]:text-emphasis text-default flex h-9 w-full flex-row items-center rounded-md px-2 py-[10px] text-left text-sm font-medium leading-none"
className="hover:bg-subtle [&[aria-current='page']]:bg-emphasis [&[aria-current='page']]:text-emphasis text-default flex h-9 w-full flex-row items-center rounded-md px-2 py-[10px] text-left text-sm font-medium leading-none transition"
onClick={() =>
setTeamMenuState([
...teamMenuState,
@@ -485,7 +485,7 @@ const SettingsSidebarContainer = ({
<React.Fragment key={tab.href}>
<div data-testid="tab-teams" className={`${!tab.children?.length ? "mb-3" : ""}`}>
<Link href={tab.href}>
<div className="hover:bg-subtle [&[aria-current='page']]:bg-emphasis [&[aria-current='page']]:text-emphasis group-hover:text-default text-default group flex h-9 w-full flex-row items-center rounded-md px-2 py-[10px] text-sm font-medium leading-none">
<div className="hover:bg-subtle [&[aria-current='page']]:bg-emphasis [&[aria-current='page']]:text-emphasis group-hover:text-default text-default group flex h-9 w-full flex-row items-center rounded-md px-2 py-[10px] text-sm font-medium leading-none transition">
{tab && tab.icon && (
<Icon
name={tab.icon}
@@ -519,7 +519,7 @@ const SettingsSidebarContainer = ({
<React.Fragment key={tab.href}>
<div className={`${!tab.children?.length ? "mb-3" : ""}`}>
<Link href={tab.href}>
<div className="hover:bg-subtle [&[aria-current='page']]:bg-emphasis [&[aria-current='page']]:text-emphasis group-hover:text-default text-default group flex h-9 w-full flex-row items-center rounded-md px-2 py-[10px] text-sm font-medium leading-none">
<div className="hover:bg-subtle [&[aria-current='page']]:bg-emphasis [&[aria-current='page']]:text-emphasis group-hover:text-default text-default group flex h-9 w-full flex-row items-center rounded-md px-2 py-[10px] text-sm font-medium leading-none transition">
{tab && tab.icon && (
<Icon
name={tab.icon}
@@ -558,7 +558,7 @@ const SettingsSidebarContainer = ({
}>
<CollapsibleTrigger asChild>
<div
className="hover:bg-subtle [&[aria-current='page']]:bg-emphasis [&[aria-current='page']]:text-emphasis text-default flex h-9 w-full flex-row items-center rounded-md px-2 py-[10px] text-left text-sm font-medium leading-none"
className="hover:bg-subtle [&[aria-current='page']]:bg-emphasis [&[aria-current='page']]:text-emphasis text-default flex h-9 w-full flex-row items-center rounded-md px-2 py-[10px] text-left text-sm font-medium leading-none transition"
onClick={() =>
setOtherTeamMenuState([
...otherTeamMenuState,
@@ -319,7 +319,7 @@ const SettingsSidebarContainer = ({
<React.Fragment key={tab.href}>
<div className={`${!tab.children?.length ? "mb-3" : ""}`}>
<Link href={tab.href}>
<div className="hover:bg-subtle [&[aria-current='page']]:bg-emphasis [&[aria-current='page']]:text-emphasis group-hover:text-default text-default group flex h-9 w-full flex-row items-center rounded-md px-2 py-[10px] text-sm font-medium leading-none">
<div className="hover:bg-subtle [&[aria-current='page']]:bg-emphasis [&[aria-current='page']]:text-emphasis group-hover:text-default text-default group flex h-9 w-full flex-row items-center rounded-md px-2 py-[10px] text-sm font-medium leading-none transition">
{tab && tab.icon && (
<Icon
name={tab.icon}
@@ -358,7 +358,7 @@ const SettingsSidebarContainer = ({
}>
<CollapsibleTrigger asChild>
<div
className="hover:bg-subtle [&[aria-current='page']]:bg-emphasis [&[aria-current='page']]:text-emphasis text-default flex h-9 w-full flex-row items-center rounded-md px-3 py-[10px] text-left text-sm font-medium leading-none"
className="hover:bg-subtle [&[aria-current='page']]:bg-emphasis [&[aria-current='page']]:text-emphasis text-default flex h-9 w-full flex-row items-center rounded-md px-3 py-[10px] text-left text-sm font-medium leading-none transition"
onClick={() =>
setTeamMenuState([
...teamMenuState,
@@ -472,7 +472,7 @@ const SettingsSidebarContainer = ({
<React.Fragment key={tab.href}>
<div className={`${!tab.children?.length ? "mb-3" : ""}`}>
<Link href={tab.href}>
<div className="hover:bg-subtle [&[aria-current='page']]:bg-emphasis [&[aria-current='page']]:text-emphasis group-hover:text-default text-default group flex h-9 w-full flex-row items-center rounded-md px-2 py-[10px] text-sm font-medium leading-none">
<div className="hover:bg-subtle [&[aria-current='page']]:bg-emphasis [&[aria-current='page']]:text-emphasis group-hover:text-default text-default group flex h-9 w-full flex-row items-center rounded-md px-2 py-[10px] text-sm font-medium leading-none transition">
{tab && tab.icon && (
<Icon
name={tab.icon}
@@ -511,7 +511,7 @@ const SettingsSidebarContainer = ({
}>
<CollapsibleTrigger asChild>
<div
className="hover:bg-subtle [&[aria-current='page']]:bg-emphasis [&[aria-current='page']]:text-emphasis text-default flex h-9 w-full flex-row items-center rounded-md px-3 py-[10px] text-left text-sm font-medium leading-none"
className="hover:bg-subtle [&[aria-current='page']]:bg-emphasis [&[aria-current='page']]:text-emphasis text-default flex h-9 w-full flex-row items-center rounded-md px-3 py-[10px] text-left text-sm font-medium leading-none transition"
onClick={() =>
setOtherTeamMenuState([
...otherTeamMenuState,
+2 -2
View File
@@ -1196,10 +1196,10 @@ function TopNav() {
<Logo />
</Link>
<div className="flex items-center gap-2 self-center">
<span className="hover:bg-muted hover:text-emphasis text-default group flex items-center rounded-full text-sm font-medium lg:hidden">
<span className="hover:bg-muted hover:text-emphasis text-default group flex items-center rounded-full text-sm font-medium transition lg:hidden">
<KBarTrigger />
</span>
<button className="hover:bg-muted hover:text-subtle text-muted rounded-full p-1 focus:outline-none focus:ring-2 focus:ring-black focus:ring-offset-2">
<button className="hover:bg-muted hover:text-subtle text-muted rounded-full p-1 transition focus:outline-none focus:ring-2 focus:ring-black focus:ring-offset-2">
<span className="sr-only">{t("settings")}</span>
<Link href="/settings/my-account/profile">
<Icon name="settings" className="text-default h-4 w-4" aria-hidden="true" />
@@ -11,7 +11,7 @@ const BackButtonInSidebar = ({ name }: { name: string }) => {
return (
<Link
href="/availability"
className="hover:bg-subtle group-hover:text-default text-emphasis group flex h-6 max-h-6 w-full flex-row items-center rounded-md px-3 py-2">
className="hover:bg-subtle group-hover:text-default text-emphasis group flex h-6 max-h-6 w-full flex-row items-center rounded-md px-3 py-2 transition">
<Icon
name="arrow-left"
className="h-4 w-4 stroke-[2px] ltr:mr-[10px] rtl:ml-[10px] rtl:rotate-180 md:mt-0"