Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/components/building/BuildingDescription.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import './css/BuildingDescription.css';
import buildingboxBackground from '../../assets/images/building-description-background.png';
import ReusableButton from '../buttons/ReusableButton';

interface Props {
onSwitch: () => void;
}

const BuildingDescription: React.FC<Props> = ({ onSwitch }) => {
return (
<div className="building-description" style={{ backgroundImage: `url(${buildingboxBackground})` }}>
<div
className="building-description"
style={{ backgroundImage: `url(${buildingboxBackground})` }}
>
<div className="building-description-text-group">
<h1>건물용</h1>
<p>
Expand All @@ -17,7 +21,9 @@ const BuildingDescription: React.FC<Props> = ({ onSwitch }) => {
<p className="warning">※ 서비스를 이용하려면 로그인 후 시작해 주세요.</p>
</div>

<button onClick={onSwitch}>구역 모드로 이동</button>
<ReusableButton onClick={onSwitch} className="building-description-button">
구역 모드로 이동
</ReusableButton>
</div>
);
};
Expand Down
20 changes: 13 additions & 7 deletions src/components/building/BuildingLoginCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import './css/BuildingLoginCard.css';
import { useState } from 'react';
import { useNavigate } from "react-router-dom";
import { adminLogin } from '../../apis/loginApi';
import ReusableInput from '../input/ReusableInput';
import ReusableButton from '../buttons/ReusableButton';

interface Props {
onSwitch: () => void;
Expand All @@ -22,7 +24,7 @@ const BuildingLoginCard: React.FC<Props> = ({ onSwitch: _, isExiting, direction,
username: adminId,
password: password,
});
const token = response.accessToken;
const token = response.accessToken;
if (token) {
localStorage.setItem("accessToken", token);
onLogin();
Expand All @@ -31,7 +33,7 @@ const BuildingLoginCard: React.FC<Props> = ({ onSwitch: _, isExiting, direction,
setError("로그인 실패: 엑세스 토큰이 없음");
}
} catch (error: any) {
setError(error.message);
setError(error.message);
}
};

Expand All @@ -48,27 +50,31 @@ const BuildingLoginCard: React.FC<Props> = ({ onSwitch: _, isExiting, direction,
>
<div
className={`building-card-content ${
isExiting
? 'building-fade-out-up' : 'building-fade-in-down'
isExiting ? 'building-fade-out-up' : 'building-fade-in-down'
}`}
>
<h2>건물용 로그인</h2>
<p className="description">건물 관리자 계정으로 로그인하세요.</p>
<form onSubmit={handleSubmit}>
<input
<ReusableInput
type="text"
placeholder="관리자 ID"
value={adminId}
onChange={(e) => setAdminId(e.target.value)}
className="building-login-input"
/>
<input
<ReusableInput
type="password"
placeholder="비밀번호"
value={password}
onChange={(e) => setPassword(e.target.value)}
showToggle
className="building-login-input"
/>
{error && <p className="error-message">{error}</p>}
<button type="submit">로그인</button>
<ReusableButton type="submit" className="building-login-button">
로그인
</ReusableButton>
</form>
</div>
</div>
Expand Down
3 changes: 1 addition & 2 deletions src/components/building/css/BuildingLoginCard.css
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,11 @@
}

.building-login-card input {
width:100%;
width: 300px;
padding: 10px 14px;
font-size: 1rem;
border: 1px solid #b0ccb0;
border-radius: 8px;
margin-bottom: 10px
}

.building-login-card button {
Expand Down
8 changes: 8 additions & 0 deletions src/components/input/css/ReusableInput.css
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,11 @@
.reusable-input-field::placeholder {
color: #aaa;
}

.reusable-input-icon {
position: absolute;
right: 12px;
top: 30%;
cursor: pointer;
color: #888;
}
5 changes: 4 additions & 1 deletion src/components/zone/ZoneDescription.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import './css/ZoneDescription.css';
import zoneboxBackground from '../../assets/images/zone-description-background.png';
import ReusableButton from '../buttons/ReusableButton';

interface Props {
onSwitch: () => void;
Expand All @@ -20,7 +21,9 @@ const ZoneDescription: React.FC<Props> = ({ onSwitch }) => {
<p className="warning">※ 서비스를 이용하려면 로그인 후 시작해 주세요.</p>
</div>

<button onClick={onSwitch}>건물 모드로 이동</button>
<ReusableButton onClick={onSwitch} className="zone-description-button">
건물 모드로 이동
</ReusableButton>
</div>
);
};
Expand Down
17 changes: 12 additions & 5 deletions src/components/zone/ZoneLoginCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import './css/ZoneLoginCard.css';
import { useState } from 'react';
import { useNavigate } from "react-router-dom";
import { adminLogin } from '../../apis/loginApi';
import ReusableInput from '../input/ReusableInput';
import ReusableButton from '../buttons/ReusableButton';

interface Props {
onSwitch: () => void;
Expand All @@ -22,7 +24,7 @@ const ZoneLoginCard: React.FC<Props> = ({ onSwitch: _, isExiting, direction, onL
username: adminId,
password: password,
});
const token = response.accessToken;
const token = response.accessToken;
if (token) {
localStorage.setItem("accessToken", token);
onLogin();
Expand All @@ -31,7 +33,7 @@ const ZoneLoginCard: React.FC<Props> = ({ onSwitch: _, isExiting, direction, onL
setError("로그인 실패: 엑세스 토큰이 없음");
}
} catch (error: any) {
setError(error.message);
setError(error.message);
}
};

Expand All @@ -54,20 +56,25 @@ const ZoneLoginCard: React.FC<Props> = ({ onSwitch: _, isExiting, direction, onL
<h2>구역용 로그인</h2>
<p className="description">구역 관리자 계정으로 로그인하세요.</p>
<form onSubmit={handleSubmit}>
<input
<ReusableInput
type="text"
placeholder="관리자 ID"
value={adminId}
onChange={(e) => setAdminId(e.target.value)}
className="zone-login-input"
/>
<input
<ReusableInput
type="password"
placeholder="비밀번호"
value={password}
onChange={(e) => setPassword(e.target.value)}
showToggle
className="zone-login-input"
/>
{error && <p className="error-message">{error}</p>}
<button type="submit">로그인</button>
<ReusableButton type="submit" className="zone-login-button">
로그인
</ReusableButton>
</form>
</div>
</div>
Expand Down
3 changes: 1 addition & 2 deletions src/components/zone/css/ZoneLoginCard.css
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,11 @@
}

.zone-login-card input {
width: 100%;
width: 300px;
padding: 10px 14px;
font-size: 1rem;
border: 1px solid #b0ccb0;
border-radius: 8px;
margin-bottom: 10px;
}

.zone-login-card button {
Expand Down