Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
elliotBraem committed Oct 22, 2024
1 parent 1c6235a commit 18e2cfa
Show file tree
Hide file tree
Showing 11 changed files with 161 additions and 143 deletions.
18 changes: 9 additions & 9 deletions src/components/base-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,40 +11,40 @@ const BaseModal: React.FC<BaseModalProps> = ({
isOpen,
onClose,
title,
children,
children
}) => {
if (!isOpen) return null;

return (
<div className="fixed inset-0 z-50 overflow-y-auto">
<div className="flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0">
<div className="flex min-h-screen items-end justify-center px-4 pb-20 pt-4 text-center sm:block sm:p-0">
<div className="fixed inset-0 transition-opacity" aria-hidden="true">
<div className="absolute inset-0 bg-gray-500 opacity-75"></div>
</div>

<span
className="hidden sm:inline-block sm:align-middle sm:h-screen"
className="hidden sm:inline-block sm:h-screen sm:align-middle"
aria-hidden="true"
>
&#8203;
</span>

<div className="inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full">
<div className="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4">
<div className="inline-block transform overflow-hidden rounded-lg bg-white text-left align-bottom shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-lg sm:align-middle">
<div className="bg-white px-4 pb-4 pt-5 sm:p-6 sm:pb-4">
<div className="sm:flex sm:items-start">
<div className="mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left w-full">
<h3 className="text-lg leading-6 font-medium text-gray-900">
<div className="mt-3 w-full text-center sm:ml-4 sm:mt-0 sm:text-left">
<h3 className="text-lg font-medium leading-6 text-gray-900">
{title}
</h3>
<div className="mt-2">{children}</div>
</div>
</div>
</div>
<div className="bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse">
<div className="bg-gray-50 px-4 py-3 sm:flex sm:flex-row-reverse sm:px-6">
<Button
variant="secondary"
onClick={onClose}
className="w-full sm:w-auto sm:ml-3"
className="w-full sm:ml-3 sm:w-auto"
>
Close
</Button>
Expand Down
20 changes: 10 additions & 10 deletions src/components/invite-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const shareInventory = (
const InviteModal: React.FC<InviteModalProps> = ({
isOpen,
onClose,
selectedInventory,
selectedInventory
}) => {
const [selectedPermission, setSelectedPermission] = useState<
"reader" | "writer" | "admin"
Expand Down Expand Up @@ -57,7 +57,7 @@ const InviteModal: React.FC<InviteModalProps> = ({
</label>
<select
id="inventory"
className="mt-1 block w-full pl-3 pr-10 py-2 text-base border-gray-300 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm rounded-md"
className="mt-1 block w-full rounded-md border-gray-300 py-2 pl-3 pr-10 text-base focus:border-indigo-500 focus:outline-none focus:ring-indigo-500 sm:text-sm"
>
<option key={selectedInventory?.id} value={selectedInventory?.id}>
{selectedInventory?.name}
Expand All @@ -73,7 +73,7 @@ const InviteModal: React.FC<InviteModalProps> = ({
</label>
<select
id="permission"
className="mt-1 block w-full pl-3 pr-10 py-2 text-base border-gray-300 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm rounded-md"
className="mt-1 block w-full rounded-md border-gray-300 py-2 pl-3 pr-10 text-base focus:border-indigo-500 focus:outline-none focus:ring-indigo-500 sm:text-sm"
value={selectedPermission}
onChange={(e) =>
setSelectedPermission(
Expand All @@ -86,14 +86,14 @@ const InviteModal: React.FC<InviteModalProps> = ({
</select>
</div>
<div>
<h3 className="text-lg font-medium mb-2">Existing Shared Users</h3>
<div className="max-h-40 overflow-y-auto bg-gray-100 rounded-md p-2">
<h3 className="mb-2 text-lg font-medium">Existing Shared Users</h3>
<div className="max-h-40 overflow-y-auto rounded-md bg-gray-100 p-2">
{invitedMembers?.length > 0 ? (
<ul className="list-disc list-inside">
<ul className="list-inside list-disc">
{invitedMembers.map((user) => (
<li
key={user?.id}
className="text-sm flex justify-between items-center"
className="flex items-center justify-between text-sm"
>
<span>{user?.profile?.name}</span>
<button
Expand All @@ -103,7 +103,7 @@ const InviteModal: React.FC<InviteModalProps> = ({
.castAs(Group)
._raw.removeMember(user?._raw);
}}
className="ml-4 bg-red-500 text-white px-2 py-1 rounded text-xs hover:bg-red-600"
className="ml-4 rounded bg-red-500 px-2 py-1 text-xs text-white hover:bg-red-600"
>
Remove
</button>
Expand Down Expand Up @@ -132,13 +132,13 @@ const InviteModal: React.FC<InviteModalProps> = ({
<input
type="text"
id="inviteLink"
className="flex-1 min-w-0 block w-full px-3 py-2 rounded-none rounded-l-md text-sm border-gray-300 focus:ring-indigo-500 focus:border-indigo-500"
className="block w-full min-w-0 flex-1 rounded-none rounded-l-md border-gray-300 px-3 py-2 text-sm focus:border-indigo-500 focus:ring-indigo-500"
value={inviteLink}
readOnly
/>
<Button
type="button"
className="inline-flex items-center px-3 rounded-r-md border border-l-0 border-gray-300 text-gray-500 text-sm"
className="inline-flex items-center rounded-r-md border border-l-0 border-gray-300 px-3 text-sm text-gray-500"
onClick={() => navigator.clipboard.writeText(inviteLink)}
>
Copy
Expand Down
3 changes: 1 addition & 2 deletions src/components/new-item-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,7 @@ const NewItemModal: React.FC<NewItemModalProps> = ({
</Alert>
)}
</div>



<div>
<label
htmlFor="inventory"
Expand Down
22 changes: 11 additions & 11 deletions src/components/things/data-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,32 @@ import {
ColumnDef,
flexRender,
getCoreRowModel,
useReactTable,
} from "@tanstack/react-table"
useReactTable
} from "@tanstack/react-table";

import {
Table,
TableBody,
TableCell,
TableHead,
TableHeader,
TableRow,
} from "@/components/ui/table"
TableRow
} from "@/components/ui/table";

interface DataTableProps<TData, TValue> {
columns: ColumnDef<TData, TValue>[]
data: TData[]
columns: ColumnDef<TData, TValue>[];
data: TData[];
}

export function DataTable<TData, TValue>({
columns,
data,
data
}: DataTableProps<TData, TValue>) {
const table = useReactTable({
data,
columns,
getCoreRowModel: getCoreRowModel(),
})
getCoreRowModel: getCoreRowModel()
});

return (
<div className="rounded-md border">
Expand All @@ -45,7 +45,7 @@ export function DataTable<TData, TValue>({
header.getContext()
)}
</TableHead>
)
);
})}
</TableRow>
))}
Expand Down Expand Up @@ -74,5 +74,5 @@ export function DataTable<TData, TValue>({
</TableBody>
</Table>
</div>
)
);
}
50 changes: 25 additions & 25 deletions src/components/ui/alert-dialog.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import * as React from "react"
import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog"
import * as React from "react";
import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog";

import { cn } from "@/lib/utils"
import { buttonVariants } from "@/components/ui/button"
import { cn } from "@/lib/utils";
import { buttonVariants } from "@/components/ui/button";

const AlertDialog = AlertDialogPrimitive.Root
const AlertDialog = AlertDialogPrimitive.Root;

const AlertDialogTrigger = AlertDialogPrimitive.Trigger
const AlertDialogTrigger = AlertDialogPrimitive.Trigger;

const AlertDialogPortal = AlertDialogPrimitive.Portal
const AlertDialogPortal = AlertDialogPrimitive.Portal;

const AlertDialogOverlay = React.forwardRef<
React.ElementRef<typeof AlertDialogPrimitive.Overlay>,
Expand All @@ -22,8 +22,8 @@ const AlertDialogOverlay = React.forwardRef<
{...props}
ref={ref}
/>
))
AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName
));
AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName;

const AlertDialogContent = React.forwardRef<
React.ElementRef<typeof AlertDialogPrimitive.Content>,
Expand All @@ -40,8 +40,8 @@ const AlertDialogContent = React.forwardRef<
{...props}
/>
</AlertDialogPortal>
))
AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName
));
AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName;

