-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
2,016 additions
and
147 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module.exports = { | ||
plugins: { | ||
tailwindcss: {}, | ||
autoprefixer: {}, | ||
}, | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,16 @@ | ||
import { useState } from 'react' | ||
import reactLogo from './assets/react.svg' | ||
import viteLogo from '/vite.svg' | ||
import './App.css' | ||
|
||
function App() { | ||
const [count, setCount] = useState(0) | ||
import React from 'react'; | ||
import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom'; | ||
import LoginPage from './pages/LoginPage'; | ||
|
||
const App = () => { | ||
return ( | ||
<> | ||
<div> | ||
<a href="https://vite.dev" target="_blank"> | ||
<img src={viteLogo} className="logo" alt="Vite logo" /> | ||
</a> | ||
<a href="https://react.dev" target="_blank"> | ||
<img src={reactLogo} className="logo react" alt="React logo" /> | ||
</a> | ||
</div> | ||
<h1>Vite + React</h1> | ||
<div className="card"> | ||
<button onClick={() => setCount((count) => count + 1)}> | ||
count is {count} | ||
</button> | ||
<p> | ||
Edit <code>src/App.tsx</code> and save to test HMR | ||
</p> | ||
</div> | ||
<p className="read-the-docs"> | ||
Click on the Vite and React logos to learn more | ||
</p> | ||
</> | ||
) | ||
} | ||
<BrowserRouter> | ||
<Routes> | ||
<Route path="/login" element={<LoginPage />} /> | ||
<Route path="/" element={<Navigate to="/login" replace />} /> | ||
</Routes> | ||
</BrowserRouter> | ||
); | ||
}; | ||
|
||
export default App | ||
export default App |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import React from 'react'; | ||
|
||
const LoginBanner = () => { | ||
return ( | ||
<div className="w-[600px] relative bg-cover bg-center" style={{ | ||
backgroundImage: `url('https://nanu.cc/NANU-Brand-Loader.jpg')` | ||
}}> | ||
<div className="absolute top-10 left-10"> | ||
<h1 className="text-xl text-white mb-2 font-bold">최대 보안. 최대 편리함.</h1> | ||
<img src="https://nanu.cc/NANU_Brand_Logo/NANU_ID_FULL_XS.svg" alt="NAMU Logo" className="w-40" /> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default LoginBanner; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React from 'react'; | ||
|
||
interface LoginContainerProps { | ||
children: React.ReactNode; | ||
} | ||
|
||
const LoginContainer: React.FC<LoginContainerProps> = ({ children }) => { | ||
return ( | ||
<div className="min-h-screen w-full bg-gray-50 flex items-center justify-center py-8"> | ||
<div className="w-[1200px] h-[600px] bg-white shadow-lg overflow-hidden flex"> | ||
{children} | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default LoginContainer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import React from 'react'; | ||
import { Link } from 'react-router-dom'; | ||
|
||
interface LoginFormProps { | ||
formData: { | ||
email: string; | ||
password: string; | ||
rememberMe: boolean; | ||
}; | ||
onInputChange: (e: React.ChangeEvent<HTMLInputElement>) => void; | ||
onLogin: (type: 'app' | 'pin') => void; | ||
} | ||
|
||
const LoginForm: React.FC<LoginFormProps> = ({ formData, onInputChange, onLogin }) => { | ||
return ( | ||
<div className="flex-1 flex items-center justify-center p-8"> | ||
<div className="w-[360px]"> | ||
<h1 className="text-2xl font-bold mb-8">로그인</h1> | ||
<form className="space-y-6"> | ||
<div className="space-y-4"> | ||
<input | ||
type="email" | ||
name="email" | ||
placeholder="Enter Email" | ||
className="w-full px-0 py-2 border-b border-gray-300 focus:border-blue-500 focus:outline-none transition-colors" | ||
value={formData.email} | ||
onChange={onInputChange} | ||
/> | ||
<input | ||
type="password" | ||
name="password" | ||
placeholder="Enter Password" | ||
className="w-full px-0 py-2 border-b border-gray-300 focus:border-blue-500 focus:outline-none transition-colors" | ||
value={formData.password} | ||
onChange={onInputChange} | ||
/> | ||
</div> | ||
|
||
<div className="flex items-center"> | ||
<input | ||
type="checkbox" | ||
name="rememberMe" | ||
id="rememberMe" | ||
checked={formData.rememberMe} | ||
onChange={onInputChange} | ||
className="h-4 w-4 text-blue-600 rounded border-gray-300" | ||
/> | ||
<label htmlFor="rememberMe" className="ml-2 text-sm text-gray-600"> | ||
로그인 정보 저장하기 | ||
</label> | ||
</div> | ||
|
||
<div className="space-y-3 pt-4"> | ||
<button | ||
type="button" | ||
onClick={() => onLogin('app')} | ||
className="w-full bg-blue-600 text-white py-3 rounded hover:bg-blue-700 transition-colors" | ||
> | ||
APP 인증 로그인하기 | ||
</button> | ||
<button | ||
type="button" | ||
onClick={() => onLogin('pin')} | ||
className="w-full bg-blue-600 text-white py-3 rounded hover:bg-blue-700 transition-colors" | ||
> | ||
PIN 인증 로그인하기 | ||
</button> | ||
</div> | ||
</form> | ||
|
||
<div className="mt-8 text-center text-sm text-gray-600"> | ||
계정이 없으신가요? <Link to="/signup" className="text-blue-600 hover:underline">NAMU ID 생성하기</Link> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default LoginForm; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,26 @@ | ||
:root { | ||
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif; | ||
line-height: 1.5; | ||
font-weight: 400; | ||
@tailwind base; | ||
@tailwind components; | ||
@tailwind utilities; | ||
|
||
color-scheme: light dark; | ||
color: rgba(255, 255, 255, 0.87); | ||
background-color: #242424; | ||
|
||
font-synthesis: none; | ||
text-rendering: optimizeLegibility; | ||
-webkit-font-smoothing: antialiased; | ||
-moz-osx-font-smoothing: grayscale; | ||
@font-face { | ||
font-family: 'Paperlogy-8Regular'; | ||
src: url('https://fastly.jsdelivr.net/gh/projectnoonnu/[email protected]/Paperlogy-8Regular.woff2') format('woff2'); | ||
font-weight: 300; | ||
font-style: normal; | ||
} | ||
|
||
a { | ||
font-weight: 500; | ||
color: #646cff; | ||
text-decoration: inherit; | ||
} | ||
a:hover { | ||
color: #535bf2; | ||
@font-face { | ||
font-family: 'Paperlogy-8ExtraBold'; | ||
src: url('https://fastly.jsdelivr.net/gh/projectnoonnu/[email protected]/Paperlogy-8ExtraBold.woff2') format('woff2'); | ||
font-weight: 800; | ||
font-style: normal; | ||
} | ||
|
||
body { | ||
margin: 0; | ||
display: flex; | ||
place-items: center; | ||
min-width: 320px; | ||
min-height: 100vh; | ||
* { | ||
font-family: 'Paperlogy-8Regular'; | ||
font-weight: 300; | ||
} | ||
|
||
h1 { | ||
font-size: 3.2em; | ||
line-height: 1.1; | ||
} | ||
|
||
button { | ||
border-radius: 8px; | ||
border: 1px solid transparent; | ||
padding: 0.6em 1.2em; | ||
font-size: 1em; | ||
font-weight: 500; | ||
font-family: inherit; | ||
background-color: #1a1a1a; | ||
cursor: pointer; | ||
transition: border-color 0.25s; | ||
} | ||
button:hover { | ||
border-color: #646cff; | ||
} | ||
button:focus, | ||
button:focus-visible { | ||
outline: 4px auto -webkit-focus-ring-color; | ||
} | ||
|
||
@media (prefers-color-scheme: light) { | ||
:root { | ||
color: #213547; | ||
background-color: #ffffff; | ||
} | ||
a:hover { | ||
color: #747bff; | ||
} | ||
button { | ||
background-color: #f9f9f9; | ||
} | ||
} | ||
.font-bold { | ||
font-family: 'Paperlogy-8ExtraBold'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import React, { useState } from 'react'; | ||
import { useNavigate } from 'react-router-dom'; | ||
import LoginContainer from '../components/auth/LoginContainer'; | ||
import LoginBanner from '../components/auth/LoginBanner'; | ||
import LoginForm from '../components/auth/LoginForm'; | ||
|
||
interface LoginFormData { | ||
email: string; | ||
password: string; | ||
rememberMe: boolean; | ||
} | ||
|
||
const LoginPage = () => { | ||
const [formData, setFormData] = useState<LoginFormData>({ | ||
email: '', | ||
password: '', | ||
rememberMe: false | ||
}); | ||
|
||
const navigate = useNavigate(); | ||
|
||
const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => { | ||
const { name, value, type, checked } = e.target; | ||
setFormData(prev => ({ | ||
...prev, | ||
[name]: type === 'checkbox' ? checked : value | ||
})); | ||
}; | ||
|
||
const handleLogin = (type: 'app' | 'pin') => { | ||
// TODO: Implement login logic | ||
console.log(`Logging in with ${type}`, formData); | ||
}; | ||
|
||
return ( | ||
<LoginContainer> | ||
<LoginBanner /> | ||
<LoginForm | ||
formData={formData} | ||
onInputChange={handleInputChange} | ||
onLogin={handleLogin} | ||
/> | ||
</LoginContainer> | ||
); | ||
}; | ||
|
||
export default LoginPage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { LoginFormData, AuthResponse } from '../types/Auth'; | ||
|
||
export const authService = { | ||
async login(credentials: LoginFormData): Promise<AuthResponse> { | ||
try { | ||
const response = await fetch('/api/auth/login', { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
body: JSON.stringify(credentials), | ||
}); | ||
|
||
if (!response.ok) { | ||
throw new Error('Login failed'); | ||
} | ||
|
||
return response.json(); | ||
} catch (error) { | ||
throw error; | ||
} | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
export interface LoginFormData { | ||
email: string; | ||
password: string; | ||
rememberMe: boolean; | ||
} | ||
|
||
export interface AuthResponse { | ||
token: string; | ||
user: { | ||
id: string; | ||
email: string; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/** @type {import('tailwindcss').Config} */ | ||
export default { | ||
content: [ | ||
"./index.html", | ||
"./src/**/*.{js,ts,jsx,tsx}", | ||
], | ||
theme: { | ||
extend: {}, | ||
}, | ||
plugins: [], | ||
} | ||
|
Oops, something went wrong.