diff --git a/src/components/History/Summary/HistorySummary.tsx b/src/components/History/Summary/HistorySummary.tsx index 05bf876..2257449 100644 --- a/src/components/History/Summary/HistorySummary.tsx +++ b/src/components/History/Summary/HistorySummary.tsx @@ -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) @@ -47,7 +47,7 @@ const HistorySummary = ({ title, data, isDetailView, insertIndex }: Props) => { title={title} data={data} isDetailView={isDetailView} - insertIndex={insertIndex} + selectIndex={selectIndex} /> ); @@ -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; @@ -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} /> @@ -101,7 +102,7 @@ const List = ({ title, data, isDetailView, - insertIndex, + selectIndex, }: PropsWithChildren) => { const [isOpen, setIsOpen] = useState(isDetailView); const displayData = isOpen === false ? data.slice(0, 2) : data; @@ -111,9 +112,9 @@ const List = ({ - {children} + {isDetailView && children} {isOpen && } {isOpen && } @@ -142,14 +143,14 @@ const List = ({ interface BundleProps { className?: string; data: HistoryCardData[]; - insertIndex?: number; + selectIndex?: number; } const Bundle = ({ children, className, data, - insertIndex, + selectIndex, }: PropsWithChildren) => { return (
@@ -163,7 +164,7 @@ const Bundle = ({ - {insertIndex === idx && children} + {selectIndex === idx && children} ); })} diff --git a/src/stories/Components/History/HistorySummary/HistorySummary.stories.tsx b/src/stories/Components/History/HistorySummary/HistorySummary.stories.tsx index 4b06a2a..80a1613 100644 --- a/src/stories/Components/History/HistorySummary/HistorySummary.stories.tsx +++ b/src/stories/Components/History/HistorySummary/HistorySummary.stories.tsx @@ -21,7 +21,6 @@ export const Default: Story = { { companyName: 'companyName', period: 'period', id: '316' }, { companyName: 'companyName', period: 'period', id: '317' }, ], - isDetailView: false, }, };