fix: missing responsive design in org members page (#17495)

This commit is contained in:
Benny Joo authored and GitHub committed 2024-11-05 17:26:41 +00:00
1 parent 656fcafcde
commit 1c20a257d3
2 files changed
+40 -31

No files matched your search

@@ -475,38 +475,46 @@ export function UserListTable() {
isPending={isPending}
onScroll={(e) => fetchMoreOnBottomReached(e.target as HTMLDivElement)}>
<DataTableToolbar.Root className="lg:max-w-screen-2xl">
<div className="flex w-full gap-2">
<DataTableToolbar.SearchBar table={table} onSearch={(value) => setDebouncedSearchTerm(value)} />
<DataTableToolbar.CTA
type="button"
color="secondary"
StartIcon="file-down"
loading={isDownloading}
onClick={() => handleDownload()}
data-testid="export-members-button">
{t("download")}
</DataTableToolbar.CTA>
{/* We have to omit member because we don't want the filter to show but we can't disable filtering as we need that for the search bar */}
<DataTableFilters.FilterButton table={table} omit={["member"]} />
<DataTableFilters.ColumnVisibilityButton table={table} />
{adminOrOwner && (
<div className="flex w-full flex-col gap-2 sm:flex-row">
<div className="w-full sm:w-auto sm:min-w-[200px] sm:flex-1">
<DataTableToolbar.SearchBar
table={table}
onSearch={(value) => setDebouncedSearchTerm(value)}
className="sm:max-w-64 max-w-full"
/>
</div>
<div className="flex flex-wrap items-center gap-2">
<DataTableToolbar.CTA
type="button"
color="primary"
StartIcon="plus"
className="rounded-md"
onClick={() =>
dispatch({
type: "INVITE_MEMBER",
payload: {
showModal: true,
},
})
}
data-testid="new-organization-member-button">
{t("add")}
color="secondary"
StartIcon="file-down"
loading={isDownloading}
onClick={() => handleDownload()}
data-testid="export-members-button">
{t("download")}
</DataTableToolbar.CTA>
)}
{/* We have to omit member because we don't want the filter to show but we can't disable filtering as we need that for the search bar */}
<DataTableFilters.FilterButton table={table} omit={["member"]} />
<DataTableFilters.ColumnVisibilityButton table={table} />
{adminOrOwner && (
<DataTableToolbar.CTA
type="button"
color="primary"
StartIcon="plus"
className="rounded-md"
onClick={() =>
dispatch({
type: "INVITE_MEMBER",
payload: {
showModal: true,
},
})
}
data-testid="new-organization-member-button">
{t("add")}
</DataTableToolbar.CTA>
)}
</div>
</div>
<div className="flex gap-2 justify-self-start">
<DataTableFilters.ActiveFilters table={table} />
@@ -34,10 +34,11 @@ interface SearchBarProps<TData> {
table: Table<TData>;
searchKey?: string;
onSearch?: (value: string) => void;
className?: string;
}
function SearchBarComponent<TData>(
{ table, searchKey, onSearch }: SearchBarProps<TData>,
{ table, searchKey, onSearch, className }: SearchBarProps<TData>,
ref: React.Ref<HTMLInputElement>
) {
const [searchTerm, setSearchTerm] = useState("");
@@ -51,7 +52,7 @@ function SearchBarComponent<TData>(
return (
<Input
ref={ref}
className="max-w-64 mb-0 mr-auto rounded-md"
className={`max-w-64 mb-0 mr-auto rounded-md ${className ?? ""}`}
placeholder="Search"
value={searchTerm}
onChange={(event) => setSearchTerm(event.target.value.trim())}