-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2497 from MahtabBukhari/Render-seed-episodes-on-t…
…he-landing-page [Graph Mindset] Render seed episodes on the landing page
- Loading branch information
Showing
3 changed files
with
169 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
import styled from 'styled-components' | ||
import { Flex } from '~/components/common/Flex' | ||
import { colors } from '~/utils/colors' | ||
|
||
interface VideoCardProps { | ||
imageUrl: string | ||
title: string | ||
subtitle: string | ||
onClick: () => void | ||
} | ||
|
||
export const VideoCard = ({ imageUrl, title, subtitle, onClick }: VideoCardProps) => { | ||
const truncatedTitle = title.length > 35 ? `${title.substring(0, 32)}...` : title | ||
const truncatedSubtitle = subtitle.length > 50 ? `${subtitle.substring(0, 47)}...` : subtitle | ||
|
||
return ( | ||
<CardWrapper onClick={onClick}> | ||
<ImageWrapper> | ||
<CardImage alt={title} src={imageUrl} /> | ||
</ImageWrapper> | ||
<TextWrapper> | ||
<CardTitle>{truncatedTitle}</CardTitle> | ||
<CardSubtitle>{truncatedSubtitle}</CardSubtitle> | ||
</TextWrapper> | ||
</CardWrapper> | ||
) | ||
} | ||
|
||
const CardWrapper = styled(Flex)` | ||
background: ${colors.BG1}; | ||
width: 170px; | ||
height: 200px; | ||
color: ${colors.white}; | ||
padding: 16px; | ||
border-radius: 8px; | ||
cursor: pointer; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
&:hover { | ||
background: ${colors.SEEDQUESTION_HOVER}; | ||
} | ||
&:active { | ||
background: ${colors.SEEDQUESTION}; | ||
} | ||
` | ||
|
||
const ImageWrapper = styled.div` | ||
width: 100%; | ||
height: 140px; /* Fixed height for images */ | ||
border-radius: 6px; | ||
overflow: hidden; | ||
margin-bottom: 12px; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
` | ||
|
||
const CardImage = styled.img` | ||
width: 100%; | ||
height: 100%; | ||
object-fit: cover; | ||
` | ||
|
||
const TextWrapper = styled(Flex)` | ||
flex-direction: column; | ||
justify-content: flex-start; | ||
gap: 8px; | ||
` | ||
|
||
const CardTitle = styled.p` | ||
font-family: Inter; | ||
font-size: 16px; | ||
font-weight: 500; | ||
line-height: 19px; | ||
color: ${colors.white}; | ||
margin: 0; | ||
white-space: wrap; | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
` | ||
|
||
const CardSubtitle = styled.p` | ||
font-family: Inter; | ||
font-size: 14px; | ||
font-weight: 400; | ||
line-height: 17px; | ||
color: ${colors.GRAY6}; | ||
margin: 0; | ||
white-space: wrap; | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters