Skip to content

Commit

Permalink
πŸ—‘οΈ Chore : μ„Έμ…˜ μŠ€ν† λ¦¬μ§€ μ‚¬μš©ν•˜μ—¬ μŠ€ν”Œλž˜μ‹œ 슀크린 ν‘œμ‹œ (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
g89g6 committed Oct 2, 2024
1 parent 3f1b634 commit a394ba6
Show file tree
Hide file tree
Showing 96 changed files with 3,735 additions and 91 deletions.
39 changes: 31 additions & 8 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,42 @@
import React, { useState, useEffect } from 'react'
import { Routes, Route, Navigate, useNavigate } from 'react-router-dom'
import SplashScreen from '@pages/SplashScreen/SplashScreen'
import PostDetail from '@pages/PostDetail/PostDetail'
import { Routes, Route } from 'react-router-dom'
import PostDetailPage from '@pages/PostDetail/PostDetailPage'
import MyPage from './pages/MyPage/MyPage'
import PostCreate from './pages/PostCreate/PostCreate'
import NotificationPage from './pages/NotificationPage/NotificationPage'
import PostList from './pages/PostList/List'

const App = () => {
const [isFirstVisit, setIsFirstVisit] = useState(true)
const navigate = useNavigate()

useEffect(() => {
// μ„Έμ…˜ μŠ€ν† λ¦¬μ§€λ₯Ό μ‚¬μš©
const hasVisitedBefore = sessionStorage.getItem('hasVisitedBefore')
if (!hasVisitedBefore) {
sessionStorage.setItem('hasVisitedBefore', 'true')
navigate('/splash')
} else {
setIsFirstVisit(false)
}
}, [navigate])

return (
<Routes>
<Route
path="/"
element={<SplashScreen />} />
<Route
path='/postdetail'
element={<PostDetail />}
<Route path="/splash" element={<SplashScreen />} />
<Route path='/postdetail' element={<PostDetailPage />} />
<Route path='/my' element={<MyPage />} />
<Route path='/create-post' element={<PostCreate />} />
<Route path='/notification' element={<NotificationPage />} />
<Route path='/' element={<PostList />} />
<Route
path="*"
element={<Navigate to={isFirstVisit ? "/splash" : "/"} replace />}
/>
</Routes>
)
}

export default App
export default App
10 changes: 10 additions & 0 deletions src/assets/icons/details_reply.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/icons/dropup_button.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/assets/icons/heart_before_select.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions src/assets/icons/list_notification.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/icons/next_button.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions src/components/Bedge/Bedge.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
.bedge {
display: flex;
align-content: center;
justify-content: center;
width: 50px;
height: 24px;
margin-right: 5px;
Expand Down Expand Up @@ -31,3 +34,8 @@
background: #dbeddb;
color: #1c3829;
}

#author {
background: #dbeddb;
color: #1c3829;
}
6 changes: 3 additions & 3 deletions src/components/Bedge/Bedge.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import './Bedge.css'

interface BedgeProps {
type: 'mbti' | 'agree' | 'disagree' | 'best' | 'type'
type: 'mbti' | 'agree' | 'disagree' | 'best' | 'type' | 'author'
body: string
}

