* dumb components for calendar settings * shadcn switch * update exports * update packages * add calendar settings atom to examples app * init calendar settings atom * refactors * fix import path * export type for calendar switch props * invalidate queries on deleting calendar credentials * replace calendars list with calendar settings wrapper * cleanup * update styling * refactors * cleanup * fix: missing key prop CalendarSettingsPlatformWrapper * Label as client components * Address client component build errors * Move QueryCell out of packages/lib * PR feedback * more feedback --------- Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com> Co-authored-by: Morgan <33722304+ThyMinimalDev@users.noreply.github.com> Co-authored-by: Morgan Vernay <morgan@cal.com> Co-authored-by: Joe Au-Yeung <j.auyeung419@gmail.com>
37 lines
1.0 KiB
TypeScript
37 lines
1.0 KiB
TypeScript
"use client";
|
|
|
|
import type { PropsWithChildren } from "react";
|
|
import React, { useRef, useEffect, useState } from "react";
|
|
|
|
import { classNames } from "@calcom/lib";
|
|
|
|
const ScrollableArea = ({ children, className }: PropsWithChildren<{ className?: string }>) => {
|
|
const scrollableRef = useRef<HTMLDivElement>(null);
|
|
const [isOverflowingY, setIsOverflowingY] = useState(false);
|
|
|
|
useEffect(() => {
|
|
const scrollableElement = scrollableRef.current;
|
|
|
|
if (scrollableElement) {
|
|
const isElementOverflowing = scrollableElement.scrollHeight > scrollableElement.clientHeight;
|
|
console.log({ isElementOverflowing });
|
|
setIsOverflowingY(isElementOverflowing);
|
|
}
|
|
}, []);
|
|
|
|
return (
|
|
<div
|
|
ref={scrollableRef}
|
|
className={classNames(
|
|
"scroll-bar overflow-y-scroll ",
|
|
isOverflowingY && " relative ",
|
|
className // Pass in your max-w / max-h
|
|
)}>
|
|
{children}
|
|
{isOverflowingY && <div data-testid="overflow-indicator" />}
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export { ScrollableArea };
|