Files
a301_client/src/components/DownloadSection.jsx
tolelom 7e2f9419ab
All checks were successful
Client CI/CD / deploy (push) Successful in 12s
Add frontend pages with login, download, and announcements
- React Router v7: public home page, /login page
- Auth context with JWT localStorage management
- Login: ID/PW form + SSAFY login button (UI only)
- Home: hero banner, download section (login required), announcement board
- API layer with mock data (ready for Go Fiber backend)
- Color scheme: #2E2C2F dark + #BACDB0 accent
- Add .env.example for environment variable reference

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 12:40:29 +09:00

39 lines
1.1 KiB
JavaScript

import { useState, useEffect } from 'react';
import { useNavigate } from 'react-router-dom';
import { useAuth } from '../context/AuthContext';
import { getDownloadInfo } from '../api/download';
import './DownloadSection.css';
export default function DownloadSection() {
const [info, setInfo] = useState(null);
const { user } = useAuth();
const navigate = useNavigate();
useEffect(() => {
getDownloadInfo().then(setInfo);
}, []);
const handleDownload = (e) => {
if (!user) {
e.preventDefault();
navigate('/login');
}
};
if (!info) return null;
return (
<section className="download-section">
<div className="download-content">
<h2 className="download-title">게임 런처 다운로드</h2>
<p className="download-meta">
{info.fileName} &middot; {info.fileSize} &middot; {info.version}
</p>
<a href={info.url} download onClick={handleDownload} className="btn-download">
{user ? '다운로드' : '로그인 후 다운로드'}
</a>
</div>
</section>
);
}