Skip to content

Commit

Permalink
Merge pull request #25 from 9oormDari/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Mintae Kim authored Sep 28, 2024
2 parents c19f982 + 2c0ad78 commit c48a064
Show file tree
Hide file tree
Showing 22 changed files with 517 additions and 58 deletions.
36 changes: 36 additions & 0 deletions src/assets/GoalPage/BlueCloud.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions src/assets/GoalPage/CloudDisk.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
55 changes: 55 additions & 0 deletions src/assets/GoalPage/ColorCloud.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions src/assets/GoalPage/Rainbow1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions src/assets/GoalPage/Rainbow2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file removed src/assets/data.json
Empty file.
95 changes: 95 additions & 0 deletions src/components/Goalpage/GoormScreen.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
import { useState } from 'react';
import cn from '../../lib/cn';
import BlueCloud from '../../assets/GoalPage/BlueCloud.svg';
import ColorCloud from '../../assets/GoalPage/ColorCloud.svg';
import Rainbow1 from '../../assets/GoalPage/Rainbow1.svg';
import Rainbow2 from '../../assets/GoalPage/Rainbow2.svg';
import CloudComponent from './GoormScreen/CloudComponent';

interface Cloud {
cloudType: string;
colStart: number;
rowStart: number;
hidden: boolean;
}

export default function GoormScreen() {
const [stage, setStage] = useState<number>(0);

const clouds: Cloud[] = [
{
cloudType: stage === 1 ? ColorCloud : BlueCloud,
colStart: 1,
rowStart: 1,
hidden: stage === 0,
},
{
cloudType: stage === 2 ? ColorCloud : BlueCloud,
colStart: 2,
rowStart: 2,
hidden: stage < 2,
},
{
cloudType: stage === 3 ? ColorCloud : BlueCloud,
colStart: 3,
rowStart: 1,
hidden: stage < 3,
},
{
cloudType: stage === 4 ? ColorCloud : BlueCloud,
colStart: 4,
rowStart: 2,
hidden: stage < 4,
},
];

// ์ž„์‹œ๋กœ ์ง‘์–ด๋„ฃ์€ ๊ตฌ๋ฆ„ ๋‹จ๊ณ„ ์ฆ๊ฐ€ ํ•จ์ˆ˜
const increaseStage = () => {
setStage((prev) => (prev < 4 ? prev + 1 : prev));
};

// ์ž„์‹œ๋กœ ์ง‘์–ด๋„ฃ์€ ๊ตฌ๋ฆ„ ๋‹จ๊ณ„ ๊ฐ์†Œ ํ•จ์ˆ˜
const decreaseStage = () => {
setStage((prev) => (prev > 0 ? prev - 1 : prev));
};

return (
<div
className={cn(
'flex flex-col items-center justify-center w-full',
'relative bg-gradient-to-b from-[#5A82F1] to-[#DAE4FF]',
'p-2 md:p-10 h-[30vh] md:h-[60vh]'
)}
>
{/* ๋‹จ๊ณ„ ์กฐ์ ˆ ๋ฒ„ํŠผ */}
<div className="absolute top-4 right-4 flex space-x-2">
<button
onClick={decreaseStage}
className="px-4 py-2 bg-white rounded shadow"
disabled={stage === 0}
>
๋‹จ๊ณ„ ๊ฐ์†Œ
</button>
<button
onClick={increaseStage}
className="px-4 py-2 bg-white rounded shadow"
disabled={stage === 4}
>
๋‹จ๊ณ„ ์ฆ๊ฐ€
</button>
</div>

<div className="grid grid-cols-4 grid-rows-2 gap-2 md:gap-4 mt-8">
{clouds.map((cloud, index) => (
<CloudComponent
key={index}
cloudType={cloud.cloudType}
colStart={cloud.colStart}
rowStart={cloud.rowStart}
hidden={cloud.hidden}
/>
))}
</div>
</div>
);
}
Loading

0 comments on commit c48a064

Please sign in to comment.