const AlertDialogHeader = ({
className,
Expand All @@ -54,8 +54,8 @@ const AlertDialogHeader = ({
)}
{...props}
/>
)
AlertDialogHeader.displayName = "AlertDialogHeader"
);
AlertDialogHeader.displayName = "AlertDialogHeader";

const AlertDialogFooter = ({
className,
Expand All @@ -68,8 +68,8 @@ const AlertDialogFooter = ({
)}
{...props}
/>
)
AlertDialogFooter.displayName = "AlertDialogFooter"
);
AlertDialogFooter.displayName = "AlertDialogFooter";

const AlertDialogTitle = React.forwardRef<
React.ElementRef<typeof AlertDialogPrimitive.Title>,
Expand All @@ -80,8 +80,8 @@ const AlertDialogTitle = React.forwardRef<
className={cn("text-lg font-semibold", className)}
{...props}
/>
))
AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName
));
AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName;

const AlertDialogDescription = React.forwardRef<
React.ElementRef<typeof AlertDialogPrimitive.Description>,
Expand All @@ -92,9 +92,9 @@ const AlertDialogDescription = React.forwardRef<
className={cn("text-sm text-muted-foreground", className)}
{...props}
/>
))
));
AlertDialogDescription.displayName =
AlertDialogPrimitive.Description.displayName
AlertDialogPrimitive.Description.displayName;

