Skip to content

Commit

Permalink
fix: 자세히보기 간 prop 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
steven-yn committed Mar 6, 2024
1 parent 4db2771 commit 9d3f936
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
25 changes: 13 additions & 12 deletions src/components/History/Summary/HistorySummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ interface HistoryCardData extends HistoryCardContextProps {
interface Props {
title: string;
data: HistoryCardData[];
isDetailView: boolean;
insertIndex?: number;
isDetailView?: boolean;
selectIndex?: number;
}
const HistorySummary = ({ title, data, isDetailView, insertIndex }: Props) => {
const HistorySummary = ({ title, data, isDetailView, selectIndex }: Props) => {
const { breakpointS } = useODSBreakPoints();

if (breakpointS)
Expand All @@ -47,7 +47,7 @@ const HistorySummary = ({ title, data, isDetailView, insertIndex }: Props) => {
title={title}
data={data}
isDetailView={isDetailView}
insertIndex={insertIndex}
selectIndex={selectIndex}
/>
);

Expand All @@ -56,11 +56,12 @@ const HistorySummary = ({ title, data, isDetailView, insertIndex }: Props) => {
title={title}
data={data}
isDetailView={isDetailView}
selectIndex={selectIndex}
/>
);
};

const Swiper = ({ title, data, isDetailView }: Props) => {
const Swiper = ({ title, data, isDetailView, selectIndex }: Props) => {
const { breakpointM, breakpointL, breakpointXXL } = useODSBreakPoints();

const maxDisplayLength = breakpointL ? 3 : 4;
Expand All @@ -75,7 +76,7 @@ const Swiper = ({ title, data, isDetailView }: Props) => {
length={
data.length > maxDisplayLength ? maxDisplayLength : data.length
}
selectedIdx={-1}
selectedIdx={typeof selectIndex === 'number' ? selectIndex : -1}
wrapperGapClass={gapStyle}
contentsWidthClass={historyCardWrapWidthStyle}
/>
Expand All @@ -101,7 +102,7 @@ const List = ({
title,
data,
isDetailView,
insertIndex,
selectIndex,
}: PropsWithChildren<Props>) => {
const [isOpen, setIsOpen] = useState(isDetailView);
const displayData = isOpen === false ? data.slice(0, 2) : data;
Expand All @@ -111,9 +112,9 @@ const List = ({
<HistorySummary.Bundle
className={listBundleStyle}
data={displayData}
insertIndex={insertIndex}
selectIndex={selectIndex}
>
{children}
{isDetailView && children}
</HistorySummary.Bundle>
{isOpen && <Spacer direction="horizontal" spacing="spacer-075" />}
{isOpen && <Spacer direction="horizontal" spacing="spacer-15" />}
Expand Down Expand Up @@ -142,14 +143,14 @@ const List = ({
interface BundleProps {
className?: string;
data: HistoryCardData[];
insertIndex?: number;
selectIndex?: number;
}

const Bundle = ({
children,
className,
data,
insertIndex,
selectIndex,
}: PropsWithChildren<BundleProps>) => {
return (
<div className={classNames(bundleStyle, className)}>
Expand All @@ -163,7 +164,7 @@ const Bundle = ({
<HistoryCard.Company />
<HistoryCard.Period />
</HistoryCard>
{insertIndex === idx && children}
{selectIndex === idx && children}
</Fragment>
);
})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export const Default: Story = {
{ companyName: 'companyName', period: 'period', id: '316' },
{ companyName: 'companyName', period: 'period', id: '317' },
],
isDetailView: false,
},
};

Expand Down

0 comments on commit 9d3f936

Please sign in to comment.