Skip to content

Commit

Permalink
Move editDialog.tsx to components, add path in tsconfig.json, remove …
Browse files Browse the repository at this point in the history
…unused var in page.tsx.
  • Loading branch information
smitug01 committed Sep 14, 2023
1 parent 708a230 commit 5075203
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
6 changes: 3 additions & 3 deletions app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"use client";

import { useState, useEffect, FC } from "react";
import EditDialog from "./edit";
import { Exam, Attendance, EditingData } from "../lib/interfaces";
import EditDialog from "@/components/editDialog";
import { Exam, Attendance, EditingData } from "@/lib/interfaces";

const Home: FC = () => {
const [isDialogOpen, setIsDialogOpen] = useState<boolean>(false);
Expand Down Expand Up @@ -44,7 +44,7 @@ const Home: FC = () => {

const handleDialogSave = (data: EditingData) => {
setExamSchedule((prev) =>
data.subjects.map((subject, index) => ({
data.subjects.map((_subject, index) => ({
...prev[index],
subject: data.subjects[index],
startTime: data.startTimes[index],
Expand Down
14 changes: 7 additions & 7 deletions app/edit.tsx → components/editDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
faPlusCircle,
} from "@fortawesome/free-solid-svg-icons";

import { EditingData } from "../lib/interfaces";
import { EditingData } from "@/lib/interfaces";

interface EditDialogProps {
isOpen: boolean;
Expand Down Expand Up @@ -279,7 +279,7 @@ const EditDialog: FC<EditDialogProps> = ({
<div className="bg-gray-50 dark:bg-slate-600 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse">
<button
type="button"
className="font-semibold w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-indigo-600 dark:bg-indigo-700 hover:bg-indigo-500 hover:dark:bg-indigo-600 text-base font-medium text-white hover:bg-indigo-700 active:scale-95 sm:ml-3 sm:w-auto sm:text-sm"
className=" w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-indigo-600 dark:bg-indigo-700 hover:bg-indigo-500 hover:dark:bg-indigo-600 text-base font-medium text-white active:scale-95 sm:ml-3 sm:w-auto sm:text-sm"
onClick={handleSaveClick}
>
<div className="my-auto">
Expand All @@ -305,11 +305,11 @@ const EditDialog: FC<EditDialogProps> = ({
className={`${
data.showSchedule ? "translate-x-9" : "translate-x-0"
}
pointer-events-none inline-block h-[34px] w-[34px] transform rounded-full ${
data.showSchedule
? "bg-white"
: "bg-slate-700 dark:bg-white"
} shadow-lg ring-0 transition duration-200 ease-in-out`}
pointer-events-none inline-block h-[34px] w-[34px] transform rounded-full ${
data.showSchedule
? "bg-white"
: "bg-slate-700 dark:bg-white"
} shadow-lg ring-0 transition duration-200 ease-in-out`}
/>
</Switch>
</div>
Expand Down
4 changes: 3 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
}
],
"paths": {
"@/*": ["./*"]
"@/*": ["./*"],
"@components/*": ["./components/*"],
"@lib/*": ["./lib/*"],
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
Expand Down

0 comments on commit 5075203

Please sign in to comment.