From 70de90129a2aa732793f6a12abd4c2772dcdd943 Mon Sep 17 00:00:00 2001 From: mychidarko Date: Mon, 27 Nov 2023 18:26:41 +0000 Subject: [PATCH] feat: update templates to use .hana for app --- .../templates/javascript/index.html | 2 +- .../templates/javascript/src/_app.jsx | 27 ++++++++----------- .../templates/typescript/index.html | 2 +- .../templates/typescript/src/_app.tsx | 25 ++++++++--------- 4 files changed, 24 insertions(+), 32 deletions(-) diff --git a/packages/create-hana-app/templates/javascript/index.html b/packages/create-hana-app/templates/javascript/index.html index 68cca47..ad8098d 100644 --- a/packages/create-hana-app/templates/javascript/index.html +++ b/packages/create-hana-app/templates/javascript/index.html @@ -8,6 +8,6 @@
- + diff --git a/packages/create-hana-app/templates/javascript/src/_app.jsx b/packages/create-hana-app/templates/javascript/src/_app.jsx index 688fa97..30ddb87 100644 --- a/packages/create-hana-app/templates/javascript/src/_app.jsx +++ b/packages/create-hana-app/templates/javascript/src/_app.jsx @@ -1,11 +1,5 @@ -import React from 'react'; -import ReactDOM from 'react-dom/client'; - -import { createRouter } from '@hanabira/router'; import { PersistedState, createStore } from '@hanabira/store'; -import routes from '../.hana/routes.json'; - import './index.css'; /** @@ -20,6 +14,7 @@ createStore({ state: { count: 0, }, + // reducers are functions that allow you to update your state // you can call them using useReducer('REDUCER_NAME') reducers: { @@ -37,13 +32,13 @@ createStore({ ], }); -ReactDOM.createRoot(document.getElementById('root')).render( - - {createRouter({ - usePageTransition: true, - mode: 'history', - root: import.meta.url, - routes, - })} - -); +const Application = ({ children }) => { + /** + * This is the root of your application. You can add any + * global components here. You can also add a global layout + * here if you want to wrap all of your pages in a layout. + */ + return <>{children}; +}; + +export default Application; diff --git a/packages/create-hana-app/templates/typescript/index.html b/packages/create-hana-app/templates/typescript/index.html index 6cbadef..782b2b1 100644 --- a/packages/create-hana-app/templates/typescript/index.html +++ b/packages/create-hana-app/templates/typescript/index.html @@ -8,6 +8,6 @@
- + diff --git a/packages/create-hana-app/templates/typescript/src/_app.tsx b/packages/create-hana-app/templates/typescript/src/_app.tsx index bdb9f3b..0aff777 100644 --- a/packages/create-hana-app/templates/typescript/src/_app.tsx +++ b/packages/create-hana-app/templates/typescript/src/_app.tsx @@ -1,11 +1,6 @@ import React from 'react'; -import ReactDOM from 'react-dom/client'; - -import { createRouter } from '@hanabira/router'; import { PersistedState, createStore } from '@hanabira/store'; -import routes from '../.hana/routes.json'; - import './index.css'; /** @@ -20,6 +15,7 @@ createStore({ state: { count: 0, }, + // reducers are functions that allow you to update your state // you can call them using useReducer('REDUCER_NAME') reducers: { @@ -37,12 +33,13 @@ createStore({ ], }); -ReactDOM.createRoot(document.getElementById('root')!).render( - - {createRouter({ - mode: 'history', - root: import.meta.url, - routes, - })} - -); +const Application: React.FC = ({ children }) => { + /** + * This is the root of your application. You can add any + * global components here. You can also add a global layout + * here if you want to wrap all of your pages in a layout. + */ + return <>{children}; +}; + +export default Application;