Skip to content

Commit dd58f27

Browse files
Use improved colors and font for react-tweet (#599)
Co-authored-by: Hayden Bleasel <hello@haydenbleasel.com>
1 parent 50a19ce commit dd58f27

File tree

1 file changed

+96
-2
lines changed

1 file changed

+96
-2
lines changed

docs/app/[[...slug]]/(home)/components/social.tsx

Lines changed: 96 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { Tweet } from "react-tweet";
1+
import { Tweet } from 'react-tweet';
2+
import { clsx } from 'clsx';
23

34
const tweets = [
45
"1853560800050651632",
@@ -71,8 +72,101 @@ export const Social = () => (
7172
</div>
7273
</div>
7374
<div className="columns-1 gap-4 p-8 sm:col-span-2 md:columns-2">
75+
<style dangerouslySetInnerHTML={{__html: `
76+
.tweet-customizer-wrapper .react-tweet-theme {
77+
--tweet-container-margin: 1.5rem 0;
78+
79+
/* Font Family */
80+
--tweet-font-family: 'Geist';
81+
82+
/* Header */
83+
--tweet-header-font-size: 0.9375rem;
84+
--tweet-header-line-height: 1.25rem;
85+
86+
/* Text */
87+
--tweet-body-font-size: 1.25rem;
88+
--tweet-body-font-weight: 400;
89+
--tweet-body-line-height: 1.5rem;
90+
--tweet-body-margin: 0;
91+
92+
/* Quoted Tweet */
93+
--tweet-quoted-container-margin: 0.75rem 0;
94+
--tweet-quoted-body-font-size: 0.938rem;
95+
--tweet-quoted-body-font-weight: 400;
96+
--tweet-quoted-body-line-height: 1.25rem;
97+
--tweet-quoted-body-margin: 0.25rem 0 0.75rem 0;
98+
99+
/* Info */
100+
--tweet-info-font-size: 0.9375rem;
101+
--tweet-info-line-height: 1.25rem;
102+
103+
/* Actions */
104+
--tweet-actions-font-size: 0.875rem;
105+
--tweet-actions-line-height: 1rem;
106+
--tweet-actions-font-weight: 700;
107+
--tweet-actions-icon-size: 1.25em;
108+
--tweet-actions-icon-wrapper-size: calc(var(--tweet-actions-icon-size) + 0.75em);
109+
110+
/* Reply button - automatically follows actions styling */
111+
--tweet-replies-font-size: 0.875rem;
112+
--tweet-replies-line-height: 1rem;
113+
--tweet-replies-font-weight: 700;
114+
}
115+
116+
:where(.tweet-customizer-wrapper .react-tweet-theme) * {
117+
margin: 0;
118+
padding: 0;
119+
box-sizing: border-box;
120+
}
121+
122+
:is([data-theme='light'], .light) :where(.tweet-customizer-wrapper .react-tweet-theme),
123+
:where(.tweet-customizer-wrapper .react-tweet-theme) {
124+
--tweet-skeleton-gradient: linear-gradient(270deg, rgb(245, 245, 245), rgb(230, 230, 230), rgb(230, 230, 230), rgb(245, 245, 245));
125+
--tweet-border: 1px solid rgb(229, 229, 229);
126+
--tweet-font-family: 'Geist';
127+
--tweet-font-color: rgb(10, 10, 10);
128+
--tweet-font-color-secondary: rgb(115, 115, 115);
129+
--tweet-bg-color: rgb(255, 255, 255);
130+
--tweet-bg-color-hover: rgb(255, 255, 255);
131+
--tweet-quoted-bg-color-hover: rgb(255, 255, 255);
132+
--tweet-color-blue-primary: rgb(0, 150, 255);
133+
--tweet-color-blue-primary-hover: rgba(0, 150, 255, 0.1);
134+
--tweet-color-blue-secondary: rgb(0, 112, 191);
135+
--tweet-color-blue-secondary-hover: rgba(0, 112, 191, 0.1);
136+
--tweet-color-green-primary: rgb(10, 10, 10);
137+
--tweet-color-green-primary-hover: rgba(10, 10, 10, 0.1);
138+
--tweet-color-red-primary: rgb(255, 30, 86);
139+
--tweet-color-red-primary-hover: rgba(255, 30, 86, 0.1);
140+
--tweet-twitter-icon-color: var(--tweet-font-color);
141+
--tweet-verified-old-color: rgb(130, 154, 171);
142+
--tweet-verified-blue-color: var(--tweet-color-blue-primary);
143+
}
144+
145+
:is([data-theme='dark'], .dark) :where(.tweet-customizer-wrapper .react-tweet-theme) {
146+
--tweet-skeleton-gradient: linear-gradient(270deg, rgb(25, 25, 25), rgb(40, 40, 40), rgb(40, 40, 40), rgb(25, 25, 25));
147+
--tweet-border: 1px solid rgb(35, 35, 35);
148+
--tweet-font-family: 'Geist';
149+
--tweet-font-color: rgb(250, 250, 250);
150+
--tweet-font-color-secondary: rgb(161, 161, 161);
151+
--tweet-bg-color: rgb(10, 10, 10);
152+
--tweet-bg-color-hover: rgb(10, 10, 10);
153+
--tweet-quoted-bg-color-hover: rgb(10, 10, 10);
154+
--tweet-color-blue-primary: rgb(0, 150, 255);
155+
--tweet-color-blue-primary-hover: rgba(0, 150, 255, 0.1);
156+
--tweet-color-blue-secondary: rgb(0, 210, 255);
157+
--tweet-color-blue-secondary-hover: rgba(0, 210, 255, 0.1);
158+
--tweet-color-green-primary: rgb(250, 250, 250);
159+
--tweet-color-green-primary-hover: rgba(250, 250, 250, 0.1);
160+
--tweet-color-red-primary: rgb(255, 30, 86);
161+
--tweet-color-red-primary-hover: rgba(255, 30, 86, 0.1);
162+
--tweet-twitter-icon-color: var(--tweet-font-color);
163+
--tweet-verified-old-color: rgb(130, 154, 171);
164+
--tweet-verified-blue-color: #fff;
165+
}
166+
167+
`}} />
74168
{tweets.map((tweet, index) => (
75-
<div className={index ? "" : "sm:-mt-6"} key={tweet}>
169+
<div key={tweet} className={clsx(index ? '' : 'sm:-mt-6', 'tweet-customizer-wrapper')}>
76170
<Tweet id={tweet} />
77171
</div>
78172
))}

0 commit comments

Comments
 (0)