Skip to content

Commit

Permalink
#80 refactor: 사이드 페이지에서 상태 태그 뜨도록 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
MyungJiwoo committed Sep 24, 2024
1 parent 57c9ea4 commit 6238c57
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
9 changes: 8 additions & 1 deletion src/components/Block.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ type Props = {
dType: string | undefined;
name: string | undefined;
picture?: string;
progress?: string;
highlightColor?: string;
};

const Block = ({
Expand All @@ -37,6 +39,8 @@ const Block = ({
dType,
name,
picture,
progress,
highlightColor,
}: Props) => {
const [isRemove, setIsRemove] = useState(true);
const { isModalOpen, openModal, handleYesClick, handleNoClick } = useModal();
Expand All @@ -45,7 +49,10 @@ const Block = ({
const navigate = useNavigate();

const clickHandler = () => {
navigate(`personalBlock/${blockId}`);
// navigate(`personalBlock/${blockId}`);
navigate(`personalBlock/${blockId}`, {
state: { highlightColor, progress },
});
};
const removeFunc = async () => {
if (blockId) {
Expand Down
3 changes: 2 additions & 1 deletion src/components/CompletedDashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ const CompletedDashboard = ({ list, id, dashboardId, onLoadMore }: Props) => {
className="container"
{...provided.droppableProps}
>

{/* {list?.map((block, index) => (
<Block
dashboardId={dashboardId}
Expand Down Expand Up @@ -106,6 +105,8 @@ const CompletedDashboard = ({ list, id, dashboardId, onLoadMore }: Props) => {
dType={block.dType ?? 'TeamDashboard'}
name={block.nickname ?? '이름 없음'}
picture={block.picture ?? ''}
progress={settings.progress ?? ''}
highlightColor={settings.highlightColor ?? ''}
/>
</div>
);
Expand Down
8 changes: 5 additions & 3 deletions src/components/InProgressDashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { BlockListResDto } from '../types/PersonalBlock';
import { useEffect } from 'react';
import { useInView } from 'react-intersection-observer';


type Props = {
list: BlockListResDto[];
id: string;
Expand Down Expand Up @@ -50,7 +49,9 @@ const InProgressDashboard = ({ list, id, dashboardId, onLoadMore }: Props) => {
// console.log(blockId);

const { highlightColor, progress } = settings;
navigate(`personalBlock/${blockId}`, { state: { highlightColor, progress, blockId } });
navigate(`personalBlock/${blockId}`, {
state: { highlightColor, progress, blockId },
});
};

// 세로 무한 스크롤
Expand Down Expand Up @@ -81,7 +82,6 @@ const InProgressDashboard = ({ list, id, dashboardId, onLoadMore }: Props) => {
className="container"
{...provided.droppableProps}
>

{/* {list?.map((block, index) => (
<Block
dashboardId={dashboardId}
Expand Down Expand Up @@ -110,6 +110,8 @@ const InProgressDashboard = ({ list, id, dashboardId, onLoadMore }: Props) => {
dType={block.dType ?? 'TeamDashboard'}
name={block.nickname ?? '이름 없음'}
picture={block.picture ?? ''}
progress={settings.progress ?? ''}
highlightColor={settings.highlightColor ?? ''}
/>
</div>
);
Expand Down
5 changes: 4 additions & 1 deletion src/components/NotStartedDashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import main3 from '../img/main3.png';
import { BlockListResDto } from '../types/PersonalBlock';
import { useInView } from 'react-intersection-observer';
import { useEffect } from 'react';
import { progress } from 'framer-motion';

type Props = {
list: BlockListResDto[];
Expand Down Expand Up @@ -83,7 +84,7 @@ const NotStartedDashboard = ({ list, id, dashboardId, onLoadMore }: Props) => {
{list?.map((block, index) => {
const isLastBlock = index === list.length - 1;
return (
<div key={block.blockId}>
<div key={block.blockId} ref={isLastBlock ? lastBlockRef : null}>
<Block
dashboardId={dashboardId}
index={index}
Expand All @@ -94,6 +95,8 @@ const NotStartedDashboard = ({ list, id, dashboardId, onLoadMore }: Props) => {
dType={block.dType ?? 'TeamDashboard'}
name={block.nickname ?? '이름 없음'}
picture={block.picture ?? ''}
progress={settings.progress ?? ''}
highlightColor={settings.highlightColor ?? ''}
/>
</div>
);
Expand Down

0 comments on commit 6238c57

Please sign in to comment.