Skip to content

Database diagrams editor that allows you to visualize and design your DB with a single query.

table scroller

Guy Ben-Aharoncf2382539fe4
diff --git a/src/pages/editor-page/side-panel/side-panel.tsx b/src/pages/editor-page/side-panel/side-panel.tsx
index 58451724..59a43008 100644
--- a/src/pages/editor-page/side-panel/side-panel.tsx
+++ b/src/pages/editor-page/side-panel/side-panel.tsx
@@ -14,7 +14,7 @@ export interface SidePanelProps {}
export const SidePanel: React.FC<SidePanelProps> = () => {
const [selected, setSelected] = React.useState('tables');
return (
- <aside className="flex h-full flex-col">
+ <aside className="flex h-full flex-col overflow-hidden">
<div className="flex justify-center border-b">
<Select
value={selected}
diff --git a/src/pages/editor-page/side-panel/tables-section/table-list/table-list-item/table-list-item-content/table-list-item-content.tsx b/src/pages/editor-page/side-panel/tables-section/table-list/table-list-item/table-list-item-content/table-list-item-content.tsx
index fb62dbe4..93a11149 100644
--- a/src/pages/editor-page/side-panel/tables-section/table-list/table-list-item/table-list-item-content/table-list-item-content.tsx
+++ b/src/pages/editor-page/side-panel/tables-section/table-list/table-list-item/table-list-item-content/table-list-item-content.tsx
@@ -133,10 +133,13 @@ export const TableListItemContent: React.FC<TableListItemContentProps> = ({
<AccordionItem value="fields" className="border-y-0 mb-2">
<AccordionTrigger
iconPosition="right"
- className="p-0 px-2 text-xs text-slate-600 flex flex-1"
+ className="p-0 px-2 text-xs text-slate-600 flex flex-1 hover:bg-secondary py-1 group"
>
- <div className="flex items-center justify-between flex-1 group">
- <div>Fields</div>
+ <div className="flex items-center justify-between flex-1">
+ <div className="flex flex-row items-center gap-1">
+ <FileType2 className="h-4 w-4" />
+ Fields
+ </div>
<div className="flex flex-row-reverse">
<div className="hidden group-hover:flex flex-row-reverse">
<Button
@@ -159,10 +162,13 @@ export const TableListItemContent: React.FC<TableListItemContentProps> = ({
<AccordionItem value="indexes" className="border-y-0">
<AccordionTrigger
iconPosition="right"
- className="p-0 px-2 text-xs text-slate-600 flex flex-1"
+ className="p-0 px-2 text-xs text-slate-600 flex flex-1 hover:bg-secondary py-1 group"
>
- <div className="flex items-center justify-between flex-1 group">
- <div>Indexes</div>
+ <div className="flex items-center justify-between flex-1">
+ <div className="flex flex-row items-center gap-1">
+ <FileKey2 className="h-4 w-4" />
+ Indexes
+ </div>
<div className="flex flex-row-reverse">
<div className="hidden group-hover:flex flex-row-reverse">
<Button
@@ -184,21 +190,13 @@ export const TableListItemContent: React.FC<TableListItemContentProps> = ({
<Separator className="" />
<div className="flex items-center justify-between flex-1">
<div>
- <Button
- variant="outline"
- className="text-xs h-8 p-2"
- // className="hover:bg-primary-foreground p-2 text-slate-500 hover:text-slate-700 h-8"
- >
+ <Button variant="outline" className="text-xs h-8 p-2">
<FileKey2 className="h-4" />
Add Index
</Button>
</div>
<div>
- <Button
- variant="outline"
- className="text-xs h-8 p-2"
- // className="hover:bg-primary-foreground p-2 text-slate-500 hover:text-slate-700 h-8"
- >
+ <Button variant="outline" className="text-xs h-8 p-2">
<FileType2 className="h-4" />
Add Field
</Button>
diff --git a/src/pages/editor-page/side-panel/tables-section/table-list/table-list-item/table-list-item.tsx b/src/pages/editor-page/side-panel/tables-section/table-list/table-list-item/table-list-item.tsx
index 55685cb2..b5c754bf 100644
--- a/src/pages/editor-page/side-panel/tables-section/table-list/table-list-item/table-list-item.tsx
+++ b/src/pages/editor-page/side-panel/tables-section/table-list/table-list-item/table-list-item.tsx
@@ -13,7 +13,7 @@ export interface TableListItemProps {}
export const TableListItem: React.FC<TableListItemProps> = () => {
const tableColor = randomHSLA();
return (
- <AccordionItem value="item-1">
+ <AccordionItem value="item-1" className="rounded-md">
<AccordionTrigger
className="hover:no-underline hover:bg-accent rounded-md px-2 border-l-[6px] py-0 data-[state=open]:rounded-b-none"
style={{
diff --git a/src/pages/editor-page/side-panel/tables-section/table-list/table-list.tsx b/src/pages/editor-page/side-panel/tables-section/table-list/table-list.tsx
index dd694729..eddd7ef5 100644
--- a/src/pages/editor-page/side-panel/tables-section/table-list/table-list.tsx
+++ b/src/pages/editor-page/side-panel/tables-section/table-list/table-list.tsx
@@ -6,10 +6,21 @@ export interface TableListProps {}
export const TableList: React.FC<TableListProps> = () => {
return (
- <div className="flex flex-col">
- <Accordion type="single" collapsible className="w-full">
- <TableListItem />
- </Accordion>
- </div>
+ <Accordion
+ type="single"
+ collapsible
+ className="flex flex-col w-full gap-1"
+ >
+ <TableListItem />
+ <TableListItem />
+ <TableListItem />
+ <TableListItem />
+ <TableListItem />
+ <TableListItem />
+ <TableListItem />
+ <TableListItem />
+ <TableListItem />
+ <TableListItem />
+ </Accordion>
);
};
diff --git a/src/pages/editor-page/side-panel/tables-section/tables-section.tsx b/src/pages/editor-page/side-panel/tables-section/tables-section.tsx
index e76c2940..2a38ef03 100644
--- a/src/pages/editor-page/side-panel/tables-section/tables-section.tsx
+++ b/src/pages/editor-page/side-panel/tables-section/tables-section.tsx
@@ -1,12 +1,30 @@
import React from 'react';
import { TableList } from './table-list/table-list';
+import { Button } from '@/components/button/button';
+import { Table, ListCollapse } from 'lucide-react';
+import { ScrollArea } from '@/components/scroll-area/scroll-area';
export interface TablesSectionProps {}
export const TablesSection: React.FC<TablesSectionProps> = () => {
return (
- <section className="flex h-full flex-col px-2">
- <TableList />
+ <section className="flex flex-col px-2 overflow-hidden flex-1">
+ <div className="flex items-center py-1 justify-between">
+ <div>
+ <Button variant="ghost" className="p-0 h-8 w-8">
+ <ListCollapse className="w-4 h-4" />
+ </Button>
+ </div>
+ <Button variant="secondary" className="text-xs h-8 p-2">
+ <Table className="h-4" />
+ Add Table
+ </Button>
+ </div>
+ <div className="flex flex-col flex-1 overflow-hidden">
+ <ScrollArea className="h-full">
+ <TableList />
+ </ScrollArea>
+ </div>
</section>
);
};