Skip to content

Commit 8b09544

Browse files
atrakhConvex, Inc.
authored andcommitted
Improve ViewDocument styling (#36442)
GitOrigin-RevId: feb632f9ff49767bd376375ddf936d1ab97dbe93
1 parent 9290b76 commit 8b09544

File tree

5 files changed

+22
-12
lines changed

5 files changed

+22
-12
lines changed

npm-packages/dashboard-common/src/features/data/components/DataContent.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ export function DataContent({
199199
className={cn(
200200
"flex shrink flex-col gap-2 overflow-hidden py-4",
201201
"max-w-full",
202-
popupEl ? "min-w-[10rem]" : "min-w-[20rem]",
202+
popupEl ? "min-w-[16rem]" : "min-w-[20rem]",
203203
)}
204204
ref={ref}
205205
defaultSize={80}
@@ -218,7 +218,7 @@ export function DataContent({
218218
isLoadingMore={isLoading && !isPaused}
219219
/>
220220

221-
<div className="flex h-full flex-col rounded">
221+
<div className="flex h-full max-h-full flex-col overflow-y-hidden rounded">
222222
{numRowsInTable !== undefined && numRowsInTable > 0 && (
223223
<DataFilters
224224
tableName={tableName}

npm-packages/dashboard-common/src/features/data/components/EmptyData.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import { useTableMetadata } from "@common/lib/useTableMetadata";
1414
import { Loading } from "@ui/Loading";
1515
import { Button } from "@ui/Button";
1616
import { Sheet } from "@ui/Sheet";
17+
import { cn } from "@ui/cn";
18+
import { useSize } from "react-use";
1719

1820
// Example table data for the background
1921
const EXAMPLE_COLUMNS = ["_id", "name", "email", "_creationTime"];
@@ -49,13 +51,18 @@ export function EmptyDataContent({
4951
deployment?.deploymentType !== "prod" || hasAdminPermissions;
5052
const tableMetadata = useTableMetadata();
5153
const log = useLogDeploymentEvent();
54+
55+
const sizeMe = <div />;
56+
const [sized, { width }] = useSize(sizeMe);
57+
5258
if (!tableMetadata) {
5359
return <Loading />;
5460
}
5561

5662
return (
5763
<div className="relative h-full w-full animate-fadeIn">
5864
{/* Background table example */}
65+
{sized}
5966
<div
6067
className="pointer-events-none absolute inset-0"
6168
style={{
@@ -160,7 +167,10 @@ export function EmptyDataContent({
160167
<div className="absolute inset-0 flex items-center justify-center">
161168
<Sheet
162169
padding={false}
163-
className="m-6 h-fit w-fit bg-background-secondary/90 p-2 backdrop-blur-[2px]"
170+
className={cn(
171+
"h-fit w-fit bg-background-secondary/90 backdrop-blur-[2px]",
172+
width > 320 ? "p-2 m-6" : "m-0 p-0",
173+
)}
164174
>
165175
<EmptySection
166176
Icon={TableIcon}

npm-packages/dashboard-common/src/features/data/components/Table/EditDocumentField.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export function EditDocumentField({
8282
errors.length > 0 ? setEditError(errors[0]) : setEditError(undefined);
8383
}}
8484
disableFolding
85-
className="border-border-selected pl-2"
85+
className="border-border-selected bg-background-secondary px-2"
8686
validator={validator}
8787
shouldSurfaceValidatorErrors={shouldSurfaceValidatorErrors}
8888
mode="editField"

npm-packages/dashboard-common/src/features/data/components/Table/Table.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ export function Table({
343343
onExpand={() => setCollapsed(false)}
344344
ref={panelRef}
345345
className={cn(
346-
"relative overflow-x-auto",
346+
"max-h-full overflow-x-auto bg-background-primary",
347347
!collapsed && "min-w-[14rem]",
348348
)}
349349
>

npm-packages/dashboard-common/src/features/data/components/Table/ViewDocument.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export function ViewDocument({
6767
const shouldSurfaceValidatorErrors = activeSchema?.schemaValidation;
6868

6969
return (
70-
<div className="flex h-full w-full min-w-[10rem] flex-col items-start overflow-y-hidden rounded-r border-l bg-background-secondary">
70+
<div className="flex h-full w-full min-w-[10rem] flex-col items-start overflow-y-hidden rounded-r border-l bg-background-secondary/70">
7171
{showEnableProdEditsModalForColumn && (
7272
<ProductionEditsConfirmationDialog
7373
onClose={() => {
@@ -80,8 +80,8 @@ export function ViewDocument({
8080
}}
8181
/>
8282
)}
83-
<div className="flex w-full flex-col gap-2 border-b p-4">
84-
<div className="ml-auto flex items-center gap-1 text-xs text-content-tertiary">
83+
<div className="flex w-full flex-col gap-2 border-b p-4 px-2">
84+
<div className="flex items-center justify-between gap-1 text-xs">
8585
{rows.length} document{rows.length !== 1 && "s"} selected
8686
<CopyButton
8787
text={
@@ -106,7 +106,7 @@ export function ViewDocument({
106106
className="w-full"
107107
/>
108108
</div>
109-
<div className="mt-2 flex w-full flex-col gap-2 overflow-y-auto overflow-x-hidden px-4 py-2 scrollbar">
109+
<div className="mt-2 flex w-full flex-col gap-2 overflow-y-auto overflow-x-hidden p-2 scrollbar">
110110
{columns
111111
.filter(
112112
(c) =>
@@ -121,8 +121,8 @@ export function ViewDocument({
121121
key={column}
122122
className="flex w-full flex-col items-center gap-1"
123123
>
124-
<div className="flex w-full justify-between text-xs">
125-
<code>{column}</code>
124+
<div className="flex w-full justify-between text-xs font-medium">
125+
{column}
126126
</div>
127127
{editingColumn === column ? (
128128
<EditDocumentField
@@ -139,7 +139,7 @@ export function ViewDocument({
139139
) : (
140140
<div className="flex w-full gap-1">
141141
<Button
142-
className="flex h-[2.25rem] w-full cursor-text items-center justify-between truncate rounded border px-2 disabled:cursor-not-allowed"
142+
className="flex h-[2.25rem] w-full cursor-text items-center justify-between truncate rounded-md border bg-background-secondary px-2 disabled:cursor-not-allowed"
143143
variant="unstyled"
144144
onClick={() => {
145145
if (!areEditsAuthorized) {

0 commit comments

Comments
 (0)