Skip to content

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

components

Guy Ben-Aharond0576d13530e
diff --git a/.eslintrc.cjs b/.eslintrc.cjs
index 8f79a662..ae558951 100644
--- a/.eslintrc.cjs
+++ b/.eslintrc.cjs
@@ -1,24 +1,25 @@
module.exports = {
- root: true,
- env: { browser: true, es2020: true },
- extends: [
- 'eslint:recommended',
- 'plugin:react/recommended',
- 'plugin:@typescript-eslint/recommended',
- 'plugin:react-hooks/recommended',
- 'plugin:prettier/recommended',
- ],
- ignorePatterns: ['dist', '.eslintrc.cjs'],
- parser: '@typescript-eslint/parser',
- plugins: ['react-refresh'],
- rules: {
- 'react-refresh/only-export-components': [
- 'warn',
- { allowConstantExport: true },
+ root: true,
+ env: { browser: true, es2020: true },
+ extends: [
+ 'eslint:recommended',
+ 'plugin:react/recommended',
+ 'plugin:@typescript-eslint/recommended',
+ 'plugin:react-hooks/recommended',
+ 'plugin:prettier/recommended',
],
- 'react/no-unescaped-entities': 'off',
- },
- settings: {
- react: { version: 'detect' },
- },
-}
+ ignorePatterns: ['dist', '.eslintrc.cjs'],
+ parser: '@typescript-eslint/parser',
+ plugins: ['react-refresh'],
+ rules: {
+ 'react-refresh/only-export-components': [
+ 'warn',
+ { allowConstantExport: true },
+ ],
+ 'react/no-unescaped-entities': 'off',
+ 'react/prop-types': 'off',
+ },
+ settings: {
+ react: { version: 'detect' },
+ },
+};
diff --git a/src/components/menubar/menubar.tsx b/src/components/menubar/menubar.tsx
index 044c7ab7..c06ab703 100644
--- a/src/components/menubar/menubar.tsx
+++ b/src/components/menubar/menubar.tsx
@@ -1,238 +1,244 @@
-import * as React from "react"
+import * as React from 'react';
import {
- CheckIcon,
- ChevronRightIcon,
- DotFilledIcon,
-} from "@radix-ui/react-icons"
-import * as MenubarPrimitive from "@radix-ui/react-menubar"
+ CheckIcon,
+ ChevronRightIcon,
+ DotFilledIcon,
+} from '@radix-ui/react-icons';
+import * as MenubarPrimitive from '@radix-ui/react-menubar';
-import { cn } from "@/lib/utils"
+import { cn } from '@/lib/utils';
-const MenubarMenu = MenubarPrimitive.Menu
+const MenubarMenu = MenubarPrimitive.Menu;
-const MenubarGroup = MenubarPrimitive.Group
+const MenubarGroup = MenubarPrimitive.Group;
-const MenubarPortal = MenubarPrimitive.Portal
+const MenubarPortal = MenubarPrimitive.Portal;
-const MenubarSub = MenubarPrimitive.Sub
+const MenubarSub = MenubarPrimitive.Sub;
-const MenubarRadioGroup = MenubarPrimitive.RadioGroup
+const MenubarRadioGroup = MenubarPrimitive.RadioGroup;
const Menubar = React.forwardRef<
- React.ElementRef<typeof MenubarPrimitive.Root>,
- React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Root>
+ React.ElementRef<typeof MenubarPrimitive.Root>,
+ React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Root>
>(({ className, ...props }, ref) => (
- <MenubarPrimitive.Root
- ref={ref}
- className={cn(
- "flex h-9 items-center space-x-1 rounded-md border bg-background p-1 shadow-sm",
- className
- )}
- {...props}
- />
-))
-Menubar.displayName = MenubarPrimitive.Root.displayName
+ <MenubarPrimitive.Root
+ ref={ref}
+ className={cn(
+ 'flex h-9 items-center space-x-1 rounded-md border bg-background p-1 shadow-sm',
+ className
+ )}
+ {...props}
+ />
+));
+Menubar.displayName = MenubarPrimitive.Root.displayName;
const MenubarTrigger = React.forwardRef<
- React.ElementRef<typeof MenubarPrimitive.Trigger>,
- React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Trigger>
+ React.ElementRef<typeof MenubarPrimitive.Trigger>,
+ React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Trigger>
>(({ className, ...props }, ref) => (
- <MenubarPrimitive.Trigger
- ref={ref}
- className={cn(
- "flex cursor-default select-none items-center rounded-sm px-3 py-1 text-sm font-medium outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",
- className
- )}
- {...props}
- />
-))
-MenubarTrigger.displayName = MenubarPrimitive.Trigger.displayName
+ <MenubarPrimitive.Trigger
+ ref={ref}
+ className={cn(
+ 'flex cursor-default select-none items-center rounded-sm px-3 py-1 text-sm font-medium outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground',
+ className
+ )}
+ {...props}
+ />
+));
+MenubarTrigger.displayName = MenubarPrimitive.Trigger.displayName;
const MenubarSubTrigger = React.forwardRef<
- React.ElementRef<typeof MenubarPrimitive.SubTrigger>,
- React.ComponentPropsWithoutRef<typeof MenubarPrimitive.SubTrigger> & {
- inset?: boolean
- }
+ React.ElementRef<typeof MenubarPrimitive.SubTrigger>,
+ React.ComponentPropsWithoutRef<typeof MenubarPrimitive.SubTrigger> & {
+ inset?: boolean;
+ }
>(({ className, inset, children, ...props }, ref) => (
- <MenubarPrimitive.SubTrigger
- ref={ref}
- className={cn(
- "flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",
- inset && "pl-8",
- className
- )}
- {...props}
- >
- {children}
- <ChevronRightIcon className="ml-auto h-4 w-4" />
- </MenubarPrimitive.SubTrigger>
-))
-MenubarSubTrigger.displayName = MenubarPrimitive.SubTrigger.displayName
+ <MenubarPrimitive.SubTrigger
+ ref={ref}
+ className={cn(
+ 'flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground',
+ inset && 'pl-8',
+ className
+ )}
+ {...props}
+ >
+ {children}
+ <ChevronRightIcon className="ml-auto h-4 w-4" />
+ </MenubarPrimitive.SubTrigger>
+));
+MenubarSubTrigger.displayName = MenubarPrimitive.SubTrigger.displayName;
const MenubarSubContent = React.forwardRef<
- React.ElementRef<typeof MenubarPrimitive.SubContent>,
- React.ComponentPropsWithoutRef<typeof MenubarPrimitive.SubContent>
+ React.ElementRef<typeof MenubarPrimitive.SubContent>,
+ React.ComponentPropsWithoutRef<typeof MenubarPrimitive.SubContent>
>(({ className, ...props }, ref) => (
- <MenubarPrimitive.SubContent
- ref={ref}
- className={cn(
- "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
- className
- )}
- {...props}
- />
-))
-MenubarSubContent.displayName = MenubarPrimitive.SubContent.displayName
-
-const MenubarContent = React.forwardRef<
- React.ElementRef<typeof MenubarPrimitive.Content>,
- React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Content>
->(
- (
- { className, align = "start", alignOffset = -4, sideOffset = 8, ...props },
- ref
- ) => (
- <MenubarPrimitive.Portal>
- <MenubarPrimitive.Content
+ <MenubarPrimitive.SubContent
ref={ref}
- align={align}
- alignOffset={alignOffset}
- sideOffset={sideOffset}
className={cn(
- "z-50 min-w-[12rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
- className
+ 'z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
+ className
)}
{...props}
- />
- </MenubarPrimitive.Portal>
- )
-)
-MenubarContent.displayName = MenubarPrimitive.Content.displayName
+ />
+));
+MenubarSubContent.displayName = MenubarPrimitive.SubContent.displayName;
+
+const MenubarContent = React.forwardRef<
+ React.ElementRef<typeof MenubarPrimitive.Content>,
+ React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Content>
+>(
+ (
+ {
+ className,
+ align = 'start',
+ alignOffset = -4,
+ sideOffset = 8,
+ ...props
+ },
+ ref
+ ) => (
+ <MenubarPrimitive.Portal>
+ <MenubarPrimitive.Content
+ ref={ref}
+ align={align}
+ alignOffset={alignOffset}
+ sideOffset={sideOffset}
+ className={cn(
+ 'z-50 min-w-[12rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
+ className
+ )}
+ {...props}
+ />
+ </MenubarPrimitive.Portal>
+ )
+);
+MenubarContent.displayName = MenubarPrimitive.Content.displayName;
const MenubarItem = React.forwardRef<
- React.ElementRef<typeof MenubarPrimitive.Item>,
- React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Item> & {
- inset?: boolean
- }
+ React.ElementRef<typeof MenubarPrimitive.Item>,
+ React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Item> & {
+ inset?: boolean;
+ }
>(({ className, inset, ...props }, ref) => (
- <MenubarPrimitive.Item
- ref={ref}
- className={cn(
- "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
- inset && "pl-8",
- className
- )}
- {...props}
- />
-))
-MenubarItem.displayName = MenubarPrimitive.Item.displayName
+ <MenubarPrimitive.Item
+ ref={ref}
+ className={cn(
+ 'relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
+ inset && 'pl-8',
+ className
+ )}
+ {...props}
+ />
+));
+MenubarItem.displayName = MenubarPrimitive.Item.displayName;
const MenubarCheckboxItem = React.forwardRef<
- React.ElementRef<typeof MenubarPrimitive.CheckboxItem>,
- React.ComponentPropsWithoutRef<typeof MenubarPrimitive.CheckboxItem>
+ React.ElementRef<typeof MenubarPrimitive.CheckboxItem>,
+ React.ComponentPropsWithoutRef<typeof MenubarPrimitive.CheckboxItem>
>(({ className, children, checked, ...props }, ref) => (
- <MenubarPrimitive.CheckboxItem
- ref={ref}
- className={cn(
- "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
- className
- )}
- checked={checked}
- {...props}
- >
- <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
- <MenubarPrimitive.ItemIndicator>
- <CheckIcon className="h-4 w-4" />
- </MenubarPrimitive.ItemIndicator>
- </span>
- {children}
- </MenubarPrimitive.CheckboxItem>
-))
-MenubarCheckboxItem.displayName = MenubarPrimitive.CheckboxItem.displayName
+ <MenubarPrimitive.CheckboxItem
+ ref={ref}
+ className={cn(
+ 'relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
+ className
+ )}
+ checked={checked}
+ {...props}
+ >
+ <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
+ <MenubarPrimitive.ItemIndicator>
+ <CheckIcon className="h-4 w-4" />
+ </MenubarPrimitive.ItemIndicator>
+ </span>
+ {children}
+ </MenubarPrimitive.CheckboxItem>
+));
+MenubarCheckboxItem.displayName = MenubarPrimitive.CheckboxItem.displayName;
const MenubarRadioItem = React.forwardRef<
- React.ElementRef<typeof MenubarPrimitive.RadioItem>,
- React.ComponentPropsWithoutRef<typeof MenubarPrimitive.RadioItem>
+ React.ElementRef<typeof MenubarPrimitive.RadioItem>,
+ React.ComponentPropsWithoutRef<typeof MenubarPrimitive.RadioItem>
>(({ className, children, ...props }, ref) => (
- <MenubarPrimitive.RadioItem
- ref={ref}
- className={cn(
- "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
- className
- )}
- {...props}
- >
- <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
- <MenubarPrimitive.ItemIndicator>
- <DotFilledIcon className="h-4 w-4 fill-current" />
- </MenubarPrimitive.ItemIndicator>
- </span>
- {children}
- </MenubarPrimitive.RadioItem>
-))
-MenubarRadioItem.displayName = MenubarPrimitive.RadioItem.displayName
+ <MenubarPrimitive.RadioItem
+ ref={ref}
+ className={cn(
+ 'relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
+ className
+ )}
+ {...props}
+ >
+ <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
+ <MenubarPrimitive.ItemIndicator>
+ <DotFilledIcon className="h-4 w-4 fill-current" />
+ </MenubarPrimitive.ItemIndicator>
+ </span>
+ {children}
+ </MenubarPrimitive.RadioItem>
+));
+MenubarRadioItem.displayName = MenubarPrimitive.RadioItem.displayName;
const MenubarLabel = React.forwardRef<
- React.ElementRef<typeof MenubarPrimitive.Label>,
- React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Label> & {
- inset?: boolean
- }
+ React.ElementRef<typeof MenubarPrimitive.Label>,
+ React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Label> & {
+ inset?: boolean;
+ }
>(({ className, inset, ...props }, ref) => (
- <MenubarPrimitive.Label
- ref={ref}
- className={cn(
- "px-2 py-1.5 text-sm font-semibold",
- inset && "pl-8",
- className
- )}
- {...props}
- />
-))
-MenubarLabel.displayName = MenubarPrimitive.Label.displayName
+ <MenubarPrimitive.Label
+ ref={ref}
+ className={cn(
+ 'px-2 py-1.5 text-sm font-semibold',
+ inset && 'pl-8',
+ className
+ )}
+ {...props}
+ />
+));
+MenubarLabel.displayName = MenubarPrimitive.Label.displayName;
const MenubarSeparator = React.forwardRef<
- React.ElementRef<typeof MenubarPrimitive.Separator>,
- React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Separator>
+ React.ElementRef<typeof MenubarPrimitive.Separator>,
+ React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Separator>
>(({ className, ...props }, ref) => (
- <MenubarPrimitive.Separator
- ref={ref}
- className={cn("-mx-1 my-1 h-px bg-muted", className)}
- {...props}
- />
-))
-MenubarSeparator.displayName = MenubarPrimitive.Separator.displayName
+ <MenubarPrimitive.Separator
+ ref={ref}
+ className={cn('-mx-1 my-1 h-px bg-muted', className)}
+ {...props}
+ />
+));
+MenubarSeparator.displayName = MenubarPrimitive.Separator.displayName;
const MenubarShortcut = ({
- className,
- ...props
+ className,
+ ...props
}: React.HTMLAttributes<HTMLSpanElement>) => {
- return (
- <span
- className={cn(
- "ml-auto text-xs tracking-widest text-muted-foreground",
- className
- )}
- {...props}
- />
- )
-}
-MenubarShortcut.displayname = "MenubarShortcut"
+ return (
+ <span
+ className={cn(
+ 'ml-auto text-xs tracking-widest text-muted-foreground',
+ className
+ )}
+ {...props}
+ />
+ );
+};
+MenubarShortcut.displayname = 'MenubarShortcut';
export {
- Menubar,
- MenubarMenu,
- MenubarTrigger,
- MenubarContent,
- MenubarItem,
- MenubarSeparator,
- MenubarLabel,
- MenubarCheckboxItem,
- MenubarRadioGroup,
- MenubarRadioItem,
- MenubarPortal,
- MenubarSubContent,
- MenubarSubTrigger,
- MenubarGroup,
- MenubarSub,
- MenubarShortcut,
-}
+ Menubar,
+ MenubarMenu,
+ MenubarTrigger,
+ MenubarContent,
+ MenubarItem,
+ MenubarSeparator,
+ MenubarLabel,
+ MenubarCheckboxItem,
+ MenubarRadioGroup,
+ MenubarRadioItem,
+ MenubarPortal,
+ MenubarSubContent,
+ MenubarSubTrigger,
+ MenubarGroup,
+ MenubarSub,
+ MenubarShortcut,
+};
diff --git a/src/lib/utils.ts b/src/lib/utils.ts
index d084ccad..dd53ea89 100644
--- a/src/lib/utils.ts
+++ b/src/lib/utils.ts
@@ -1,6 +1,6 @@
-import { type ClassValue, clsx } from "clsx"
-import { twMerge } from "tailwind-merge"
+import { type ClassValue, clsx } from 'clsx';
+import { twMerge } from 'tailwind-merge';
export function cn(...inputs: ClassValue[]) {
- return twMerge(clsx(inputs))
+ return twMerge(clsx(inputs));
}
diff --git a/src/pages/editor-page/editor-page.tsx b/src/pages/editor-page/editor-page.tsx
index 4bb33b91..4df04914 100644
--- a/src/pages/editor-page/editor-page.tsx
+++ b/src/pages/editor-page/editor-page.tsx
@@ -1,8 +1,5 @@
import React from 'react';
export const EditorPage: React.FC = () => {
- return (
- <section className="bg-background">
- </section>
- );
+ return <section className="bg-background"></section>;
};
diff --git a/vite.config.ts b/vite.config.ts
index 370995ec..2022b188 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -1,6 +1,6 @@
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
-import path from "path"
+import path from 'path';
// https://vitejs.dev/config/
export default defineConfig({