const AlertDialogAction = React.forwardRef<
React.ElementRef<typeof AlertDialogPrimitive.Action>,
Expand All @@ -105,8 +105,8 @@ const AlertDialogAction = React.forwardRef<
className={cn(buttonVariants(), className)}
{...props}
/>
))
AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName
));
AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName;

const AlertDialogCancel = React.forwardRef<
React.ElementRef<typeof AlertDialogPrimitive.Cancel>,
Expand All @@ -121,8 +121,8 @@ const AlertDialogCancel = React.forwardRef<
)}
{...props}
/>
))
AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName
));
AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName;

export {
AlertDialog,
Expand All @@ -135,5 +135,5 @@ export {
AlertDialogTitle,
AlertDialogDescription,
AlertDialogAction,
AlertDialogCancel,
}
AlertDialogCancel
};
30 changes: 15 additions & 15 deletions src/components/ui/alert.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from "react"
import { cva, type VariantProps } from "class-variance-authority"
import * as React from "react";
import { cva, type VariantProps } from "class-variance-authority";

import { cn } from "@/lib/utils"
import { cn } from "@/lib/utils";

const alertVariants = cva(
"relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",
Expand All @@ -10,14 +10,14 @@ const alertVariants = cva(
variant: {
default: "bg-background text-foreground",
destructive:
"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive",
},
"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"
}
},
defaultVariants: {
variant: "default",
},
variant: "default"
}
}
)
);

const Alert = React.forwardRef<
HTMLDivElement,
Expand All @@ -29,8 +29,8 @@ const Alert = React.forwardRef<
className={cn(alertVariants({ variant }), className)}
{...props}
/>
))
Alert.displayName = "Alert"
));
Alert.displayName = "Alert";

const AlertTitle = React.forwardRef<
HTMLParagraphElement,
Expand All @@ -41,8 +41,8 @@ const AlertTitle = React.forwardRef<
className={cn("mb-1 font-medium leading-none tracking-tight", className)}
{...props}
/>
))
AlertTitle.displayName = "AlertTitle"
));
AlertTitle.displayName = "AlertTitle";

const AlertDescription = React.forwardRef<
HTMLParagraphElement,
Expand All @@ -53,7 +53,7 @@ const AlertDescription = React.forwardRef<
className={cn("text-sm [&_p]:leading-relaxed", className)}
{...props}
/>
))
AlertDescription.displayName = "AlertDescription"
));
AlertDescription.displayName = "AlertDescription";

export { Alert, AlertTitle, AlertDescription }
export { Alert, AlertTitle, AlertDescription };
Loading

0 comments on commit 18e2cfa

Please sign in to comment.