Expand All @@ -14,12 +14,12 @@ interface BedgeProps {

const Bedge = ({ type, body }: BedgeProps) => {
return (
<button
<div
className='bedge'
id={type}
>
{body}
</button>
</div>
)
}

Expand Down
1 change: 1 addition & 0 deletions src/components/BottomModal/BottomModal.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
border-top-left-radius: 20px;
border-top-right-radius: 20px;
box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
z-index: 9999;

.bottom-modal-line {
width: 50px;
Expand Down
16 changes: 14 additions & 2 deletions src/components/Conatiner/Container.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
import './Container.css'

const Container = ({ children }: { children: JSX.Element | JSX.Element[] }) => {
return <div className='container'>{children}</div>
interface ContainerProps {
children: React.ReactNode
pageName?: string
}

const Container = ({ children, pageName }: ContainerProps) => {
return (
<div
className='container'
id={pageName}
>
{children}
</div>
)
}

export default Container
108 changes: 108 additions & 0 deletions src/components/MbtiSelector/MbtiSelector.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
.mbti-container {
max-width: 500px;
margin: 0 auto;
padding: 20px;
background-color: white;
}

.mbti-title {
font-size: 24px;
font-weight: bold;
margin-bottom: 20px;
text-align: left;
}

.mbti-flex-container {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
gap: 20px;
}

.mbti-row {
flex: 0 0 calc(50% - 10px);
display: flex;
flex-direction: column;
align-items: center;
}

.mbti-label {
font-size: 14px;
font-weight: 500;
margin-bottom: 8px;
}

.mbti-slider {
position: relative;
height: 40px;
width: 200px;
background-color: #fff;
border-radius: 16px;
cursor: pointer;
overflow: hidden;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1), 0 4px 8px rgba(0, 0, 0, 0.05);
transition: box-shadow 0.3s ease-in-out;
}

.mbti-slider:hover {
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15), 0 6px 12px rgba(0, 0, 0, 0.1);
}

.mbti-slider-option {
z-index: 1;
font-size: 12px;
font-weight: bold;
color: #4b5563;
transition: color 0.3s ease-in-out;
width: 50%;
text-align: center;
padding: 0 5px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}

.mbti-slider-button {
position: absolute;
width: 50%;
height: calc(100% - 4px);
top: 2px;
background-color: #FD3747;
border-radius: 14px;
transition: all 0.3s ease-in-out;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.mbti-slider.left .mbti-slider-button {
left: 2px;
}

.mbti-slider.right .mbti-slider-button {
left: calc(50% - 2px);
}

.mbti-slider.left .mbti-slider-option.left,
.mbti-slider.right .mbti-slider-option.right {
color: white;
}

.mbti-result {
margin-top: 24px;
text-align: center;
}

.mbti-result p {
font-size: 18px;
font-weight: 600;
}

.mbti-result-text {
color: #ef4444;
font-weight: bold;
}


91 changes: 91 additions & 0 deletions src/components/MbtiSelector/MbtiSelector.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
import { useState } from 'react';
import './MbtiSelector.css';

type MbtiType = 'EI' | 'SN' | 'TF' | 'JP';

interface MbtiState {
[key: string]: boolean;
}

interface MbtiRowProps {
label: string;
leftOption: string;
rightOption: string;
isRight: boolean;
onChange: () => void;
}

const MbtiSelector = () => {
const [mbti, setMbti] = useState<MbtiState>({
EI: false,
SN: false,
TF: false,
JP: false
});

const updateMbti = (key: MbtiType) => {
setMbti((prev) => ({ ...prev, [key]: !prev[key] }));
};

const getMbtiResult = (): string => {
return (
(mbti.EI ? 'I' : 'E') +
(mbti.SN ? 'N' : 'S') +
(mbti.TF ? 'F' : 'T') +
(mbti.JP ? 'P' : 'J')
);
};

return (
<div className="mbti-container">

<div className="mbti-flex-container">
<MbtiRow
label="μ—λ„ˆμ§€μ˜ λ°©ν–₯"
leftOption="E (μ™Έν–₯ν˜•)"
rightOption="I (λ‚΄ν–₯ν˜•)"
isRight={mbti.EI}
onChange={() => updateMbti('EI')}
/>
<MbtiRow
label="인식 방식"
leftOption="S (κ°κ°ν˜•)"
rightOption="N (μ§κ΄€ν˜•)"
isRight={mbti.SN}
onChange={() => updateMbti('SN')}
/>
<MbtiRow
label="κ²°μ • 방식"
leftOption="T (μ‚¬κ³ ν˜•)"
rightOption="F (κ°μ •ν˜•)"
isRight={mbti.TF}
onChange={() => updateMbti('TF')}
/>
<MbtiRow
label="μ‚Άμ˜ νŒ¨ν„΄"
leftOption="J (νŒλ‹¨ν˜•)"
rightOption="P (μΈμ‹ν˜•)"
isRight={mbti.JP}
onChange={() => updateMbti('JP')}
/>
</div>

<div className="mbti-result">
<p>μ„ νƒλœ MBTI <span className="mbti-result-text">{getMbtiResult()}</span></p>
</div>
</div>
);
};

const MbtiRow: React.FC<MbtiRowProps> = ({ label, leftOption, rightOption, isRight, onChange }) => (
<div className="mbti-row">
<span className="mbti-label">{label}</span>
<div className={`mbti-slider ${isRight ? 'right' : 'left'}`} onClick={onChange}>
<div className="mbti-slider-option left">{leftOption}</div>
<div className="mbti-slider-button"></div>
<div className="mbti-slider-option right">{rightOption}</div>
</div>
</div>
);

export default MbtiSelector;
14 changes: 14 additions & 0 deletions src/components/Navigatior/Navigator.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,17 @@
background-color: #fff;
z-index: 999;
}

.nav-button {
background: none;
border: none;
cursor: pointer;
padding: 0;
display: flex;
align-items: center;
justify-content: center;
}

.nav-button:focus {
outline: none;
}
Loading

0 comments on commit a394ba6

Please sign in to comment.