diff --git a/README.md b/README.md index b1b7a27..167c567 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,28 @@ -![OCBO e-Sign Logo](/src/assets/images/logo.png) +## Usage -# OCBO e-Sign +```bash +$ npm install # or pnpm install or yarn install +``` + +### Learn more on the [Solid Website](https://solidjs.com) and come chat with us on our [Discord](https://discord.com/invite/solidjs) + +## Available Scripts + +In the project directory, you can run: + +### `npm run dev` + +Runs the app in the development mode.
+Open [http://localhost:5173](http://localhost:5173) to view it in the browser. + +### `npm run build` + +Builds the app for production to the `dist` folder.
+It correctly bundles Solid in production mode and optimizes the build for the best performance. + +The build is minified and the filenames include the hashes.
+Your app is ready to be deployed! + +## Deployment + +Learn more about deploying your application with the [documentations](https://vite.dev/guide/static-deploy.html) diff --git a/index.html b/index.html index 1c9c52c..32df225 100644 --- a/index.html +++ b/index.html @@ -19,6 +19,6 @@
- + diff --git a/index.tsx b/index.tsx new file mode 100644 index 0000000..b94d026 --- /dev/null +++ b/index.tsx @@ -0,0 +1,8 @@ +import { render } from 'solid-js/web' +import { Router } from '@solidjs/router' + +import routes from './src/routers/router' + +const root = document.getElementById('root') as HTMLElement + +render(() => {routes}, root) diff --git a/src/app.tsx b/src/app.tsx deleted file mode 100644 index f9a346d..0000000 --- a/src/app.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { Suspense, type Component } from 'solid-js' - -const App: Component<{ children: Element }> = (props) => { - return ( - <> -
- {props.children} -
- - ) -} - -export default App diff --git a/src/components/Button/Button.tsx b/src/components/Button/Button.tsx index 9282a48..34558f8 100644 --- a/src/components/Button/Button.tsx +++ b/src/components/Button/Button.tsx @@ -33,14 +33,14 @@ export default (props: Props) => { - + - + diff --git a/src/components/Link/Link.tsx b/src/components/Link/Link.tsx index e191f7a..e5d4098 100644 --- a/src/components/Link/Link.tsx +++ b/src/components/Link/Link.tsx @@ -10,7 +10,7 @@ interface Props { export default (props: Props) => { return ( <> - + {props.children} diff --git a/src/components/Padding/Padding.tsx b/src/components/Padding/Padding.tsx index d55e3c1..b18c8f6 100644 --- a/src/components/Padding/Padding.tsx +++ b/src/components/Padding/Padding.tsx @@ -3,8 +3,8 @@ import { type JSXElement } from 'solid-js' interface Props { left: number right: number - top: number - bottom: number + top?: number + bottom?: number children: JSXElement } diff --git a/src/errors/404.tsx b/src/errors/404.tsx deleted file mode 100644 index bc58eb1..0000000 --- a/src/errors/404.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { Column, Logo, Page, Button, Padding } from '../components' - -export default function NotFound() { - return ( - <> - - - -

Error 404

-

Page not found

- - - -
-
- - ) -} diff --git a/src/index.tsx b/src/index.tsx deleted file mode 100644 index 8150d07..0000000 --- a/src/index.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import './index.sass' -import { render } from 'solid-js/web' -import { Router } from '@solidjs/router' -import { routes } from './routes' -import App from './app.tsx' - -const root = document.getElementById('root') as HTMLElement - -if (import.meta.env.DEV && !(root instanceof HTMLElement)) { - throw new Error('Root element not found. Did you forget to add it to your index.html? Or maybe the id attribute got misspelled?') -} - // @ts-ignore -render(() => {props.children}}>{routes}, root) diff --git a/src/index.sass b/src/layouts/Layout.sass similarity index 100% rename from src/index.sass rename to src/layouts/Layout.sass diff --git a/src/layouts/Layout.tsx b/src/layouts/Layout.tsx new file mode 100644 index 0000000..68143a4 --- /dev/null +++ b/src/layouts/Layout.tsx @@ -0,0 +1,14 @@ +import './Layout.sass' +import type { JSXElement } from 'solid-js' + +interface Props { + children: JSXElement +} + +export default (props: Props) => { + return ( + <> +
{props.children}
+ + ) +} diff --git a/src/pages/IndexPage/Index.tsx b/src/pages/IndexPage/Index.tsx index 208f9bb..c5bceec 100644 --- a/src/pages/IndexPage/Index.tsx +++ b/src/pages/IndexPage/Index.tsx @@ -10,7 +10,7 @@ export default () => { const getAssessors = async () => { try { const assessors = await ofetch(API + 'get-list-assessors', { parseResponse: JSON.parse }) - assessorsNameList = [...assessors.result] + assessorsNameList = [...assessors.result2] } catch (error) { console.error(error) } @@ -24,7 +24,7 @@ export default () => { return ( <> - + diff --git a/src/pages/LoginPage/Login.tsx b/src/pages/LoginPage/Login.tsx index 7bf8b10..5d48c95 100644 --- a/src/pages/LoginPage/Login.tsx +++ b/src/pages/LoginPage/Login.tsx @@ -6,7 +6,7 @@ export default () => { return ( <> - + @@ -23,7 +23,7 @@ export default () => { - + diff --git a/src/pages/MainPage/Main.tsx b/src/pages/MainPage/Main.tsx index 6d60518..24ecb4b 100644 --- a/src/pages/MainPage/Main.tsx +++ b/src/pages/MainPage/Main.tsx @@ -7,7 +7,7 @@ export default () => { return ( <> - + diff --git a/src/pages/RegisterPage/Register.tsx b/src/pages/RegisterPage/Register.tsx index 3d21825..bec8c85 100644 --- a/src/pages/RegisterPage/Register.tsx +++ b/src/pages/RegisterPage/Register.tsx @@ -13,7 +13,7 @@ export default () => { return ( <> - + @@ -30,7 +30,7 @@ export default () => { - + diff --git a/src/routers/router.tsx b/src/routers/router.tsx new file mode 100644 index 0000000..4c1f7d1 --- /dev/null +++ b/src/routers/router.tsx @@ -0,0 +1,33 @@ +import { lazy } from 'solid-js' +import Layout from '../layouts/Layout.tsx' + +const routes = [ + { + path: '/', + component: (props: any) => {props.children}, + children: [ + { + path: '/', + component: lazy(() => import('../pages/IndexPage/Index.tsx')), + }, + { + path: '/main', + component: lazy(() => import('../pages/MainPage/Main.tsx')), + }, + { + path: '/register', + component: lazy(() => import('../pages/RegisterPage/Register.tsx')), + }, + { + path: '/login', + component: lazy(() => import('../pages/LoginPage/Login.tsx')), + }, + ], + }, + { + path: '**', + component: () =>
404
, + }, +] + +export default routes diff --git a/src/routes.tsx b/src/routes.tsx deleted file mode 100644 index 35d4668..0000000 --- a/src/routes.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import { lazy } from 'solid-js' -import type { RouteDefinition } from '@solidjs/router' - -import Index from './pages/IndexPage/Index' - -export const routes: RouteDefinition[] = [ - { - path: '/', - component: Index, - }, - { - path: '/main', - component: lazy(() => import('./pages/MainPage/Main')), - }, - { - path: '/register', - component: lazy(() => import('./pages/RegisterPage/Register.tsx')), - }, - { - path: '/login', - component: lazy(() => import('./pages/LoginPage/Login.tsx')), - }, - { - path: '**', - component: lazy(() => import('./errors/404')), - }, -] diff --git a/tsconfig.app.json b/tsconfig.app.json index d9f1596..da15d3f 100644 --- a/tsconfig.app.json +++ b/tsconfig.app.json @@ -24,5 +24,5 @@ "noFallthroughCasesInSwitch": true, "noUncheckedSideEffectImports": true }, - "include": ["src", "src/index.tsx"] + "include": ["src", "index.tsx"] }