Initial commit by AI Generator
This commit is contained in:
12
Dockerfile
Normal file
12
Dockerfile
Normal file
@@ -0,0 +1,12 @@
|
||||
FROM node:20-alpine AS builder
|
||||
WORKDIR /app
|
||||
COPY package*.json ./
|
||||
RUN npm install
|
||||
COPY . .
|
||||
RUN npm run build
|
||||
|
||||
FROM nginx:alpine
|
||||
COPY --from=builder /app/dist /usr/share/nginx/html
|
||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||
EXPOSE 80
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
1
index.html
Normal file
1
index.html
Normal file
@@ -0,0 +1 @@
|
||||
<!DOCTYPE html><html><head><meta charset="UTF-8"/><title>Todo</title></head><body><div id="root"></div><script type="module" src="/src/main.jsx"></script></body></html>
|
||||
10
nginx.conf
Normal file
10
nginx.conf
Normal file
@@ -0,0 +1,10 @@
|
||||
server {
|
||||
listen 80;
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
gzip on;
|
||||
gzip_types text/plain text/css application/json application/javascript;
|
||||
}
|
||||
1
package.json
Normal file
1
package.json
Normal file
@@ -0,0 +1 @@
|
||||
{"name":"todo-app","type":"module","dependencies":{"react":"^18.2.0","react-dom":"^18.2.0"},"devDependencies":{"@vitejs/plugin-react":"^4.2.1","vite":"^5.0.0"},"scripts":{"dev":"vite","build":"vite build"}}
|
||||
1
src/App.jsx
Normal file
1
src/App.jsx
Normal file
@@ -0,0 +1 @@
|
||||
import React,{useState} from "react"; export default function App(){const[t,s]=useState([]);const[v,sv]=useState("");return(<div style={{padding:20}}><h1>Todo App</h1><input value={v} onChange={e=>sv(e.target.value)} placeholder="Nowe zadanie"/><button onClick={()=>{if(v){s([...t,{text:v,done:false}]);sv("")}}}>Dodaj</button><ul>{t.map((i,k)=><li key={k} style={{textDecoration:i.done?"line-through":""}} onClick={()=>s(t.map((x,j)=>j===k?{...x,done:!x.done}:x))}>{i.text}</li>)}</ul></div>)}
|
||||
1
src/main.jsx
Normal file
1
src/main.jsx
Normal file
@@ -0,0 +1 @@
|
||||
import React from "react"; import ReactDOM from "react-dom/client"; import App from "./App.jsx"; ReactDOM.createRoot(document.getElementById("root")).render(<React.StrictMode><App/></React.StrictMode>);
|
||||
1
vite.config.js
Normal file
1
vite.config.js
Normal file
@@ -0,0 +1 @@
|
||||
import {defineConfig} from "vite"; import react from "@vitejs/plugin-react"; export default defineConfig({plugins:[react()]})
|
||||
Reference in New Issue
Block a user