Skip to content

Commit

Permalink
fix: made changes in PreviewCards
Browse files Browse the repository at this point in the history
  • Loading branch information
Cybrite committed Oct 24, 2024
1 parent c296395 commit 15ea579
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
15 changes: 12 additions & 3 deletions src/components/EventsPage/CardComponents/PreviewCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import {
PreviewMoreInfoButton,
PreviewMoreInfoButton2,
} from './PreviewCard.style';
import Link from 'next/link';

function PreviewCard({ ImageURL, PreviewDescription = '' }) {
function PreviewCard({ ImageURL, PreviewDescription = '', link = '' }) {
const words = PreviewDescription?.split(' ') || [];
const truncatedDescription =
words.length > 30 ? words.slice(0, 50).join(' ') + '...' : PreviewDescription;
Expand All @@ -17,8 +18,16 @@ function PreviewCard({ ImageURL, PreviewDescription = '' }) {
<PreviewCardImage src={ImageURL} alt='image' width={500} height={500} />
<PreviewCardContent>{truncatedDescription}</PreviewCardContent>
<PreviewButtonContainer>
<PreviewMoreInfoButton2>Rulebook</PreviewMoreInfoButton2>
<PreviewMoreInfoButton>Register</PreviewMoreInfoButton>
<PreviewMoreInfoButton2>
{link === '' ? (
'Coming soon'
) : (
<Link href={link} target='_blank' rel='noopener noreferrer'>
Rulebook
</Link>
)}
</PreviewMoreInfoButton2>
{link === '' || <PreviewMoreInfoButton>Register</PreviewMoreInfoButton>}
</PreviewButtonContainer>
</PreviewCardContainer>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ export const LargeScreenView = ({ onSlideChange, swiperRef, currentIndex, previe
key={index}
className={`slide ${index === currentIndex ? 'active-slide' : ''}`}
>
<PreviewCard PreviewDescription={item.PreviewDescription} ImageURL={item.ImageURL} />
<PreviewCard
PreviewDescription={item.PreviewDescription}
ImageURL={item.ImageURL}
link={item.Rulebook}
/>
</SwiperSlide>
))}
</Swiper>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ export const MobileView = ({
>
{previewItems.map((item, index) => (
<SwiperSlide key={index}>
<PreviewCard PreviewDescription={item.PreviewDescription} ImageURL={item.ImageURL} />
<PreviewCard
PreviewDescription={item.PreviewDescription}
ImageURL={item.ImageURL}
link={item.Rulebook}
/>
</SwiperSlide>
))}
</Swiper>
Expand Down

0 comments on commit 15ea579

Please sign in to comment.