fix: team availability data table scrolling (#13036)

* fixed data table scrolling for team availability

* Update packages/features/shell/Shell.tsx

* nit
This commit is contained in:
Peer Richelsen authored and GitHub committed 2024-01-04 20:33:02 +00:00
1 parent ecb693c70e
commit 49f9f5489b
7 files changed
+23 -14

No files matched your search

@@ -40,7 +40,7 @@ export function DataTableToolbar<TData>({
const { t } = useLocale();
return (
<div className="sticky top-[3rem] z-10 flex items-center justify-end space-x-2 py-4 md:top-0">
<div className="flex items-center justify-end space-x-2 py-4">
{searchKey && (
<Input
className="max-w-64 mb-0 mr-auto rounded-md"
+8 -4
View File
@@ -38,6 +38,7 @@ export interface DataTableProps<TData, TValue> {
onScroll?: (e: React.UIEvent<HTMLDivElement, UIEvent>) => void;
CTA?: React.ReactNode;
tableOverlay?: React.ReactNode;
variant?: "default" | "compact";
}
export function DataTable<TData, TValue>({
@@ -50,6 +51,7 @@ export function DataTable<TData, TValue>({
tableContainerRef,
isLoading,
tableOverlay,
variant,
/** This should only really be used if you dont have actions in a row. */
onRowMouseclick,
onScroll,
@@ -102,7 +104,7 @@ export function DataTable<TData, TValue>({
searchKey={searchKey}
tableCTA={tableCTA}
/>
<div className="border-subtle border" ref={tableContainerRef} onScroll={onScroll}>
<div ref={tableContainerRef} onScroll={onScroll}>
<Table>
<TableHeader>
{table.getHeaderGroups().map((headerGroup) => (
@@ -128,16 +130,18 @@ export function DataTable<TData, TValue>({
{virtualRows && !isLoading ? (
virtualRows.map((virtualRow) => {
const row = rows[virtualRow.index] as Row<TData>;
return (
<TableRow
key={row.id}
data-state={row.getIsSelected() && "selected"}
onClick={() => onRowMouseclick && onRowMouseclick(row)}
className={classNames(onRowMouseclick && "hover:cursor-pointer")}>
className={classNames(
onRowMouseclick && "hover:cursor-pointer",
variant === "compact" && "!border-0"
)}>
{row.getVisibleCells().map((cell) => {
return (
<TableCell key={cell.id}>
<TableCell key={cell.id} className={classNames(variant === "compact" && "p-1.5")}>
{flexRender(cell.column.columnDef.cell, cell.getContext())}
</TableCell>
);
@@ -54,7 +54,7 @@ export const ToggleGroup = ({ options, onValueChange, isFullWidth, ...props }: T
"aria-checked:bg-emphasis relative rounded-[4px] px-3 py-1 text-sm leading-tight transition-colors",
option.disabled
? "text-gray-400 hover:cursor-not-allowed"
: "text-default [&[aria-checked='false']]:hover:bg-emphasis",
: "text-default [&[aria-checked='false']]:hover:text-emphasis",
isFullWidth && "w-full"
)}>
<div className="item-center flex justify-center ">
+6 -2
View File
@@ -5,7 +5,11 @@ import { classNames } from "@calcom/lib";
const Table = React.forwardRef<HTMLTableElement, React.HTMLAttributes<HTMLTableElement>>(
({ className, ...props }, ref) => (
<div className="w-full overflow-auto md:overflow-visible">
<table ref={ref} className={classNames("w-full caption-bottom text-sm", className)} {...props} />
<table
ref={ref}
className={classNames("border-subtle w-full caption-bottom border text-sm", className)}
{...props}
/>
</div>
)
);
@@ -68,7 +72,7 @@ const TableCell = React.forwardRef<HTMLTableCellElement, React.TdHTMLAttributes<
({ className, ...props }, ref) => (
<td
ref={ref}
className={classNames("text-default p-4 align-middle [&:has([role=checkbox])]:pr-0", className)}
className={classNames("text-default px-2 py-2.5 align-middle [&:has([role=checkbox])]:pr-0", className)}
{...props}
/>
)