Skip to content

Commit

Permalink
Minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
carbonrobot committed Nov 15, 2023
1 parent 7db71d0 commit 5d3b926
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 50 deletions.
18 changes: 7 additions & 11 deletions packages/webui/src/components/Fields.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { tw } from '@/utils';

import Label from './Label';

type FieldProps = React.HTMLAttributes<HTMLElement> & {
label: string;
};
Expand All @@ -12,20 +10,18 @@ type FieldsProps = Omit<React.HTMLAttributes<HTMLElement>, 'children'> & {

export default function Fields({ className, children, ...props }: FieldsProps) {
return (
<div className={tw('w-full table-fixed text-xs pr-3 py-2', className)} {...props}>
<div className="space-y-2 table-row-group">{children}</div>
</div>
<table className={tw('table table-fixed min-w-full text-xs', className)} {...props}>
<tbody>{children}</tbody>
</table>
);
}

export function Field({ label, className, children, ...props }: FieldProps) {
if (!children) return null;
return (
<div className="table-row" {...props}>
<div className={tw('table-cell w-[200px]', className)}>
<Label label={label} />
</div>
<div className="table-cell font-mono">{children}</div>
</div>
<tr className={className} {...props}>
<td className={tw('table-cell w-[200px] py-1 font-semibold font-mono uppercase', className)}>{label}</td>
<td className="table-cell font-mono">{children}</td>
</tr>
);
}
18 changes: 0 additions & 18 deletions packages/webui/src/components/Label.test.tsx

This file was deleted.

13 changes: 0 additions & 13 deletions packages/webui/src/components/Label.tsx

This file was deleted.

1 change: 0 additions & 1 deletion packages/webui/src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export { default as DateTime } from './DateTime';
export { default as Fields, Field } from './Fields';
export { default as Input } from './Input';
export { default as KeyValueList } from './KeyValueList';
export { default as Label } from './Label';
export { default as Loading } from './Loading';
export { default as Menu } from './Menu';
export { default as SearchInput } from './SearchInput';
Expand Down
2 changes: 1 addition & 1 deletion packages/webui/src/components/ui/TraceDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export default function TraceDetail() {

return (
<div className="h-full flex flex-col p-3 pr-0 bg-manatee-50">
<div className="sticky top-0" data-test-id="summary">
<div className="sticky top-0 pr-3" data-test-id="summary">
<div className="flex flex-row gap-2 items-center">
<div className="flex-1 flex flex-row gap-2">
<div className="flex items-center">
Expand Down
6 changes: 3 additions & 3 deletions packages/webui/src/systems/GraphQL.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ export default class GraphQLSystem implements System<GraphQLData> {
const { operationType, operationName, query } = data;

return (
<>
<Fields className="border-t border-manatee-400 pt-4">
<div className="border-t border-manatee-400 pt-3 mt-3">
<Fields>
<Field data-test-id="name" label="Name">
{operationName}
</Field>
Expand All @@ -56,7 +56,7 @@ export default class GraphQLSystem implements System<GraphQLData> {
<Code data-test-id="query">{query}</Code>
</Field>
</Fields>
</>
</div>
);
}
}
6 changes: 3 additions & 3 deletions packages/webui/src/systems/Sanity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,16 @@ export default class SanitySystem implements System<SanityData> {
const { type, query } = data;

return (
<>
<Fields className="border-t border-manatee-400 pt-4">
<div className="border-t border-manatee-400 pt-3 mt-3">
<Fields>
<Field data-test-id="type" label="Item type">
{type}
</Field>
<Field label="Query">
<Code data-test-id="query">{query}</Code>
</Field>
</Fields>
</>
</div>
);
}

Expand Down

0 comments on commit 5d3b926

Please sign in to comment.