diff --git a/README.md b/README.md index 167c567..b1b7a27 100644 --- a/README.md +++ b/README.md @@ -1,28 +1,3 @@ -## Usage +![OCBO e-Sign Logo](/src/assets/images/logo.png) -```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) +# OCBO e-Sign diff --git a/index.html b/index.html index 32df225..1c9c52c 100644 --- a/index.html +++ b/index.html @@ -19,6 +19,6 @@
- + diff --git a/index.tsx b/index.tsx deleted file mode 100644 index b94d026..0000000 --- a/index.tsx +++ /dev/null @@ -1,8 +0,0 @@ -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 new file mode 100644 index 0000000..f9a346d --- /dev/null +++ b/src/app.tsx @@ -0,0 +1,13 @@ +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 34558f8..9282a48 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 e5d4098..e191f7a 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 b18c8f6..d55e3c1 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 new file mode 100644 index 0000000..bc58eb1 --- /dev/null +++ b/src/errors/404.tsx @@ -0,0 +1,18 @@ +import { Column, Logo, Page, Button, Padding } from '../components' + +export default function NotFound() { + return ( + <> + + + +

Error 404

+

Page not found

+ + + +
+
+ + ) +} diff --git a/src/layouts/Layout.sass b/src/index.sass similarity index 100% rename from src/layouts/Layout.sass rename to src/index.sass diff --git a/src/index.tsx b/src/index.tsx new file mode 100644 index 0000000..8150d07 --- /dev/null +++ b/src/index.tsx @@ -0,0 +1,13 @@ +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/layouts/Layout.tsx b/src/layouts/Layout.tsx deleted file mode 100644 index 68143a4..0000000 --- a/src/layouts/Layout.tsx +++ /dev/null @@ -1,14 +0,0 @@ -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 c5bceec..208f9bb 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.result2] + assessorsNameList = [...assessors.result] } 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 5d48c95..7bf8b10 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 24ecb4b..6d60518 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 bec8c85..3d21825 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 deleted file mode 100644 index 4c1f7d1..0000000 --- a/src/routers/router.tsx +++ /dev/null @@ -1,33 +0,0 @@ -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 new file mode 100644 index 0000000..35d4668 --- /dev/null +++ b/src/routes.tsx @@ -0,0 +1,27 @@ +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 da15d3f..d9f1596 100644 --- a/tsconfig.app.json +++ b/tsconfig.app.json @@ -24,5 +24,5 @@ "noFallthroughCasesInSwitch": true, "noUncheckedSideEffectImports": true }, - "include": ["src", "index.tsx"] + "include": ["src", "src/index.tsx"] }