diff --git a/packages/frontend/package.json b/packages/frontend/package.json index 0f29f66a..df74602b 100644 --- a/packages/frontend/package.json +++ b/packages/frontend/package.json @@ -12,6 +12,7 @@ "@types/react-dom": "^18.2.17", "react": "^18.2.0", "react-dom": "^18.2.0", + "react-hook-form": "^7.49.0", "react-router-dom": "^6.20.1", "react-scripts": "5.0.1", "typescript": "^4.9.5", diff --git a/packages/frontend/src/App.tsx b/packages/frontend/src/App.tsx index 199945f3..76a24baa 100644 --- a/packages/frontend/src/App.tsx +++ b/packages/frontend/src/App.tsx @@ -1,14 +1,14 @@ import React from 'react'; import { createBrowserRouter, RouterProvider } from 'react-router-dom'; -import Dashboard from './pages/dashboard'; -import { dashboardRoutes } from './pages/dashboard/routes'; +import Home from './pages'; +import { homeRoutes } from './pages/routes'; const router = createBrowserRouter([ { path: '/', - element: , - children: dashboardRoutes, + element: , + children: homeRoutes, }, ]); diff --git a/packages/frontend/src/components/Card.tsx b/packages/frontend/src/components/Card.tsx new file mode 100644 index 00000000..e84801c3 --- /dev/null +++ b/packages/frontend/src/components/Card.tsx @@ -0,0 +1,22 @@ +import React from 'react'; + +const Card = () => { + return ( +
+
+
^
+
+

iglotools

+

iglotools.com

+
+
...
+
+
+

Hello world

+

3 day ago main

+
+
+ ); +}; + +export default Card; diff --git a/packages/frontend/src/components/SearchBar.tsx b/packages/frontend/src/components/SearchBar.tsx new file mode 100644 index 00000000..8eb5e34c --- /dev/null +++ b/packages/frontend/src/components/SearchBar.tsx @@ -0,0 +1,42 @@ +import React from 'react'; +import { useForm, SubmitHandler } from 'react-hook-form'; + +interface SearchBarProps { + handler: (searchText: SearchInputs) => void; + placeholder?: string; +} + +interface SearchInputs { + search: string; +} + +const SearchBar: React.FC = ({ + handler, + placeholder = 'Search', +}) => { + const { register, handleSubmit } = useForm({ + defaultValues: { + search: '', + }, + }); + + const onSubmit: SubmitHandler = (data) => { + handler(data); + }; + + return ( +
+
^
+
+ +
+
+ ); +}; + +export default SearchBar; diff --git a/packages/frontend/src/components/dashboard/Sidebar.tsx b/packages/frontend/src/components/Sidebar.tsx similarity index 85% rename from packages/frontend/src/components/dashboard/Sidebar.tsx rename to packages/frontend/src/components/Sidebar.tsx index cde31862..d01fd17b 100644 --- a/packages/frontend/src/components/dashboard/Sidebar.tsx +++ b/packages/frontend/src/components/Sidebar.tsx @@ -4,7 +4,7 @@ import { NavLink } from 'react-router-dom'; const Sidebar = () => { return (
-
+

Snowball

@@ -26,7 +26,7 @@ const Sidebar = () => {
-
+
Documentation
Support
diff --git a/packages/frontend/src/pages/Projects.tsx b/packages/frontend/src/pages/Projects.tsx new file mode 100644 index 00000000..c45b154c --- /dev/null +++ b/packages/frontend/src/pages/Projects.tsx @@ -0,0 +1,39 @@ +import React from 'react'; + +import SearchBar from '../components/SearchBar'; +import Card from '../components/Card'; + +const Projects = () => { + return ( +
+
+
+ {}} /> +
+
^
+
^
+
^
+
+
+
+
+

Projects

+
+
+ {/* TODO: Create button component */} + +
+
+
+ + + + +
+
+ ); +}; + +export default Projects; diff --git a/packages/frontend/src/pages/dashboard/Settings.tsx b/packages/frontend/src/pages/Settings.tsx similarity index 100% rename from packages/frontend/src/pages/dashboard/Settings.tsx rename to packages/frontend/src/pages/Settings.tsx diff --git a/packages/frontend/src/pages/dashboard/Projects.tsx b/packages/frontend/src/pages/dashboard/Projects.tsx deleted file mode 100644 index 5a69975c..00000000 --- a/packages/frontend/src/pages/dashboard/Projects.tsx +++ /dev/null @@ -1,7 +0,0 @@ -import React from 'react'; - -const Projects = () => { - return
Projects
; -}; - -export default Projects; diff --git a/packages/frontend/src/pages/dashboard/index.tsx b/packages/frontend/src/pages/index.tsx similarity index 54% rename from packages/frontend/src/pages/dashboard/index.tsx rename to packages/frontend/src/pages/index.tsx index f522e177..dd41ad88 100644 --- a/packages/frontend/src/pages/dashboard/index.tsx +++ b/packages/frontend/src/pages/index.tsx @@ -1,19 +1,19 @@ import React from 'react'; import { Outlet } from 'react-router-dom'; -import Sidebar from '../../components/dashboard/Sidebar'; +import Sidebar from '../components/Sidebar'; -const Dashboard = () => { +const Home = () => { return (
-
+
-
+
); }; -export default Dashboard; +export default Home; diff --git a/packages/frontend/src/pages/dashboard/CreateProject.tsx b/packages/frontend/src/pages/projects/CreateProject.tsx similarity index 100% rename from packages/frontend/src/pages/dashboard/CreateProject.tsx rename to packages/frontend/src/pages/projects/CreateProject.tsx diff --git a/packages/frontend/src/pages/dashboard/Project.tsx b/packages/frontend/src/pages/projects/Project.tsx similarity index 100% rename from packages/frontend/src/pages/dashboard/Project.tsx rename to packages/frontend/src/pages/projects/Project.tsx diff --git a/packages/frontend/src/pages/dashboard/routes.tsx b/packages/frontend/src/pages/projects/routes.tsx similarity index 51% rename from packages/frontend/src/pages/dashboard/routes.tsx rename to packages/frontend/src/pages/projects/routes.tsx index 1533321f..6a5ea20e 100644 --- a/packages/frontend/src/pages/dashboard/routes.tsx +++ b/packages/frontend/src/pages/projects/routes.tsx @@ -1,19 +1,9 @@ import React from 'react'; -import Projects from './Projects'; -import Project from './Project'; -import Settings from './Settings'; import CreateProject from './CreateProject'; +import Project from './Project'; -export const dashboardRoutes = [ - { - path: '/', - element: , - }, - { - path: 'settings', - element: , - }, +export const projectsRoutes = [ { path: ':id', element: , diff --git a/packages/frontend/src/pages/routes.tsx b/packages/frontend/src/pages/routes.tsx new file mode 100644 index 00000000..1f82c111 --- /dev/null +++ b/packages/frontend/src/pages/routes.tsx @@ -0,0 +1,20 @@ +import React from 'react'; + +import Projects from './Projects'; +import Settings from './Settings'; +import { projectsRoutes } from './projects/routes'; + +export const homeRoutes = [ + { + path: '/', + element: , + }, + { + path: 'settings', + element: , + }, + { + path: 'projects', + children: projectsRoutes, + }, +]; diff --git a/yarn.lock b/yarn.lock index d2096e98..c30b9485 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10125,6 +10125,11 @@ react-error-overlay@^6.0.11: resolved "https://registry.npmjs.org/react-error-overlay/-/react-error-overlay-6.0.11.tgz" integrity sha512-/6UZ2qgEyH2aqzYZgQPxEnz33NJ2gNsnHA2o5+o4wW9bLM/JYQitNP9xPhsXwC08hMMovfGe/8retsdDsczPRg== +react-hook-form@^7.49.0: + version "7.49.0" + resolved "https://registry.yarnpkg.com/react-hook-form/-/react-hook-form-7.49.0.tgz#9a91edfba6b6983d4b443653a9b225a780a42b3e" + integrity sha512-gf4qyY4WiqK2hP/E45UUT6wt3Khl49pleEVcIzxhLBrD6m+GMWtLRk0vMrRv45D1ZH8PnpXFwRPv0Pewske2jw== + react-is@^16.13.1: version "16.13.1" resolved "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz"