diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..1c2fda5 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..84abf01 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..4b218f1 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/react-lab.iml b/.idea/react-lab.iml new file mode 100644 index 0000000..18ec59d --- /dev/null +++ b/.idea/react-lab.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..c8397c9 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 14446ab..25583f6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,6 +12,7 @@ "@testing-library/jest-dom": "^6.6.3", "@testing-library/react": "^16.3.0", "@testing-library/user-event": "^13.5.0", + "milligram": "^1.4.1", "react": "^19.1.0", "react-dom": "^19.1.0", "react-scripts": "5.0.1", @@ -11350,6 +11351,15 @@ "node": ">=8.6" } }, + "node_modules/milligram": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/milligram/-/milligram-1.4.1.tgz", + "integrity": "sha512-RCgh/boHhcXWOUfKJWm3RJRoUeaEguoipDg0mJ31G0tFfvcpWMUlO1Zlqqr12K4kAXfDlllaidu0x7PaL2PTFg==", + "license": "MIT", + "dependencies": { + "normalize.css": "~8.0.1" + } + }, "node_modules/mime": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", @@ -11605,6 +11615,12 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/normalize.css": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/normalize.css/-/normalize.css-8.0.1.tgz", + "integrity": "sha512-qizSNPO93t1YUuUhP22btGOo3chcvDFqFaj2TRybP0DMxkHOCTYwp3n34fel4a31ORXy4m1Xq0Gyqpb5m33qIg==", + "license": "MIT" + }, "node_modules/npm-run-path": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", diff --git a/package.json b/package.json index b3fc595..8e5e42e 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "@testing-library/jest-dom": "^6.6.3", "@testing-library/react": "^16.3.0", "@testing-library/user-event": "^13.5.0", + "milligram": "^1.4.1", "react": "^19.1.0", "react-dom": "^19.1.0", "react-scripts": "5.0.1", diff --git a/src/App.js b/src/App.js index 3784575..7dfb39c 100644 --- a/src/App.js +++ b/src/App.js @@ -1,25 +1,33 @@ import logo from './logo.svg'; import './App.css'; +import {useState} from "react"; +import "milligram"; +import LoginForm from "./LoginForm"; +import UserPanel from "./UserPanel"; function App() { - return ( -
-
- logo -

- Edit src/App.js and save to reload. -

- - Learn React - -
-
- ); + const [authenticatedUsername, setAuthenticatedUsername] = useState(null); + + function login(email){ + if(email){ + setAuthenticatedUsername(email); + } + } + + function logout(){ + setAuthenticatedUsername(null); + } + + return ( +
+

System do zapisów na zajęcia

+ { + authenticatedUsername + ? + : + } +
+ ); } export default App; diff --git a/src/LoginForm.js b/src/LoginForm.js new file mode 100644 index 0000000..15c6bf4 --- /dev/null +++ b/src/LoginForm.js @@ -0,0 +1,14 @@ +import {useState} from "react"; + + +export default function LoginForm(props) { + const [email, setEmail] = useState(''); + + return
+ + setEmail(e.target.value)}/> + +
; +} \ No newline at end of file diff --git a/src/UserPanel.js b/src/UserPanel.js new file mode 100644 index 0000000..6bfae72 --- /dev/null +++ b/src/UserPanel.js @@ -0,0 +1,8 @@ + + +export default function UserPanel({username, onLogout}) { + return
+

Jesteś zalogowany jako {username}!

+ onLogout()}>Wyloguj +
; +} \ No newline at end of file