-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Eugenia
committed
Oct 27, 2023
1 parent
19d1945
commit d6173ff
Showing
4 changed files
with
142 additions
and
55 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,52 @@ | ||
import './PostPreview.scss'; | ||
|
||
import { Box } from '@eleven-labs/design-system'; | ||
import classNames from 'classnames'; | ||
import React from 'react'; | ||
import { PropsWithChildren } from 'react'; | ||
|
||
import { PostPreviewProps } from './PostPreview'; | ||
|
||
const PostPreviewCard = ({ | ||
isHighlighted, | ||
image, | ||
hasMask, | ||
isRelated, | ||
// boxProps, | ||
children, | ||
}: Partial<PostPreviewProps> & PropsWithChildren): React.ReactNode => { | ||
if (isHighlighted) { | ||
return ( | ||
<Box className={classNames({ 'post-preview--highlighted': isHighlighted })}> | ||
{isHighlighted && ( | ||
<> | ||
<div className="sparkle" /> | ||
<div>{isHighlighted && <img src={image?.source} alt={image?.alt} />}</div> | ||
</> | ||
)} | ||
<Box | ||
as="article" | ||
className={classNames( | ||
'post-preview', | ||
{ 'post-preview--mask': hasMask }, | ||
{ 'post-preview--related': isRelated } | ||
)} | ||
// {...boxProps} | ||
> | ||
{children} | ||
</Box> | ||
</Box> | ||
); | ||
} | ||
return ( | ||
<Box | ||
as="article" | ||
className={classNames('post-preview', { 'post-preview--mask': hasMask }, { 'post-preview--related': isRelated })} | ||
// {...boxProps} | ||
> | ||
{children} | ||
</Box> | ||
); | ||
}; | ||
|
||
export default PostPreviewCard; |
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,38 @@ | ||
import './PostPreview.scss'; | ||
|
||
import { Heading, Link, Skeleton, Text } from '@eleven-labs/design-system'; | ||
import React from 'react'; | ||
|
||
import { PostPreviewOptions } from './PostPreview'; | ||
|
||
const PostPreviewContent = ({ | ||
isLoading, | ||
hasMask, | ||
title, | ||
link, | ||
isRelated, | ||
excerpt, | ||
}: Partial<PostPreviewOptions>): React.ReactNode => { | ||
return ( | ||
<> | ||
<Skeleton isLoading={isLoading}> | ||
<Heading as="h2" color="amaranth" size="s" mb={{ xs: 'xxs-3', md: 'xxs' }}> | ||
{hasMask ? ( | ||
title | ||
) : ( | ||
<Link {...link} data-internal-link={isRelated ? 'relatedPost' : 'post'}> | ||
{title} | ||
</Link> | ||
)} | ||
</Heading> | ||
</Skeleton> | ||
<Skeleton isLoading={isLoading} style={{ height: 75 }}> | ||
<Text size="s" className="post-preview__excerpt"> | ||
{excerpt} | ||
</Text> | ||
</Skeleton> | ||
</> | ||
); | ||
}; | ||
|
||
export default PostPreviewContent; |
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,30 @@ | ||
import { Box, Skeleton, Text } from '@eleven-labs/design-system'; | ||
import React from 'react'; | ||
|
||
import { PostPreviewOptions, SeparatorCircle } from '@/components'; | ||
|
||
const PostPreviewFooter = ({ isLoading, date, readingTime, authors }: Partial<PostPreviewOptions>): React.ReactNode => { | ||
return ( | ||
<Box mt={{ xs: 'xs', md: 's' }} textSize="xs"> | ||
<Skeleton isLoading={isLoading} display="inline-block" style={{ width: 100 }}> | ||
{date && <Text as="span">{date}</Text>} | ||
</Skeleton> | ||
<SeparatorCircle /> | ||
<Skeleton isLoading={isLoading} display="inline-block" style={{ width: 50 }}> | ||
{readingTime && <Text as="span">{readingTime}</Text>} | ||
</Skeleton> | ||
<SeparatorCircle /> | ||
<Skeleton isLoading={isLoading} display="inline-block" style={{ width: 100 }}> | ||
{authors && | ||
authors.map((author, authorIndex) => ( | ||
<Text key={author.username} as="span"> | ||
{author.name} | ||
{authorIndex !== authors.length - 1 ? ' & ' : ''} | ||
</Text> | ||
))} | ||
</Skeleton> | ||
</Box> | ||
); | ||
}; | ||
|
||
export default PostPreviewFooter; |