Skip to content

Commit

Permalink
feat: add needed lib
Browse files Browse the repository at this point in the history
  • Loading branch information
btxTruong committed Apr 3, 2024
1 parent 715433f commit 46561ac
Show file tree
Hide file tree
Showing 15 changed files with 1,277 additions and 166 deletions.
10 changes: 8 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,21 @@
"prod": "pm2 start scripts/pm2.config.cjs --no-daemon"
},
"dependencies": {
"@chakra-ui/react": "2.8.2",
"@emotion/react": "11.11.4",
"@emotion/styled": "11.11.0",
"@emotion/styled": "11.11.5",
"framer-motion": "11.0.24",
"lodash": "4.17.21",
"pm2": "5.3.1",
"react": "0.0.0-experimental-2b036d3f1-20240327",
"react-devtools-inline": "5.0.2",
"react-dom": "0.0.0-experimental-2b036d3f1-20240327",
"react-is": "18.2.0",
"react-syntax-highlighter": "15.5.0",
"serve-handler": "6.1.5"
},
"devDependencies": {
"@types/lodash": "4.17.0",
"@types/node": "20.11.30",
"@types/react": "18.2.73",
"@types/react-dom": "18.2.22",
Expand All @@ -38,6 +43,7 @@
"eslint-plugin-react-hooks": "4.6.0",
"eslint-plugin-react-refresh": "0.4.6",
"typescript": "5.4.3",
"vite": "5.2.6"
"vite": "5.2.6",
"vite-tsconfig-paths": "4.3.2"
}
}
42 changes: 0 additions & 42 deletions src/App.css

This file was deleted.

35 changes: 0 additions & 35 deletions src/App.tsx

This file was deleted.

9 changes: 9 additions & 0 deletions src/components/Layout/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { Box } from '@chakra-ui/react';

export const Layout = () => {
return (
<Box>
<p>Header</p>
</Box>
)
}
1 change: 0 additions & 1 deletion src/devtools.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,4 @@ iframe.id = 'app';
const devtoolsContainer = document.getElementById('devtools') as HTMLElement;
document.body.appendChild(iframe);

// TODO: need to find the way to get file name from vite
init(iframe, devtoolsContainer, APP_SOURCE);
68 changes: 0 additions & 68 deletions src/index.css

This file was deleted.

5 changes: 2 additions & 3 deletions src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import React from 'react';
import { createRoot } from 'react-dom/client';
import App from './App.tsx'
import './index.css'
import { Providers } from '@:providers';

const container = document.createElement('div');

document.body.appendChild(container);

createRoot(container).render(
<React.StrictMode>
<App />
<Providers />
</React.StrictMode>,
)
9 changes: 9 additions & 0 deletions src/pages/MainPage/MainPage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export const MainPage = () => {
console.log('window location', window.location)
console.log('window parent location', window.parent.location)
return (
<div>
<h1>MainPage</h1>
</div>
);
}
1 change: 1 addition & 0 deletions src/pages/MainPage/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { MainPage } from './MainPage';
7 changes: 7 additions & 0 deletions src/pages/MoveStateDown/MoveStateDown.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export const MoveStateDown = () => {
return (
<div>
<h1>MoveStateDown</h1>
</div>
);
}
1 change: 1 addition & 0 deletions src/pages/MoveStateDown/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { MoveStateDown } from './MoveStateDown';
14 changes: 14 additions & 0 deletions src/providers.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React from "react"
import { ChakraProvider } from '@chakra-ui/react'

import { MainPage } from '@pages:MainPage';

export const Providers = () => {
return (
<React.Suspense>
<ChakraProvider>
<MainPage />
</ChakraProvider>
</React.Suspense>
)
}
10 changes: 9 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,15 @@
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
"noFallthroughCasesInSwitch": true,
"baseUrl": ".",
"paths": {
"@components:*": ["./src/components/*"],
"@hooks:*": ["./src/hooks/*"],
"@utils:*": ["./src/utils/*"],
"@pages:*": ["./src/pages/*"],
"@:*": ["./src/*"]
}
},
"include": [
"src"
Expand Down
3 changes: 2 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { execSync } from 'node:child_process';
import tsconfigPaths from 'vite-tsconfig-paths';

const commitHash = execSync('git rev-parse --short HEAD').toString().trim();

Expand All @@ -10,7 +11,7 @@ process.env.VITE_COMMIT_HASH = commitHash;

// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
plugins: [tsconfigPaths(), react()],
base: isProduction ? '/react-render/' : './',
build: {
minify: false,
Expand Down
Loading

0 comments on commit 46561ac

Please sign in to comment.