From a617bab6b9fd82b52b39ae3751990fd04c4cf122 Mon Sep 17 00:00:00 2001 From: TaePoong719 Date: Mon, 11 Sep 2023 17:03:33 +0900 Subject: [PATCH 01/14] =?UTF-8?q?Feat:=20=ED=9A=8C=EC=9B=90=EA=B0=80?= =?UTF-8?q?=EC=9E=85/=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=EC=9C=84=ED=95=9C=20?= =?UTF-8?q?=EB=9D=BC=EC=9A=B0=ED=8C=85=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Router.tsx | 4 ++++ src/pages/Login.tsx | 9 +++++++++ src/pages/SignIn.tsx | 9 +++++++++ 3 files changed, 22 insertions(+) create mode 100644 src/pages/Login.tsx create mode 100644 src/pages/SignIn.tsx diff --git a/src/Router.tsx b/src/Router.tsx index edbd245c..50fe1afa 100644 --- a/src/Router.tsx +++ b/src/Router.tsx @@ -3,6 +3,8 @@ import { Routes, Route } from 'react-router-dom' import Home from './pages/Home' import Wiki from './pages/Wiki' import Gallery from './pages/Gallery' +import Login from './pages/Login' +import SignIn from './pages/SignIn' import styled from 'styled-components' const Router = () => { @@ -13,6 +15,8 @@ const Router = () => { }> }> }> + }> + }> diff --git a/src/pages/Login.tsx b/src/pages/Login.tsx new file mode 100644 index 00000000..45e3e9d2 --- /dev/null +++ b/src/pages/Login.tsx @@ -0,0 +1,9 @@ +import React from 'react' + +const Login = () => { + return ( +
Login
+ ) +} + +export default Login \ No newline at end of file diff --git a/src/pages/SignIn.tsx b/src/pages/SignIn.tsx new file mode 100644 index 00000000..be5a8932 --- /dev/null +++ b/src/pages/SignIn.tsx @@ -0,0 +1,9 @@ +import React from 'react' + +const SignIn = () => { + return ( +
SignIn
+ ) +} + +export default SignIn \ No newline at end of file From 695ccb025b3d2e3da4e821c4e87a9d0f450b0fc3 Mon Sep 17 00:00:00 2001 From: TaePoong719 Date: Mon, 11 Sep 2023 17:09:05 +0900 Subject: [PATCH 02/14] =?UTF-8?q?Feat:=20=ED=9A=8C=EC=9B=90=EA=B0=80?= =?UTF-8?q?=EC=9E=85/=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=EC=9C=84=ED=95=9C=20?= =?UTF-8?q?=EB=9D=BC=EC=9A=B0=ED=8C=85=20=EC=B6=94=EA=B0=802?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Header.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/Header.tsx b/src/components/Header.tsx index e4ae0c36..2760821b 100644 --- a/src/components/Header.tsx +++ b/src/components/Header.tsx @@ -17,6 +17,7 @@ const Header = () => { ) } +
  • 로그인
  • ) From 845724386d7a9c58132b1e050af46b960b1c0b6a Mon Sep 17 00:00:00 2001 From: TaePoong719 Date: Mon, 11 Sep 2023 18:42:17 +0900 Subject: [PATCH 03/14] =?UTF-8?q?Feat:=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=EB=A7=8C=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 720 ++++++++++++++++++++++++++++ package.json | 1 + src/App.tsx | 18 +- src/authentication/authContext.tsx | 4 + src/authentication/authProvider.tsx | 20 + src/firebase.ts | 19 + src/pages/Login.tsx | 49 +- tsconfig.json | 2 +- 8 files changed, 823 insertions(+), 10 deletions(-) create mode 100644 src/authentication/authContext.tsx create mode 100644 src/authentication/authProvider.tsx create mode 100644 src/firebase.ts diff --git a/package-lock.json b/package-lock.json index 473a56ae..8de220e0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,6 +11,7 @@ "@testing-library/jest-dom": "^5.17.0", "@testing-library/react": "^13.4.0", "@testing-library/user-event": "^13.5.0", + "firebase": "^10.3.1", "react": "^18.2.0", "react-dom": "^18.2.0", "react-router-dom": "^6.15.0", @@ -2636,6 +2637,567 @@ "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, + "node_modules/@firebase/analytics": { + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/@firebase/analytics/-/analytics-0.10.0.tgz", + "integrity": "sha512-Locv8gAqx0e+GX/0SI3dzmBY5e9kjVDtD+3zCFLJ0tH2hJwuCAiL+5WkHuxKj92rqQj/rvkBUCfA1ewlX2hehg==", + "dependencies": { + "@firebase/component": "0.6.4", + "@firebase/installations": "0.6.4", + "@firebase/logger": "0.4.0", + "@firebase/util": "1.9.3", + "tslib": "^2.1.0" + }, + "peerDependencies": { + "@firebase/app": "0.x" + } + }, + "node_modules/@firebase/analytics-compat": { + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/@firebase/analytics-compat/-/analytics-compat-0.2.6.tgz", + "integrity": "sha512-4MqpVLFkGK7NJf/5wPEEP7ePBJatwYpyjgJ+wQHQGHfzaCDgntOnl9rL2vbVGGKCnRqWtZDIWhctB86UWXaX2Q==", + "dependencies": { + "@firebase/analytics": "0.10.0", + "@firebase/analytics-types": "0.8.0", + "@firebase/component": "0.6.4", + "@firebase/util": "1.9.3", + "tslib": "^2.1.0" + }, + "peerDependencies": { + "@firebase/app-compat": "0.x" + } + }, + "node_modules/@firebase/analytics-types": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@firebase/analytics-types/-/analytics-types-0.8.0.tgz", + "integrity": "sha512-iRP+QKI2+oz3UAh4nPEq14CsEjrjD6a5+fuypjScisAh9kXKFvdJOZJDwk7kikLvWVLGEs9+kIUS4LPQV7VZVw==" + }, + "node_modules/@firebase/app": { + "version": "0.9.18", + "resolved": "https://registry.npmjs.org/@firebase/app/-/app-0.9.18.tgz", + "integrity": "sha512-SIJi3B/LzNezaEgbFCFIem12+51khkA3iewYljPQPUArWGSAr1cO9NK8TvtJWax5GMKSmQbJPqgi6a+gxHrWGQ==", + "dependencies": { + "@firebase/component": "0.6.4", + "@firebase/logger": "0.4.0", + "@firebase/util": "1.9.3", + "idb": "7.1.1", + "tslib": "^2.1.0" + } + }, + "node_modules/@firebase/app-check": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@firebase/app-check/-/app-check-0.8.0.tgz", + "integrity": "sha512-dRDnhkcaC2FspMiRK/Vbp+PfsOAEP6ZElGm9iGFJ9fDqHoPs0HOPn7dwpJ51lCFi1+2/7n5pRPGhqF/F03I97g==", + "dependencies": { + "@firebase/component": "0.6.4", + "@firebase/logger": "0.4.0", + "@firebase/util": "1.9.3", + "tslib": "^2.1.0" + }, + "peerDependencies": { + "@firebase/app": "0.x" + } + }, + "node_modules/@firebase/app-check-compat": { + "version": "0.3.7", + "resolved": "https://registry.npmjs.org/@firebase/app-check-compat/-/app-check-compat-0.3.7.tgz", + "integrity": "sha512-cW682AxsyP1G+Z0/P7pO/WT2CzYlNxoNe5QejVarW2o5ZxeWSSPAiVEwpEpQR/bUlUmdeWThYTMvBWaopdBsqw==", + "dependencies": { + "@firebase/app-check": "0.8.0", + "@firebase/app-check-types": "0.5.0", + "@firebase/component": "0.6.4", + "@firebase/logger": "0.4.0", + "@firebase/util": "1.9.3", + "tslib": "^2.1.0" + }, + "peerDependencies": { + "@firebase/app-compat": "0.x" + } + }, + "node_modules/@firebase/app-check-interop-types": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@firebase/app-check-interop-types/-/app-check-interop-types-0.3.0.tgz", + "integrity": "sha512-xAxHPZPIgFXnI+vb4sbBjZcde7ZluzPPaSK7Lx3/nmuVk4TjZvnL8ONnkd4ERQKL8WePQySU+pRcWkh8rDf5Sg==" + }, + "node_modules/@firebase/app-check-types": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/@firebase/app-check-types/-/app-check-types-0.5.0.tgz", + "integrity": "sha512-uwSUj32Mlubybw7tedRzR24RP8M8JUVR3NPiMk3/Z4bCmgEKTlQBwMXrehDAZ2wF+TsBq0SN1c6ema71U/JPyQ==" + }, + "node_modules/@firebase/app-compat": { + "version": "0.2.18", + "resolved": "https://registry.npmjs.org/@firebase/app-compat/-/app-compat-0.2.18.tgz", + "integrity": "sha512-zUbAAZHhwmMUyaNFiFr+1Z/sfcxSQBFrRhpjzzpQMTfiV2C/+P0mC3BQA0HsysdGSYOlwrCs5rEGOyarhRU9Kw==", + "dependencies": { + "@firebase/app": "0.9.18", + "@firebase/component": "0.6.4", + "@firebase/logger": "0.4.0", + "@firebase/util": "1.9.3", + "tslib": "^2.1.0" + } + }, + "node_modules/@firebase/app-types": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/@firebase/app-types/-/app-types-0.9.0.tgz", + "integrity": "sha512-AeweANOIo0Mb8GiYm3xhTEBVCmPwTYAu9Hcd2qSkLuga/6+j9b1Jskl5bpiSQWy9eJ/j5pavxj6eYogmnuzm+Q==" + }, + "node_modules/@firebase/auth": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@firebase/auth/-/auth-1.3.0.tgz", + "integrity": "sha512-vjK4CHbY9aWdiVOrKi6mpa8z6uxeaf7LB/MZTHuZOiGHMcUoTGB6TeMbRShyqk1uaMrxhhZ5Ar/dR0965E1qyA==", + "dependencies": { + "@firebase/component": "0.6.4", + "@firebase/logger": "0.4.0", + "@firebase/util": "1.9.3", + "node-fetch": "2.6.7", + "tslib": "^2.1.0" + }, + "peerDependencies": { + "@firebase/app": "0.x", + "@react-native-async-storage/async-storage": "^1.18.1" + }, + "peerDependenciesMeta": { + "@react-native-async-storage/async-storage": { + "optional": true + } + } + }, + "node_modules/@firebase/auth-compat": { + "version": "0.4.6", + "resolved": "https://registry.npmjs.org/@firebase/auth-compat/-/auth-compat-0.4.6.tgz", + "integrity": "sha512-pKp1d4fSf+yoy1EBjTx9ISxlunqhW0vTICk0ByZ3e+Lp6ZIXThfUy4F1hAJlEafD/arM0oepRiAh7LXS1xn/BA==", + "dependencies": { + "@firebase/auth": "1.3.0", + "@firebase/auth-types": "0.12.0", + "@firebase/component": "0.6.4", + "@firebase/util": "1.9.3", + "node-fetch": "2.6.7", + "tslib": "^2.1.0" + }, + "peerDependencies": { + "@firebase/app-compat": "0.x" + } + }, + "node_modules/@firebase/auth-interop-types": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/@firebase/auth-interop-types/-/auth-interop-types-0.2.1.tgz", + "integrity": "sha512-VOaGzKp65MY6P5FI84TfYKBXEPi6LmOCSMMzys6o2BN2LOsqy7pCuZCup7NYnfbk5OkkQKzvIfHOzTm0UDpkyg==" + }, + "node_modules/@firebase/auth-types": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/@firebase/auth-types/-/auth-types-0.12.0.tgz", + "integrity": "sha512-pPwaZt+SPOshK8xNoiQlK5XIrS97kFYc3Rc7xmy373QsOJ9MmqXxLaYssP5Kcds4wd2qK//amx/c+A8O2fVeZA==", + "peerDependencies": { + "@firebase/app-types": "0.x", + "@firebase/util": "1.x" + } + }, + "node_modules/@firebase/component": { + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/@firebase/component/-/component-0.6.4.tgz", + "integrity": "sha512-rLMyrXuO9jcAUCaQXCMjCMUsWrba5fzHlNK24xz5j2W6A/SRmK8mZJ/hn7V0fViLbxC0lPMtrK1eYzk6Fg03jA==", + "dependencies": { + "@firebase/util": "1.9.3", + "tslib": "^2.1.0" + } + }, + "node_modules/@firebase/database": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@firebase/database/-/database-1.0.1.tgz", + "integrity": "sha512-VAhF7gYwunW4Lw/+RQZvW8dlsf2r0YYqV9W0Gi2Mz8+0TGg1mBJWoUtsHfOr8kPJXhcLsC4eP/z3x6L/Fvjk/A==", + "dependencies": { + "@firebase/auth-interop-types": "0.2.1", + "@firebase/component": "0.6.4", + "@firebase/logger": "0.4.0", + "@firebase/util": "1.9.3", + "faye-websocket": "0.11.4", + "tslib": "^2.1.0" + } + }, + "node_modules/@firebase/database-compat": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@firebase/database-compat/-/database-compat-1.0.1.tgz", + "integrity": "sha512-ky82yLIboLxtAIWyW/52a6HLMVTzD2kpZlEilVDok73pNPLjkJYowj8iaIWK5nTy7+6Gxt7d00zfjL6zckGdXQ==", + "dependencies": { + "@firebase/component": "0.6.4", + "@firebase/database": "1.0.1", + "@firebase/database-types": "1.0.0", + "@firebase/logger": "0.4.0", + "@firebase/util": "1.9.3", + "tslib": "^2.1.0" + } + }, + "node_modules/@firebase/database-types": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@firebase/database-types/-/database-types-1.0.0.tgz", + "integrity": "sha512-SjnXStoE0Q56HcFgNQ+9SsmJc0c8TqGARdI/T44KXy+Ets3r6x/ivhQozT66bMnCEjJRywYoxNurRTMlZF8VNg==", + "dependencies": { + "@firebase/app-types": "0.9.0", + "@firebase/util": "1.9.3" + } + }, + "node_modules/@firebase/firestore": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/@firebase/firestore/-/firestore-4.1.3.tgz", + "integrity": "sha512-3kw/oZrLAIHuSDTAlKguZ1e0hAgWgiBl4QQm2mIPBvBAs++iEkuv9DH2tr6rbYpT6dWtdn6jj0RN0XeqOouJRg==", + "dependencies": { + "@firebase/component": "0.6.4", + "@firebase/logger": "0.4.0", + "@firebase/util": "1.9.3", + "@firebase/webchannel-wrapper": "0.10.2", + "@grpc/grpc-js": "~1.8.17", + "@grpc/proto-loader": "^0.7.8", + "node-fetch": "2.6.7", + "tslib": "^2.1.0" + }, + "engines": { + "node": ">=10.10.0" + }, + "peerDependencies": { + "@firebase/app": "0.x" + } + }, + "node_modules/@firebase/firestore-compat": { + "version": "0.3.17", + "resolved": "https://registry.npmjs.org/@firebase/firestore-compat/-/firestore-compat-0.3.17.tgz", + "integrity": "sha512-Qh3tbE4vkn9XvyWnRaJM/v4vhCZ+btk2RZcq037o6oECHohaCFortevd/SKA4vA5yOx0/DwARIEv6XwgHkVucg==", + "dependencies": { + "@firebase/component": "0.6.4", + "@firebase/firestore": "4.1.3", + "@firebase/firestore-types": "3.0.0", + "@firebase/util": "1.9.3", + "tslib": "^2.1.0" + }, + "peerDependencies": { + "@firebase/app-compat": "0.x" + } + }, + "node_modules/@firebase/firestore-types": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@firebase/firestore-types/-/firestore-types-3.0.0.tgz", + "integrity": "sha512-Meg4cIezHo9zLamw0ymFYBD4SMjLb+ZXIbuN7T7ddXN6MGoICmOTq3/ltdCGoDCS2u+H1XJs2u/cYp75jsX9Qw==", + "peerDependencies": { + "@firebase/app-types": "0.x", + "@firebase/util": "1.x" + } + }, + "node_modules/@firebase/functions": { + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/@firebase/functions/-/functions-0.10.0.tgz", + "integrity": "sha512-2U+fMNxTYhtwSpkkR6WbBcuNMOVaI7MaH3cZ6UAeNfj7AgEwHwMIFLPpC13YNZhno219F0lfxzTAA0N62ndWzA==", + "dependencies": { + "@firebase/app-check-interop-types": "0.3.0", + "@firebase/auth-interop-types": "0.2.1", + "@firebase/component": "0.6.4", + "@firebase/messaging-interop-types": "0.2.0", + "@firebase/util": "1.9.3", + "node-fetch": "2.6.7", + "tslib": "^2.1.0" + }, + "peerDependencies": { + "@firebase/app": "0.x" + } + }, + "node_modules/@firebase/functions-compat": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/@firebase/functions-compat/-/functions-compat-0.3.5.tgz", + "integrity": "sha512-uD4jwgwVqdWf6uc3NRKF8cSZ0JwGqSlyhPgackyUPe+GAtnERpS4+Vr66g0b3Gge0ezG4iyHo/EXW/Hjx7QhHw==", + "dependencies": { + "@firebase/component": "0.6.4", + "@firebase/functions": "0.10.0", + "@firebase/functions-types": "0.6.0", + "@firebase/util": "1.9.3", + "tslib": "^2.1.0" + }, + "peerDependencies": { + "@firebase/app-compat": "0.x" + } + }, + "node_modules/@firebase/functions-types": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@firebase/functions-types/-/functions-types-0.6.0.tgz", + "integrity": "sha512-hfEw5VJtgWXIRf92ImLkgENqpL6IWpYaXVYiRkFY1jJ9+6tIhWM7IzzwbevwIIud/jaxKVdRzD7QBWfPmkwCYw==" + }, + "node_modules/@firebase/installations": { + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/@firebase/installations/-/installations-0.6.4.tgz", + "integrity": "sha512-u5y88rtsp7NYkCHC3ElbFBrPtieUybZluXyzl7+4BsIz4sqb4vSAuwHEUgCgCeaQhvsnxDEU6icly8U9zsJigA==", + "dependencies": { + "@firebase/component": "0.6.4", + "@firebase/util": "1.9.3", + "idb": "7.0.1", + "tslib": "^2.1.0" + }, + "peerDependencies": { + "@firebase/app": "0.x" + } + }, + "node_modules/@firebase/installations-compat": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/@firebase/installations-compat/-/installations-compat-0.2.4.tgz", + "integrity": "sha512-LI9dYjp0aT9Njkn9U4JRrDqQ6KXeAmFbRC0E7jI7+hxl5YmRWysq5qgQl22hcWpTk+cm3es66d/apoDU/A9n6Q==", + "dependencies": { + "@firebase/component": "0.6.4", + "@firebase/installations": "0.6.4", + "@firebase/installations-types": "0.5.0", + "@firebase/util": "1.9.3", + "tslib": "^2.1.0" + }, + "peerDependencies": { + "@firebase/app-compat": "0.x" + } + }, + "node_modules/@firebase/installations-types": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/@firebase/installations-types/-/installations-types-0.5.0.tgz", + "integrity": "sha512-9DP+RGfzoI2jH7gY4SlzqvZ+hr7gYzPODrbzVD82Y12kScZ6ZpRg/i3j6rleto8vTFC8n6Len4560FnV1w2IRg==", + "peerDependencies": { + "@firebase/app-types": "0.x" + } + }, + "node_modules/@firebase/installations/node_modules/idb": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/idb/-/idb-7.0.1.tgz", + "integrity": "sha512-UUxlE7vGWK5RfB/fDwEGgRf84DY/ieqNha6msMV99UsEMQhJ1RwbCd8AYBj3QMgnE3VZnfQvm4oKVCJTYlqIgg==" + }, + "node_modules/@firebase/logger": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/@firebase/logger/-/logger-0.4.0.tgz", + "integrity": "sha512-eRKSeykumZ5+cJPdxxJRgAC3G5NknY2GwEbKfymdnXtnT0Ucm4pspfR6GT4MUQEDuJwRVbVcSx85kgJulMoFFA==", + "dependencies": { + "tslib": "^2.1.0" + } + }, + "node_modules/@firebase/messaging": { + "version": "0.12.4", + "resolved": "https://registry.npmjs.org/@firebase/messaging/-/messaging-0.12.4.tgz", + "integrity": "sha512-6JLZct6zUaex4g7HI3QbzeUrg9xcnmDAPTWpkoMpd/GoSVWH98zDoWXMGrcvHeCAIsLpFMe4MPoZkJbrPhaASw==", + "dependencies": { + "@firebase/component": "0.6.4", + "@firebase/installations": "0.6.4", + "@firebase/messaging-interop-types": "0.2.0", + "@firebase/util": "1.9.3", + "idb": "7.0.1", + "tslib": "^2.1.0" + }, + "peerDependencies": { + "@firebase/app": "0.x" + } + }, + "node_modules/@firebase/messaging-compat": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/@firebase/messaging-compat/-/messaging-compat-0.2.4.tgz", + "integrity": "sha512-lyFjeUhIsPRYDPNIkYX1LcZMpoVbBWXX4rPl7c/rqc7G+EUea7IEtSt4MxTvh6fDfPuzLn7+FZADfscC+tNMfg==", + "dependencies": { + "@firebase/component": "0.6.4", + "@firebase/messaging": "0.12.4", + "@firebase/util": "1.9.3", + "tslib": "^2.1.0" + }, + "peerDependencies": { + "@firebase/app-compat": "0.x" + } + }, + "node_modules/@firebase/messaging-interop-types": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@firebase/messaging-interop-types/-/messaging-interop-types-0.2.0.tgz", + "integrity": "sha512-ujA8dcRuVeBixGR9CtegfpU4YmZf3Lt7QYkcj693FFannwNuZgfAYaTmbJ40dtjB81SAu6tbFPL9YLNT15KmOQ==" + }, + "node_modules/@firebase/messaging/node_modules/idb": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/idb/-/idb-7.0.1.tgz", + "integrity": "sha512-UUxlE7vGWK5RfB/fDwEGgRf84DY/ieqNha6msMV99UsEMQhJ1RwbCd8AYBj3QMgnE3VZnfQvm4oKVCJTYlqIgg==" + }, + "node_modules/@firebase/performance": { + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/@firebase/performance/-/performance-0.6.4.tgz", + "integrity": "sha512-HfTn/bd8mfy/61vEqaBelNiNnvAbUtME2S25A67Nb34zVuCSCRIX4SseXY6zBnOFj3oLisaEqhVcJmVPAej67g==", + "dependencies": { + "@firebase/component": "0.6.4", + "@firebase/installations": "0.6.4", + "@firebase/logger": "0.4.0", + "@firebase/util": "1.9.3", + "tslib": "^2.1.0" + }, + "peerDependencies": { + "@firebase/app": "0.x" + } + }, + "node_modules/@firebase/performance-compat": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/@firebase/performance-compat/-/performance-compat-0.2.4.tgz", + "integrity": "sha512-nnHUb8uP9G8islzcld/k6Bg5RhX62VpbAb/Anj7IXs/hp32Eb2LqFPZK4sy3pKkBUO5wcrlRWQa6wKOxqlUqsg==", + "dependencies": { + "@firebase/component": "0.6.4", + "@firebase/logger": "0.4.0", + "@firebase/performance": "0.6.4", + "@firebase/performance-types": "0.2.0", + "@firebase/util": "1.9.3", + "tslib": "^2.1.0" + }, + "peerDependencies": { + "@firebase/app-compat": "0.x" + } + }, + "node_modules/@firebase/performance-types": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@firebase/performance-types/-/performance-types-0.2.0.tgz", + "integrity": "sha512-kYrbr8e/CYr1KLrLYZZt2noNnf+pRwDq2KK9Au9jHrBMnb0/C9X9yWSXmZkFt4UIdsQknBq8uBB7fsybZdOBTA==" + }, + "node_modules/@firebase/remote-config": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/@firebase/remote-config/-/remote-config-0.4.4.tgz", + "integrity": "sha512-x1ioTHGX8ZwDSTOVp8PBLv2/wfwKzb4pxi0gFezS5GCJwbLlloUH4YYZHHS83IPxnua8b6l0IXUaWd0RgbWwzQ==", + "dependencies": { + "@firebase/component": "0.6.4", + "@firebase/installations": "0.6.4", + "@firebase/logger": "0.4.0", + "@firebase/util": "1.9.3", + "tslib": "^2.1.0" + }, + "peerDependencies": { + "@firebase/app": "0.x" + } + }, + "node_modules/@firebase/remote-config-compat": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/@firebase/remote-config-compat/-/remote-config-compat-0.2.4.tgz", + "integrity": "sha512-FKiki53jZirrDFkBHglB3C07j5wBpitAaj8kLME6g8Mx+aq7u9P7qfmuSRytiOItADhWUj7O1JIv7n9q87SuwA==", + "dependencies": { + "@firebase/component": "0.6.4", + "@firebase/logger": "0.4.0", + "@firebase/remote-config": "0.4.4", + "@firebase/remote-config-types": "0.3.0", + "@firebase/util": "1.9.3", + "tslib": "^2.1.0" + }, + "peerDependencies": { + "@firebase/app-compat": "0.x" + } + }, + "node_modules/@firebase/remote-config-types": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@firebase/remote-config-types/-/remote-config-types-0.3.0.tgz", + "integrity": "sha512-RtEH4vdcbXZuZWRZbIRmQVBNsE7VDQpet2qFvq6vwKLBIQRQR5Kh58M4ok3A3US8Sr3rubYnaGqZSurCwI8uMA==" + }, + "node_modules/@firebase/storage": { + "version": "0.11.2", + "resolved": "https://registry.npmjs.org/@firebase/storage/-/storage-0.11.2.tgz", + "integrity": "sha512-CtvoFaBI4hGXlXbaCHf8humajkbXhs39Nbh6MbNxtwJiCqxPy9iH3D3CCfXAvP0QvAAwmJUTK3+z9a++Kc4nkA==", + "dependencies": { + "@firebase/component": "0.6.4", + "@firebase/util": "1.9.3", + "node-fetch": "2.6.7", + "tslib": "^2.1.0" + }, + "peerDependencies": { + "@firebase/app": "0.x" + } + }, + "node_modules/@firebase/storage-compat": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@firebase/storage-compat/-/storage-compat-0.3.2.tgz", + "integrity": "sha512-wvsXlLa9DVOMQJckbDNhXKKxRNNewyUhhbXev3t8kSgoCotd1v3MmqhKKz93ePhDnhHnDs7bYHy+Qa8dRY6BXw==", + "dependencies": { + "@firebase/component": "0.6.4", + "@firebase/storage": "0.11.2", + "@firebase/storage-types": "0.8.0", + "@firebase/util": "1.9.3", + "tslib": "^2.1.0" + }, + "peerDependencies": { + "@firebase/app-compat": "0.x" + } + }, + "node_modules/@firebase/storage-types": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@firebase/storage-types/-/storage-types-0.8.0.tgz", + "integrity": "sha512-isRHcGrTs9kITJC0AVehHfpraWFui39MPaU7Eo8QfWlqW7YPymBmRgjDrlOgFdURh6Cdeg07zmkLP5tzTKRSpg==", + "peerDependencies": { + "@firebase/app-types": "0.x", + "@firebase/util": "1.x" + } + }, + "node_modules/@firebase/util": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/@firebase/util/-/util-1.9.3.tgz", + "integrity": "sha512-DY02CRhOZwpzO36fHpuVysz6JZrscPiBXD0fXp6qSrL9oNOx5KWICKdR95C0lSITzxp0TZosVyHqzatE8JbcjA==", + "dependencies": { + "tslib": "^2.1.0" + } + }, + "node_modules/@firebase/webchannel-wrapper": { + "version": "0.10.2", + "resolved": "https://registry.npmjs.org/@firebase/webchannel-wrapper/-/webchannel-wrapper-0.10.2.tgz", + "integrity": "sha512-xDxhD9++451HuCv3xKBEdSYaArX9NcokODXZYH/MxGw1XFFOz7OKkTRItZ5wf6npBN/inwp8dUZCP7SpAg46yQ==" + }, + "node_modules/@grpc/grpc-js": { + "version": "1.8.21", + "resolved": "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.8.21.tgz", + "integrity": "sha512-KeyQeZpxeEBSqFVTi3q2K7PiPXmgBfECc4updA1ejCLjYmoAlvvM3ZMp5ztTDUCUQmoY3CpDxvchjO1+rFkoHg==", + "dependencies": { + "@grpc/proto-loader": "^0.7.0", + "@types/node": ">=12.12.47" + }, + "engines": { + "node": "^8.13.0 || >=10.10.0" + } + }, + "node_modules/@grpc/proto-loader": { + "version": "0.7.9", + "resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.7.9.tgz", + "integrity": "sha512-YJsOehVXzgurc+lLAxYnlSMc1p/Gu6VAvnfx0ATi2nzvr0YZcjhmZDeY8SeAKv1M7zE3aEJH0Xo9mK1iZ8GYoQ==", + "dependencies": { + "lodash.camelcase": "^4.3.0", + "long": "^5.0.0", + "protobufjs": "^7.2.4", + "yargs": "^17.7.2" + }, + "bin": { + "proto-loader-gen-types": "build/bin/proto-loader-gen-types.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/@grpc/proto-loader/node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@grpc/proto-loader/node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@grpc/proto-loader/node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "engines": { + "node": ">=12" + } + }, "node_modules/@humanwhocodes/config-array": { "version": "0.11.11", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.11.tgz", @@ -3592,6 +4154,60 @@ } } }, + "node_modules/@protobufjs/aspromise": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", + "integrity": "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==" + }, + "node_modules/@protobufjs/base64": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz", + "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==" + }, + "node_modules/@protobufjs/codegen": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz", + "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==" + }, + "node_modules/@protobufjs/eventemitter": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz", + "integrity": "sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q==" + }, + "node_modules/@protobufjs/fetch": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz", + "integrity": "sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ==", + "dependencies": { + "@protobufjs/aspromise": "^1.1.1", + "@protobufjs/inquire": "^1.1.0" + } + }, + "node_modules/@protobufjs/float": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz", + "integrity": "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==" + }, + "node_modules/@protobufjs/inquire": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz", + "integrity": "sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q==" + }, + "node_modules/@protobufjs/path": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz", + "integrity": "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==" + }, + "node_modules/@protobufjs/pool": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz", + "integrity": "sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==" + }, + "node_modules/@protobufjs/utf8": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", + "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==" + }, "node_modules/@remix-run/router": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.8.0.tgz", @@ -8271,6 +8887,39 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/firebase": { + "version": "10.3.1", + "resolved": "https://registry.npmjs.org/firebase/-/firebase-10.3.1.tgz", + "integrity": "sha512-lUk1X0SQocShyIwz5x9mj829Yn1y4Y9KWriGLZ0/Pbwqt4ZxElx8rI1p/YAi4MZTtT1qi0wazo7dAlmuF6J0Aw==", + "dependencies": { + "@firebase/analytics": "0.10.0", + "@firebase/analytics-compat": "0.2.6", + "@firebase/app": "0.9.18", + "@firebase/app-check": "0.8.0", + "@firebase/app-check-compat": "0.3.7", + "@firebase/app-compat": "0.2.18", + "@firebase/app-types": "0.9.0", + "@firebase/auth": "1.3.0", + "@firebase/auth-compat": "0.4.6", + "@firebase/database": "1.0.1", + "@firebase/database-compat": "1.0.1", + "@firebase/firestore": "4.1.3", + "@firebase/firestore-compat": "0.3.17", + "@firebase/functions": "0.10.0", + "@firebase/functions-compat": "0.3.5", + "@firebase/installations": "0.6.4", + "@firebase/installations-compat": "0.2.4", + "@firebase/messaging": "0.12.4", + "@firebase/messaging-compat": "0.2.4", + "@firebase/performance": "0.6.4", + "@firebase/performance-compat": "0.2.4", + "@firebase/remote-config": "0.4.4", + "@firebase/remote-config-compat": "0.2.4", + "@firebase/storage": "0.11.2", + "@firebase/storage-compat": "0.3.2", + "@firebase/util": "1.9.3" + } + }, "node_modules/flat-cache": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.1.0.tgz", @@ -11915,6 +12564,11 @@ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" }, + "node_modules/lodash.camelcase": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", + "integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==" + }, "node_modules/lodash.debounce": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", @@ -11940,6 +12594,11 @@ "resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz", "integrity": "sha512-xfBaXQd9ryd9dlSDvnvI0lvxfLJlYAZzXomUYzLKtUeOQvOP5piqAWuGtrhWeqaXK9hhoM/iyJc5AV+XfsX3HQ==" }, + "node_modules/long": { + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/long/-/long-5.2.3.tgz", + "integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==" + }, "node_modules/loose-envify": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", @@ -12299,6 +12958,44 @@ "tslib": "^2.0.3" } }, + "node_modules/node-fetch": { + "version": "2.6.7", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", + "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "node_modules/node-fetch/node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + }, + "node_modules/node-fetch/node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + }, + "node_modules/node-fetch/node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, "node_modules/node-forge": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.1.tgz", @@ -14182,6 +14879,29 @@ "react-is": "^16.13.1" } }, + "node_modules/protobufjs": { + "version": "7.2.5", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.2.5.tgz", + "integrity": "sha512-gGXRSXvxQ7UiPgfw8gevrfRWcTlSbOFg+p/N+JVJEK5VhueL2miT6qTymqAmjr1Q5WbOCyJbyrk6JfWKwlFn6A==", + "hasInstallScript": true, + "dependencies": { + "@protobufjs/aspromise": "^1.1.2", + "@protobufjs/base64": "^1.1.2", + "@protobufjs/codegen": "^2.0.4", + "@protobufjs/eventemitter": "^1.1.0", + "@protobufjs/fetch": "^1.1.0", + "@protobufjs/float": "^1.0.2", + "@protobufjs/inquire": "^1.1.0", + "@protobufjs/path": "^1.1.2", + "@protobufjs/pool": "^1.1.0", + "@protobufjs/utf8": "^1.1.0", + "@types/node": ">=13.7.0", + "long": "^5.0.0" + }, + "engines": { + "node": ">=12.0.0" + } + }, "node_modules/proxy-addr": { "version": "2.0.7", "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", diff --git a/package.json b/package.json index ff46f69b..f7745ebf 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "@testing-library/jest-dom": "^5.17.0", "@testing-library/react": "^13.4.0", "@testing-library/user-event": "^13.5.0", + "firebase": "^10.3.1", "react": "^18.2.0", "react-dom": "^18.2.0", "react-router-dom": "^6.15.0", diff --git a/src/App.tsx b/src/App.tsx index ec782b54..491af406 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,16 +1,20 @@ import Header from 'components/Header' -import React from 'react' +import React, { useContext } from 'react' import { BrowserRouter } from 'react-router-dom' import Router from 'Router' +import AuthProvider from './authentication/authProvider' +import { AuthContext } from 'authentication/authContext' const App = () => { + const userinfo = useContext(AuthContext) + console.log(userinfo) return ( - <> - -
    - - - + + +
    + + + ) } diff --git a/src/authentication/authContext.tsx b/src/authentication/authContext.tsx new file mode 100644 index 00000000..633963ff --- /dev/null +++ b/src/authentication/authContext.tsx @@ -0,0 +1,4 @@ +import React from "react"; +import { User } from "@firebase/auth"; + +export const AuthContext = React.createContext(null); \ No newline at end of file diff --git a/src/authentication/authProvider.tsx b/src/authentication/authProvider.tsx new file mode 100644 index 00000000..8be29a1b --- /dev/null +++ b/src/authentication/authProvider.tsx @@ -0,0 +1,20 @@ +import { User } from "@firebase/auth"; +import { useEffect, useState } from "react"; +import { AuthContext } from "./authContext"; +import { auth } from "../firebase"; + +const AuthProvider = ({ children }) => { + const [user, setUser] = useState(null); + + useEffect(() => { + const subscribe = auth.onAuthStateChanged(fbUser => { + console.log(`구독 실행`, fbUser); + setUser(fbUser); + }); + return subscribe; + }, []); + + return {children}; +}; + +export default AuthProvider; \ No newline at end of file diff --git a/src/firebase.ts b/src/firebase.ts new file mode 100644 index 00000000..7051801d --- /dev/null +++ b/src/firebase.ts @@ -0,0 +1,19 @@ +// Import the functions you need from the SDKs you need +import { initializeApp } from "firebase/app"; +import { getAuth } from 'firebase/auth' +// TODO: Add SDKs for Firebase products that you want to use +// https://firebase.google.com/docs/web/setup#available-libraries + +// Your web app's Firebase configuration +const firebaseConfig = { + apiKey: "AIzaSyBjMrRAvL85KYQ6okbz7FPTy_iJ6EnSPn0", + authDomain: "fastcampus-wiki.firebaseapp.com", + projectId: "fastcampus-wiki", + storageBucket: "fastcampus-wiki.appspot.com", + messagingSenderId: "38983729603", + appId: "1:38983729603:web:395c72acc46e26b15f3d76" +}; + +// Initialize Firebase +export const app = initializeApp(firebaseConfig); +export const auth = getAuth(app); diff --git a/src/pages/Login.tsx b/src/pages/Login.tsx index 45e3e9d2..5f087aae 100644 --- a/src/pages/Login.tsx +++ b/src/pages/Login.tsx @@ -1,9 +1,54 @@ -import React from 'react' +import React, { useContext, useState } from 'react' +import styled from 'styled-components' +import { auth } from '../firebase' +import { AuthContext } from 'authentication/authContext'; const Login = () => { + const userInfo = useContext(AuthContext); + const [email, setEmail] = useState(""); + const [pwd, setPwd] = useState(""); + const [isCreate, setIsCreate] = useState(false); + + const handleEmail = (e: React.ChangeEvent) => { + e.preventDefault(); + setEmail(e.target.value); + }; + + const handlePwd = (e: React.ChangeEvent) => { + e.preventDefault(); + setPwd(e.target.value); + }; + + const handleClickCreate = (e: React.MouseEvent) => { + e.preventDefault(); + setIsCreate(pre => !pre); + }; + + console.log(auth) return ( -
    Login
    + +

    로그인

    +
    + + + + +
    +
    ) } +const Container = styled.main` + margin: 0 auto; + margin-top: 60px; + width: 90%; + max-width: 800px; + height: 500px; + border: 2px solid black; + padding : 20px 5px; + box-sizing: border-box; +` + export default Login \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 9a9e0352..743af679 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,7 +11,7 @@ "skipLibCheck": true, "esModuleInterop": true, "allowSyntheticDefaultImports": true, - "strict": true, + "strict": false, "forceConsistentCasingInFileNames": true, "noFallthroughCasesInSwitch": true, "module": "esnext", From 8a4cbfbfd55637df85f1f9bcba1c4e544ea87b16 Mon Sep 17 00:00:00 2001 From: TaePoong719 Date: Mon, 11 Sep 2023 19:03:44 +0900 Subject: [PATCH 04/14] =?UTF-8?q?Feat:=20=ED=9A=8C=EC=9B=90=20=EA=B0=80?= =?UTF-8?q?=EC=9E=85=20=EA=B8=B0=EB=8A=A5=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Login.tsx | 25 ++++++++++++------- src/pages/SignIn.tsx | 57 ++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 72 insertions(+), 10 deletions(-) diff --git a/src/pages/Login.tsx b/src/pages/Login.tsx index 5f087aae..80c17076 100644 --- a/src/pages/Login.tsx +++ b/src/pages/Login.tsx @@ -2,6 +2,8 @@ import React, { useContext, useState } from 'react' import styled from 'styled-components' import { auth } from '../firebase' import { AuthContext } from 'authentication/authContext'; +import { Link } from 'react-router-dom'; +import { signInWithEmailAndPassword } from 'firebase/auth'; const Login = () => { const userInfo = useContext(AuthContext); @@ -19,23 +21,30 @@ const Login = () => { setPwd(e.target.value); }; - const handleClickCreate = (e: React.MouseEvent) => { + const handleSubmit = (e: React.FormEvent) => { e.preventDefault(); - setIsCreate(pre => !pre); + + signInWithEmailAndPassword(auth, email, pwd) + .then(() => { + alert("로그인 성공"); + // 메인 홈으로 이동 + }) + .catch(e => { + alert(e); + }); }; - + console.log(auth) return (

    로그인

    -
    + - - + +
    + 회원가입
    ) } diff --git a/src/pages/SignIn.tsx b/src/pages/SignIn.tsx index be5a8932..688c5987 100644 --- a/src/pages/SignIn.tsx +++ b/src/pages/SignIn.tsx @@ -1,9 +1,62 @@ -import React from 'react' +import { AuthContext } from 'authentication/authContext'; +import { auth } from '../firebase'; +import { createUserWithEmailAndPassword } from 'firebase/auth'; +import React, { useContext, useState } from 'react' +import styled from 'styled-components' const SignIn = () => { + const userInfo = useContext(AuthContext); + const [email, setEmail] = useState(""); + const [pwd, setPwd] = useState(""); + const [isCreate, setIsCreate] = useState(false); + + const handleEmail = (e: React.ChangeEvent) => { + e.preventDefault(); + setEmail(e.target.value); + }; + + const handlePwd = (e: React.ChangeEvent) => { + e.preventDefault(); + setPwd(e.target.value); + }; + + const handleClickCreate = (e: React.MouseEvent) => { + e.preventDefault(); + setIsCreate(pre => !pre); + + createUserWithEmailAndPassword(auth, email, pwd) + .then(() => { + alert("회원가입 성공"); + }) + .catch(e => { + alert(e); + }); + + }; + + return ( -
    SignIn
    + +

    로그인

    +
    + + + +
    +
    ) } +const Container = styled.main` + margin: 0 auto; + margin-top: 60px; + width: 90%; + max-width: 800px; + height: 500px; + border: 2px solid black; + padding : 20px 5px; + box-sizing: border-box; +` export default SignIn \ No newline at end of file From 3d5eb4d838a96b3e8933e7b6fcb28f7418701e7c Mon Sep 17 00:00:00 2001 From: TaePoong719 Date: Tue, 12 Sep 2023 10:32:23 +0900 Subject: [PATCH 05/14] =?UTF-8?q?Fix:=20Child=20=EC=BB=B4=ED=8F=AC?= =?UTF-8?q?=EB=84=8C=ED=8A=B8=20=ED=83=80=EC=9E=85=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/authentication/authProvider.tsx | 6 +++++- tsconfig.json | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/authentication/authProvider.tsx b/src/authentication/authProvider.tsx index 8be29a1b..d0283d1a 100644 --- a/src/authentication/authProvider.tsx +++ b/src/authentication/authProvider.tsx @@ -3,7 +3,11 @@ import { useEffect, useState } from "react"; import { AuthContext } from "./authContext"; import { auth } from "../firebase"; -const AuthProvider = ({ children }) => { +type IChildren = { + children : React.JSX.Element +} + +const AuthProvider = ({ children }: IChildren) => { const [user, setUser] = useState(null); useEffect(() => { diff --git a/tsconfig.json b/tsconfig.json index 743af679..9a9e0352 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,7 +11,7 @@ "skipLibCheck": true, "esModuleInterop": true, "allowSyntheticDefaultImports": true, - "strict": false, + "strict": true, "forceConsistentCasingInFileNames": true, "noFallthroughCasesInSwitch": true, "module": "esnext", From cf4beb0ec6967cba02fa2c2be186f66fda5ce87f Mon Sep 17 00:00:00 2001 From: TaePoong719 Date: Tue, 12 Sep 2023 12:21:45 +0900 Subject: [PATCH 06/14] =?UTF-8?q?Feat:=20=ED=8C=8C=EC=9D=B4=EC=96=B4?= =?UTF-8?q?=EB=B2=A0=EC=9D=B4=EC=8A=A4=20=EB=8B=89=EB=84=A4=EC=9E=84=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95=20=EB=B0=8F=20=EA=B0=80=EC=A0=B8=EC=98=A4?= =?UTF-8?q?=EA=B8=B0=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Router.tsx | 4 +-- src/components/Header.tsx | 2 +- src/pages/Login.tsx | 7 ++-- src/pages/{SignIn.tsx => SignUp.tsx} | 52 +++++++++++++++++----------- 4 files changed, 38 insertions(+), 27 deletions(-) rename src/pages/{SignIn.tsx => SignUp.tsx} (52%) diff --git a/src/Router.tsx b/src/Router.tsx index 50fe1afa..573c0b60 100644 --- a/src/Router.tsx +++ b/src/Router.tsx @@ -4,7 +4,7 @@ import Home from './pages/Home' import Wiki from './pages/Wiki' import Gallery from './pages/Gallery' import Login from './pages/Login' -import SignIn from './pages/SignIn' +import SignUp from './pages/SignUp' import styled from 'styled-components' const Router = () => { @@ -16,7 +16,7 @@ const Router = () => { }> }> }> - }> + }> diff --git a/src/components/Header.tsx b/src/components/Header.tsx index 2760821b..f81ba0c8 100644 --- a/src/components/Header.tsx +++ b/src/components/Header.tsx @@ -1,4 +1,4 @@ -import React from 'react' +import React, { useEffect, useState, useContext } from 'react' import styled from 'styled-components' import { Link } from 'react-router-dom' import './Header.css' diff --git a/src/pages/Login.tsx b/src/pages/Login.tsx index 80c17076..0c83c3a9 100644 --- a/src/pages/Login.tsx +++ b/src/pages/Login.tsx @@ -6,7 +6,7 @@ import { Link } from 'react-router-dom'; import { signInWithEmailAndPassword } from 'firebase/auth'; const Login = () => { - const userInfo = useContext(AuthContext); + const user = useContext(AuthContext); const [email, setEmail] = useState(""); const [pwd, setPwd] = useState(""); const [isCreate, setIsCreate] = useState(false); @@ -27,6 +27,8 @@ const Login = () => { signInWithEmailAndPassword(auth, email, pwd) .then(() => { alert("로그인 성공"); + + console.log(user) // 메인 홈으로 이동 }) .catch(e => { @@ -34,7 +36,6 @@ const Login = () => { }); }; - console.log(auth) return (

    로그인

    @@ -44,7 +45,7 @@ const Login = () => { - 회원가입 + 회원가입
    ) } diff --git a/src/pages/SignIn.tsx b/src/pages/SignUp.tsx similarity index 52% rename from src/pages/SignIn.tsx rename to src/pages/SignUp.tsx index 688c5987..5fbc9bb6 100644 --- a/src/pages/SignIn.tsx +++ b/src/pages/SignUp.tsx @@ -1,38 +1,47 @@ import { AuthContext } from 'authentication/authContext'; import { auth } from '../firebase'; -import { createUserWithEmailAndPassword } from 'firebase/auth'; +import { createUserWithEmailAndPassword, updateProfile } from 'firebase/auth'; import React, { useContext, useState } from 'react' import styled from 'styled-components' const SignIn = () => { - const userInfo = useContext(AuthContext); + const user = useContext(AuthContext); const [email, setEmail] = useState(""); const [pwd, setPwd] = useState(""); - const [isCreate, setIsCreate] = useState(false); + const [nickname, setNickname] = useState(""); const handleEmail = (e: React.ChangeEvent) => { - e.preventDefault(); - setEmail(e.target.value); - }; + e.preventDefault() + setEmail(e.target.value) + } const handlePwd = (e: React.ChangeEvent) => { - e.preventDefault(); - setPwd(e.target.value); - }; + e.preventDefault() + setPwd(e.target.value) + } + + const handleNickname = (e: React.ChangeEvent) => { + e.preventDefault() + setNickname(e.target.value) + } - const handleClickCreate = (e: React.MouseEvent) => { + const handleClickCreate = async (e: React.MouseEvent) => { e.preventDefault(); - setIsCreate(pre => !pre); - - createUserWithEmailAndPassword(auth, email, pwd) - .then(() => { - alert("회원가입 성공"); - }) - .catch(e => { - alert(e); - }); - - }; + try{ + const userCredential = await createUserWithEmailAndPassword(auth, email, pwd) + if(userCredential){ + console.log(userCredential) + await updateProfile(userCredential.user, { + displayName: nickname + }) + } + + alert('회원가입이 완료됐습니다.') + + }catch(e){ + alert(e) + } + } return ( @@ -41,6 +50,7 @@ const SignIn = () => {
    + From 922e10b62163c2d732bbd8ea7d6ff0bcd24520c4 Mon Sep 17 00:00:00 2001 From: TaePoong719 Date: Tue, 12 Sep 2023 14:00:42 +0900 Subject: [PATCH 07/14] =?UTF-8?q?Feat:=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20&?= =?UTF-8?q?=20=ED=9A=8C=EC=9B=90=EA=B0=80=EC=9E=85=20=EA=B8=B0=EB=8A=A5=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.tsx | 5 +---- src/authentication/authProvider.tsx | 4 ++-- src/components/Header.tsx | 11 ++++++++++- src/pages/Login.tsx | 3 --- src/pages/SignUp.tsx | 19 ++++++++++--------- 5 files changed, 23 insertions(+), 19 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 491af406..419837fe 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,13 +1,10 @@ import Header from 'components/Header' -import React, { useContext } from 'react' +import React from 'react' import { BrowserRouter } from 'react-router-dom' import Router from 'Router' import AuthProvider from './authentication/authProvider' -import { AuthContext } from 'authentication/authContext' const App = () => { - const userinfo = useContext(AuthContext) - console.log(userinfo) return ( diff --git a/src/authentication/authProvider.tsx b/src/authentication/authProvider.tsx index d0283d1a..a5f31296 100644 --- a/src/authentication/authProvider.tsx +++ b/src/authentication/authProvider.tsx @@ -3,7 +3,7 @@ import { useEffect, useState } from "react"; import { AuthContext } from "./authContext"; import { auth } from "../firebase"; -type IChildren = { +interface IChildren { children : React.JSX.Element } @@ -12,7 +12,7 @@ const AuthProvider = ({ children }: IChildren) => { useEffect(() => { const subscribe = auth.onAuthStateChanged(fbUser => { - console.log(`구독 실행`, fbUser); + console.log(`현재 유저 정보`, fbUser); setUser(fbUser); }); return subscribe; diff --git a/src/components/Header.tsx b/src/components/Header.tsx index f81ba0c8..73d9fc94 100644 --- a/src/components/Header.tsx +++ b/src/components/Header.tsx @@ -2,10 +2,15 @@ import React, { useEffect, useState, useContext } from 'react' import styled from 'styled-components' import { Link } from 'react-router-dom' import './Header.css' +import { AuthContext } from 'authentication/authContext'; +import { signOut } from 'firebase/auth' +import { auth } from '../firebase' const Header = () => { const pageLink = ["", "Wiki/", "Gallery"] const pageName = ["Home", "Wiki", "Gallery"] + const user = useContext(AuthContext) + return ( @@ -17,12 +22,16 @@ const Header = () => { ) } -
  • 로그인
  • +
  • {(user?.displayName) ? <>{user.displayName}님 : 로그인 }
  • ) } +const handlerLogout = () => { + signOut(auth); +} + const Container = styled.nav` position: fixed; left: 0; diff --git a/src/pages/Login.tsx b/src/pages/Login.tsx index 0c83c3a9..ef3e0320 100644 --- a/src/pages/Login.tsx +++ b/src/pages/Login.tsx @@ -9,7 +9,6 @@ const Login = () => { const user = useContext(AuthContext); const [email, setEmail] = useState(""); const [pwd, setPwd] = useState(""); - const [isCreate, setIsCreate] = useState(false); const handleEmail = (e: React.ChangeEvent) => { e.preventDefault(); @@ -27,8 +26,6 @@ const Login = () => { signInWithEmailAndPassword(auth, email, pwd) .then(() => { alert("로그인 성공"); - - console.log(user) // 메인 홈으로 이동 }) .catch(e => { diff --git a/src/pages/SignUp.tsx b/src/pages/SignUp.tsx index 5fbc9bb6..819f2778 100644 --- a/src/pages/SignUp.tsx +++ b/src/pages/SignUp.tsx @@ -1,15 +1,15 @@ import { AuthContext } from 'authentication/authContext'; import { auth } from '../firebase'; -import { createUserWithEmailAndPassword, updateProfile } from 'firebase/auth'; +import { createUserWithEmailAndPassword, signOut, updateProfile } from 'firebase/auth'; import React, { useContext, useState } from 'react' import styled from 'styled-components' +import { useLocation } from 'react-router-dom'; -const SignIn = () => { - const user = useContext(AuthContext); +const SignUp = () => { const [email, setEmail] = useState(""); const [pwd, setPwd] = useState(""); const [nickname, setNickname] = useState(""); - + const user = useContext(AuthContext) const handleEmail = (e: React.ChangeEvent) => { e.preventDefault() setEmail(e.target.value) @@ -35,9 +35,10 @@ const SignIn = () => { displayName: nickname }) } - + signOut(auth) alert('회원가입이 완료됐습니다.') - + // 로그인 페이지로 이동 + }catch(e){ alert(e) } @@ -46,13 +47,13 @@ const SignIn = () => { return ( -

    로그인

    +

    회원 가입

    @@ -69,4 +70,4 @@ const Container = styled.main` box-sizing: border-box; ` -export default SignIn \ No newline at end of file +export default SignUp \ No newline at end of file From 742869136cea99079cc0ddbc6f9dad68a93937b8 Mon Sep 17 00:00:00 2001 From: TaePoong719 Date: Tue, 12 Sep 2023 16:05:42 +0900 Subject: [PATCH 08/14] =?UTF-8?q?Feat:=20=EB=8B=89=EB=84=A4=EC=9E=84?= =?UTF-8?q?=EC=9D=B4=20=EA=B8=B8=20=EA=B2=BD=EC=9A=B0=20slicing=20?= =?UTF-8?q?=ED=95=B4=EC=A3=BC=EB=8A=94=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Header.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/Header.tsx b/src/components/Header.tsx index ebfe8092..bef4ae93 100644 --- a/src/components/Header.tsx +++ b/src/components/Header.tsx @@ -23,13 +23,17 @@ const Header = () => { ) } -
  • {(user?.displayName) ? <>{user.displayName}님 : 로그인 }
  • +
  • {(user?.displayName) ? <>{sliceStr(user.displayName, 10)}님 : 로그인 }
  • ) } +const sliceStr = (str:string, n:number) => { + return str.length>=n ? str.slice(0,n+1)+ "..." : str +} + const handlerLogout = () => { signOut(auth); } From abb39d99ddbd4246baa1c5536eebaa30789902b1 Mon Sep 17 00:00:00 2001 From: TaePoong719 Date: Tue, 12 Sep 2023 17:03:02 +0900 Subject: [PATCH 09/14] =?UTF-8?q?Feat:=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20UI?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Authentication.css | 28 +++++++++++++++++++++++++++ src/pages/Login.tsx | 32 ++++++++++++++++++++----------- src/pages/SignUp.tsx | 37 ++++++++++++++++++------------------ 3 files changed, 68 insertions(+), 29 deletions(-) create mode 100644 src/pages/Authentication.css diff --git a/src/pages/Authentication.css b/src/pages/Authentication.css new file mode 100644 index 00000000..1b34b528 --- /dev/null +++ b/src/pages/Authentication.css @@ -0,0 +1,28 @@ +.authentication__form{ + display: flex; + flex-flow: column; + gap: 30px; + margin-bottom: 40px; +} + +.authentication__form-el{ + display: flex; +} + +.authentication__form-el label{ + flex: 0 0 80px; + height: 30px; +} + +.authentication__form .btn{ + width: 175px; + height: 48px; + margin: 20px auto; + background-color: var(--main-color); + color: #fff; + border: none; + border-radius: 5px; + box-sizing: border-box; + cursor: pointer; +} + diff --git a/src/pages/Login.tsx b/src/pages/Login.tsx index ef3e0320..ea03664f 100644 --- a/src/pages/Login.tsx +++ b/src/pages/Login.tsx @@ -1,14 +1,15 @@ -import React, { useContext, useState } from 'react' +import React, { useState } from 'react' import styled from 'styled-components' import { auth } from '../firebase' -import { AuthContext } from 'authentication/authContext'; import { Link } from 'react-router-dom'; import { signInWithEmailAndPassword } from 'firebase/auth'; +import { useNavigate } from 'react-router-dom'; +import './Authentication.css' const Login = () => { - const user = useContext(AuthContext); const [email, setEmail] = useState(""); const [pwd, setPwd] = useState(""); + const navigate = useNavigate() const handleEmail = (e: React.ChangeEvent) => { e.preventDefault(); @@ -26,7 +27,7 @@ const Login = () => { signInWithEmailAndPassword(auth, email, pwd) .then(() => { alert("로그인 성공"); - // 메인 홈으로 이동 + navigate("/") }) .catch(e => { alert(e); @@ -35,14 +36,14 @@ const Login = () => { return ( -

    로그인

    -
    - - - - +

    로그인

    + +
    +
    + +
    - 회원가입 + 회원가입
    ) } @@ -56,6 +57,15 @@ const Container = styled.main` border: 2px solid black; padding : 20px 5px; box-sizing: border-box; + display: flex; + flex-flow: column; + align-items: center; + h1{ + margin-bottom:5rem; + } + b{ + text-decoration: underline solid black 1.5px ; + } ` export default Login \ No newline at end of file diff --git a/src/pages/SignUp.tsx b/src/pages/SignUp.tsx index 819f2778..af156534 100644 --- a/src/pages/SignUp.tsx +++ b/src/pages/SignUp.tsx @@ -1,15 +1,16 @@ -import { AuthContext } from 'authentication/authContext'; import { auth } from '../firebase'; import { createUserWithEmailAndPassword, signOut, updateProfile } from 'firebase/auth'; -import React, { useContext, useState } from 'react' +import React, { useState } from 'react' import styled from 'styled-components' -import { useLocation } from 'react-router-dom'; +import { useNavigate } from 'react-router-dom'; +import './Authentication.css' const SignUp = () => { const [email, setEmail] = useState(""); const [pwd, setPwd] = useState(""); const [nickname, setNickname] = useState(""); - const user = useContext(AuthContext) + const navigate = useNavigate() + const handleEmail = (e: React.ChangeEvent) => { e.preventDefault() setEmail(e.target.value) @@ -25,36 +26,31 @@ const SignUp = () => { setNickname(e.target.value) } - const handleClickCreate = async (e: React.MouseEvent) => { + const handleClickCreate = async (e: React.FormEvent) => { e.preventDefault(); try{ const userCredential = await createUserWithEmailAndPassword(auth, email, pwd) if(userCredential){ - console.log(userCredential) await updateProfile(userCredential.user, { displayName: nickname }) } signOut(auth) alert('회원가입이 완료됐습니다.') - // 로그인 페이지로 이동 - + navigate("/login") }catch(e){ alert(e) } } - return ( -

    회원 가입

    -
    - - - - +

    회원 가입

    + +
    +
    +
    +
    ) @@ -68,6 +64,11 @@ const Container = styled.main` border: 2px solid black; padding : 20px 5px; box-sizing: border-box; + display: flex; + flex-flow: column; + align-items: center; + h1{ + margin-bottom:5rem; + } ` - export default SignUp \ No newline at end of file From 250865957444bb96f8427670c66a00f50b34b1f8 Mon Sep 17 00:00:00 2001 From: TaePoong719 Date: Tue, 12 Sep 2023 17:20:48 +0900 Subject: [PATCH 10/14] =?UTF-8?q?Design:=20login/signup=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=A7=80=20=EB=94=94=EC=9E=90=EC=9D=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Login.tsx | 3 ++- src/pages/SignUp.tsx | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pages/Login.tsx b/src/pages/Login.tsx index ea03664f..a3458bc8 100644 --- a/src/pages/Login.tsx +++ b/src/pages/Login.tsx @@ -54,7 +54,8 @@ const Container = styled.main` width: 90%; max-width: 800px; height: 500px; - border: 2px solid black; + border: 1.5px solid var(--main-color); + border-radius: 0.8rem; padding : 20px 5px; box-sizing: border-box; display: flex; diff --git a/src/pages/SignUp.tsx b/src/pages/SignUp.tsx index af156534..975507d2 100644 --- a/src/pages/SignUp.tsx +++ b/src/pages/SignUp.tsx @@ -61,7 +61,8 @@ const Container = styled.main` width: 90%; max-width: 800px; height: 500px; - border: 2px solid black; + border: 1.5px solid var(--main-color); + border-radius: 0.8rem; padding : 20px 5px; box-sizing: border-box; display: flex; From ef99eacb5f7da740405b51f85c64a686aec1aeab Mon Sep 17 00:00:00 2001 From: TaePoong719 Date: Tue, 12 Sep 2023 17:26:27 +0900 Subject: [PATCH 11/14] =?UTF-8?q?Design:=20login/signup=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=A7=80=20=EB=A0=88=EC=9D=B4=EC=95=84=EC=9B=83=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Authentication.css | 5 +++++ src/pages/Login.tsx | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pages/Authentication.css b/src/pages/Authentication.css index 1b34b528..ed9dcad5 100644 --- a/src/pages/Authentication.css +++ b/src/pages/Authentication.css @@ -3,6 +3,7 @@ flex-flow: column; gap: 30px; margin-bottom: 40px; + width: 300px; } .authentication__form-el{ @@ -14,6 +15,10 @@ height: 30px; } +.authentication__form-el input{ + flex: 0 0 200px; +} + .authentication__form .btn{ width: 175px; height: 48px; diff --git a/src/pages/Login.tsx b/src/pages/Login.tsx index a3458bc8..6e360ec4 100644 --- a/src/pages/Login.tsx +++ b/src/pages/Login.tsx @@ -40,7 +40,6 @@ const Login = () => {
    -
    회원가입 From 2222438a3b997b4f53222387b9d2e90d6061a767 Mon Sep 17 00:00:00 2001 From: TaePoong719 Date: Tue, 12 Sep 2023 17:43:21 +0900 Subject: [PATCH 12/14] =?UTF-8?q?Feat:=20=EB=AA=A8=EB=8B=AC=20=EB=B2=84?= =?UTF-8?q?=ED=8A=BC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Header.tsx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/components/Header.tsx b/src/components/Header.tsx index bef4ae93..cbcaaa46 100644 --- a/src/components/Header.tsx +++ b/src/components/Header.tsx @@ -23,7 +23,8 @@ const Header = () => { ) } -
  • {(user?.displayName) ? <>{sliceStr(user.displayName, 10)}님 : 로그인 }
  • +
  • 학습 시간

  • +
  • {(user?.displayName) ? <>{sliceStr(user.displayName, 10)}님 : 로그인 }
  • @@ -37,6 +38,19 @@ const sliceStr = (str:string, n:number) => { const handlerLogout = () => { signOut(auth); } + +const StyledButton = styled.button` + color: var(--main-color); + border: 0.8px solid var(--main-color); + border-radius: 5px; + width: 100px; + height: 35px; + background-color: #ffff; + p{ + margin: 0 auto; + } +` + const InnerContainer = styled.div` margin: 0 auto; max-width: 1200px; From 3ecdeeb25b2e7fdbe890795a515175faab7c7974 Mon Sep 17 00:00:00 2001 From: TaePoong719 Date: Tue, 12 Sep 2023 18:47:26 +0900 Subject: [PATCH 13/14] =?UTF-8?q?Feat:=20=ED=98=84=EC=9E=AC=20=EB=9D=BC?= =?UTF-8?q?=EC=9A=B0=ED=84=B0=20=ED=97=A4=EB=8D=94=EC=97=90=20=EC=83=89?= =?UTF-8?q?=EA=B9=94=20=EA=B5=AC=ED=98=84=20&=20Header=20Style=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Header.css | 6 ------ src/components/Header.tsx | 45 ++++++++++++++++++++++++++++++++------- src/index.css | 5 +++++ 3 files changed, 42 insertions(+), 14 deletions(-) delete mode 100644 src/components/Header.css diff --git a/src/components/Header.css b/src/components/Header.css deleted file mode 100644 index 46aa3f56..00000000 --- a/src/components/Header.css +++ /dev/null @@ -1,6 +0,0 @@ -.header__link-wrapper{ - display:flex; - justify-content: flex-end; - margin-right: 3rem; - gap: 20px; -} \ No newline at end of file diff --git a/src/components/Header.tsx b/src/components/Header.tsx index cbcaaa46..9a9bd08e 100644 --- a/src/components/Header.tsx +++ b/src/components/Header.tsx @@ -1,30 +1,43 @@ import React, { useEffect, useState, useContext } from 'react' import styled from 'styled-components' -import { Link } from 'react-router-dom' +import { Link, useLocation } from 'react-router-dom' import './Header.css' import { AuthContext } from 'authentication/authContext'; import { signOut } from 'firebase/auth' import { auth } from '../firebase' const Header = () => { - const pageLink = ["", "Wiki/", "Gallery"] + const pageLink = ["", "Wiki", "Gallery"] const pageName = ["Home", "Wiki", "Gallery"] const user = useContext(AuthContext) + const [pathLink, setPathLink ] = useState("") + const location = useLocation() + useEffect(()=>{ + setPathLink(location.pathname.split("/")[1]) + },[location]) return (
      { - pageLink.map((link,idx)=> -
    • - {pageName[idx]} -
    • + pageLink.map((link,idx)=>{ + let name = "" + if(pathLink === pageLink[idx]) name += "active" + return( +
    • +

      {pageName[idx]}

      +
    • + ) + } + ) }
    • 학습 시간

    • -
    • {(user?.displayName) ? <>{sliceStr(user.displayName, 10)}님 : 로그인 }
    • +
    • {(user?.displayName) + ? <>{sliceStr(user.displayName, 10)}님 + :

      로그인

      }
    @@ -46,6 +59,7 @@ const StyledButton = styled.button` width: 100px; height: 35px; background-color: #ffff; + cursor: pointer; p{ margin: 0 auto; } @@ -54,7 +68,6 @@ const StyledButton = styled.button` const InnerContainer = styled.div` margin: 0 auto; max-width: 1200px; - ` const Container = styled.nav` @@ -68,6 +81,22 @@ const Container = styled.nav` font-size: 1rem; z-index: 10; background-color: #fff; + h1{ + font-size: 1.2rem; + } + h2{ + font-size: 0.9rem; + } + .active{ + color: var(--main-color); + } + .header__link-wrapper{ + display:flex; + justify-content: flex-end; + margin-right: 3rem; + gap: 20px; + align-items: center; + } ` export default Header \ No newline at end of file diff --git a/src/index.css b/src/index.css index caac0740..6072e848 100644 --- a/src/index.css +++ b/src/index.css @@ -8,6 +8,11 @@ body { margin: 0; } +ul{ + margin:0; + padding: 0; +} + li{ list-style: none; } From f3c1188aaca955ac9916f765e392775e5c280816 Mon Sep 17 00:00:00 2001 From: TaePoong719 Date: Tue, 12 Sep 2023 18:48:01 +0900 Subject: [PATCH 14/14] =?UTF-8?q?Fix:=20import=20css=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Header.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/Header.tsx b/src/components/Header.tsx index 9a9bd08e..a3f4059d 100644 --- a/src/components/Header.tsx +++ b/src/components/Header.tsx @@ -1,7 +1,6 @@ import React, { useEffect, useState, useContext } from 'react' import styled from 'styled-components' import { Link, useLocation } from 'react-router-dom' -import './Header.css' import { AuthContext } from 'authentication/authContext'; import { signOut } from 'firebase/auth' import { auth } from '../firebase'