Skip to content

Commit

Permalink
[Feat] [GGFE-265] Virtuoso 컴포넌트 적용
Browse files Browse the repository at this point in the history
  • Loading branch information
yoouyeon committed Sep 17, 2023
1 parent df4733f commit 5d59ee5
Showing 1 changed file with 26 additions and 8 deletions.
34 changes: 26 additions & 8 deletions components/Layout/MegaPhone.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useRouter } from 'next/router';
import { useState, useEffect, useRef } from 'react';
import { Virtuoso } from 'react-virtuoso';
import { Item } from 'types/itemTypes';
import useAxiosGet from 'hooks/useAxiosGet';
import useInterval from 'hooks/useInterval';
Expand Down Expand Up @@ -109,17 +110,34 @@ const Megaphone = () => {
}, [contents, itemList]);

return (
<MegaphoneContainer count={megaphoneData.length}>
{megaphoneData.map((content, idx) => (
<MegaphoneItem
content={content.content}
intraId={content.intraId}
key={idx}
<div className={styles.rollingBanner}>
<div className={styles.wrapper}>
<Virtuoso
totalCount={megaphoneData.length}
itemContent={(index) => (
<MegaphoneItem
content={megaphoneData[index].content}
intraId={megaphoneData[index].intraId}
/>
)}
style={{ height: '100%' }}
/>
))}
</MegaphoneContainer>
</div>
</div>
);

// return (
// <MegaphoneContainer count={megaphoneData.length}>
// {megaphoneData.map((content, idx) => (
// <MegaphoneItem
// content={content.content}
// intraId={content.intraId}
// key={idx}
// />
// ))}
// </MegaphoneContainer>
// );

// return contents.length > 0 ? (
// <MegaphoneContainer count={contents.length}>
// {contents.map((content, idx) => (
Expand Down

0 comments on commit 5d59ee5

Please sign in to comment.