Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
node_modules
.cache
.next
*.log

.env.local
dist
dist-ssr
*.local
13 changes: 13 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/src/favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite App</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@
"node": "14.x"
},
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"dev": "vite",
"build": "tsc && vite build",
"serve": "vite preview",
"firebase:emulator:start": "firebase emulators:start"
},
"dependencies": {
"firebase": "^8.6.2",
"next": "^10.2.3",
"react": "^17.0.2",
"react-dom": "^17.0.2"
},
Expand All @@ -23,7 +22,10 @@
"@types/node": "^14.17.1",
"@types/react": "^17.0.2",
"@types/react-dom": "^17.0.2",
"@vitejs/plugin-react-refresh": "^1.3.1",
"firebase-tools": "^9.12.0",
"typescript": "^4.1.5"
"typescript": "^4.3.2",
"vite": "^2.4.4",
"vite-tsconfig-paths": "^3.3.13"
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { VFC, CSSProperties } from 'react';
import React, { VFC, CSSProperties } from 'react';

type Position = {
top?: number; // px
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { CSSProperties } from 'react'
import React, { CSSProperties } from 'react';

interface TimeWidgetProps {
size: number;
Expand Down
File renamed without changes.
36 changes: 36 additions & 0 deletions src/main.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import React from 'react';
import { render } from 'react-dom';

import '@/global.css';
import { TextWidget } from '@/components/TextWidget';
import { TimeWidget } from '@/components/TimeWidget';

const Widgets = {
'text': TextWidget,
'time': TimeWidget,
};

const App = () => {
const text = `オレオレOBSウィジェットの整理`;

const widgets = [
{ name: 'text', props: { text: text } },
{ name: 'time', props: { size: 30 } },
];

return (
<div>
{widgets.map((widget) => {
const Widget = Widgets[widget.name];
return <Widget {...widget.props} />
})}
</div>
);
};

render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('root')
);
1 change: 1 addition & 0 deletions src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="vite/client" />
3 changes: 1 addition & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@
"jsx": "preserve",
"baseUrl": ".",
"paths": {
"@/*": ["*"]
"@/*": ["./src/*"]
}
},
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx"
],
Expand Down
8 changes: 8 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { defineConfig } from 'vite';
import reactRefresh from '@vitejs/plugin-react-refresh';
import tsconfigPaths from 'vite-tsconfig-paths';

// https://vitejs.dev/config/
export default defineConfig({
plugins: [tsconfigPaths(), reactRefresh()]
});
Loading