-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Updated quoted tweet components * Export quoted tweet components * Updated tweet media border * Updated docs
- Loading branch information
Showing
26 changed files
with
175 additions
and
163 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
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
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,4 @@ | ||
export * from './quoted-tweet.js' | ||
export * from './quoted-tweet-container.js' | ||
export * from './quoted-tweet-header.js' | ||
export * from './quoted-tweet-body.js' |
9 changes: 9 additions & 0 deletions
9
packages/react-tweet/src/twitter-theme/quoted-tweet/quoted-tweet-body.module.css
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,9 @@ | ||
.root { | ||
font-size: var(--tweet-quoted-body-font-size); | ||
font-weight: var(--tweet-quoted-body-font-weight); | ||
line-height: var(--tweet-quoted-body-line-height); | ||
margin: var(--tweet-quoted-body-margin); | ||
overflow-wrap: break-word; | ||
white-space: pre-wrap; | ||
padding: 0 0.75rem; | ||
} |
12 changes: 12 additions & 0 deletions
12
packages/react-tweet/src/twitter-theme/quoted-tweet/quoted-tweet-body.tsx
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,12 @@ | ||
import type { EnrichedQuotedTweet } from '../../utils.js' | ||
import s from './quoted-tweet-body.module.css' | ||
|
||
type Props = { tweet: EnrichedQuotedTweet } | ||
|
||
export const QuotedTweetBody = ({ tweet }: Props) => ( | ||
<p className={s.root}> | ||
{tweet.entities.map((item, i) => ( | ||
<span key={i} dangerouslySetInnerHTML={{ __html: item.text }} /> | ||
))} | ||
</p> | ||
) |
19 changes: 19 additions & 0 deletions
19
packages/react-tweet/src/twitter-theme/quoted-tweet/quoted-tweet-container.module.css
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,19 @@ | ||
.root { | ||
width: 100%; | ||
overflow: hidden; | ||
border: var(--tweet-border); | ||
border-radius: 12px; | ||
margin: var(--tweet-quoted-container-margin); | ||
transition-property: background-color, box-shadow; | ||
transition-duration: 0.2s; | ||
cursor: pointer; | ||
} | ||
|
||
.root:hover { | ||
background-color: var(--tweet-quoted-bg-color-hover); | ||
} | ||
|
||
.article { | ||
position: relative; | ||
box-sizing: inherit; | ||
} |
19 changes: 19 additions & 0 deletions
19
packages/react-tweet/src/twitter-theme/quoted-tweet/quoted-tweet-container.tsx
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,19 @@ | ||
'use client' | ||
|
||
import type { ReactNode } from 'react' | ||
import type { EnrichedQuotedTweet } from '../../utils.js' | ||
import s from './quoted-tweet-container.module.css' | ||
|
||
type Props = { tweet: EnrichedQuotedTweet; children: ReactNode } | ||
|
||
export const QuotedTweetContainer = ({ tweet, children }: Props) => ( | ||
<div | ||
className={s.root} | ||
onClick={(e) => { | ||
e.preventDefault() | ||
window.open(tweet.url, '_blank') | ||
}} | ||
> | ||
<article className={s.article}>{children}</article> | ||
</div> | ||
) |
38 changes: 38 additions & 0 deletions
38
packages/react-tweet/src/twitter-theme/quoted-tweet/quoted-tweet-header.module.css
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 @@ | ||
.header { | ||
display: flex; | ||
padding: 0.75rem 0.75rem 0 0.75rem; | ||
line-height: var(--tweet-header-line-height); | ||
font-size: var(--tweet-header-font-size); | ||
white-space: nowrap; | ||
overflow-wrap: break-word; | ||
overflow: hidden; | ||
} | ||
|
||
.avatar { | ||
position: relative; | ||
height: 20px; | ||
width: 20px; | ||
} | ||
|
||
.avatarSquare { | ||
border-radius: 4px; | ||
} | ||
|
||
.author { | ||
display: flex; | ||
margin: 0 0.5rem; | ||
} | ||
|
||
.authorText { | ||
font-weight: 700; | ||
text-overflow: ellipsis; | ||
overflow: hidden; | ||
white-space: nowrap; | ||
} | ||
|
||
.username { | ||
color: var(--tweet-font-color-secondary); | ||
text-decoration: none; | ||
text-overflow: ellipsis; | ||
margin-left: 0.125rem; | ||
} |
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
15 changes: 15 additions & 0 deletions
15
packages/react-tweet/src/twitter-theme/quoted-tweet/quoted-tweet.tsx
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,15 @@ | ||
import type { EnrichedQuotedTweet } from '../../utils.js' | ||
import { QuotedTweetContainer } from './quoted-tweet-container.js' | ||
import { QuotedTweetHeader } from './quoted-tweet-header.js' | ||
import { QuotedTweetBody } from './quoted-tweet-body.js' | ||
import { TweetMedia } from '../tweet-media.js' | ||
|
||
type Props = { tweet: EnrichedQuotedTweet } | ||
|
||
export const QuotedTweet = ({ tweet }: Props) => ( | ||
<QuotedTweetContainer tweet={tweet}> | ||
<QuotedTweetHeader tweet={tweet} /> | ||
<QuotedTweetBody tweet={tweet} /> | ||
{tweet.mediaDetails?.length ? <TweetMedia quoted tweet={tweet} /> : null} | ||
</QuotedTweetContainer> | ||
) |
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
10 changes: 0 additions & 10 deletions
10
packages/react-tweet/src/twitter-theme/tweet-author-verified-badge.module.css
This file was deleted.
Oops, something went wrong.
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
8 changes: 3 additions & 5 deletions
8
packages/react-tweet/src/twitter-theme/tweet-media.module.css
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
9 changes: 0 additions & 9 deletions
9
packages/react-tweet/src/twitter-theme/tweet-quoted-tweet-body.module.css
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
packages/react-tweet/src/twitter-theme/tweet-quoted-tweet-body.tsx
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
packages/react-tweet/src/twitter-theme/tweet-quoted-tweet-container.module.css
This file was deleted.
Oops, something went wrong.
10 changes: 0 additions & 10 deletions
10
packages/react-tweet/src/twitter-theme/tweet-quoted-tweet-container.tsx
This file was deleted.
Oops, something went wrong.
39 changes: 0 additions & 39 deletions
39
packages/react-tweet/src/twitter-theme/tweet-quoted-tweet-header.module.css
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.