Skip to content

Commit cbf4d75

Browse files
Fix: update twitter-card with latest upstream changes and my fixes
1 parent 56fbe40 commit cbf4d75

5 files changed

Lines changed: 17 additions & 393 deletions

File tree

apps/web/app/page.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,15 @@ const tabs = [
1616
{
1717
key: "chatgpt",
1818
label: "ChatGPT Card",
19-
}
20-
// ,
19+
},
2120
// {
2221
// key: "gradient",
2322
// label: "Gradient Card",
2423
// },
24+
{
25+
key: "twitter",
26+
label: "Twitter Card",
27+
}
2528
];
2629

2730
export default function Home() {
@@ -32,7 +35,8 @@ export default function Home() {
3235
<CardSizeProvider>
3336
{tab === "markdown" ? <QuizMarkdownEditor /> : null}
3437
{tab === "chatgpt" ? <ChatgptEditor /> : null}
35-
{/* {tab === "gradient" ? <GradientEditor /> : null} */}
38+
{/* {tab === "gradient" ? <GradientEditor /> : null} */}
39+
{tab === "twitter" ? <TwitterEditor /> : null}
3640
</CardSizeProvider>
3741
</MainHomeLayout>
3842
);

apps/web/components/twitter-editor.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,15 @@ export default function TwitterEditor() {
8686
innerPaddingY: 50,
8787
scale: 1,
8888
exportScale: 1,
89-
pageName: "@postmaker.dev",
89+
pageName: "postmaker.dev",
9090
logoUrl: "/logo.svg",
9191
logoUrlLabel: "Created with Postmaker.dev",
9292
borderRadius: 16,
9393
hasCardBorder: false,
9494
isRtl: false,
9595
name: "John",
9696
username: "john_doe",
97-
text: "Writing code is like telling a joke. If you have to explain it, it’s probably broken. The best code makes you smile without saying a word..",
97+
text: "Elon Musk accused Apple of antitrust violations, claiming that the iPhone maker is favoring OpenAI's ChatGPT while sidelining his AI product Grok and the X app. Musk argues this contravenes fair competition, as both Grok and X struggle to rank high in the App Store despite recent upgrades.",
9898
showTwitterUI: true,
9999
verified: true,
100100
profileImage: "",
@@ -104,8 +104,8 @@ export default function TwitterEditor() {
104104
const {
105105
previewHeightPixels,
106106
previewWidthPixels,
107-
width: previewWidth,
108-
height: previewHeight,
107+
width: Width,
108+
height: Height,
109109
innerPaddingX,
110110
innerPaddingY,
111111
pageName,
@@ -242,14 +242,14 @@ export default function TwitterEditor() {
242242

243243
<div className="flex flex-col mt-4 border p-2 rounded-md">
244244
<label className="block mb-2">
245-
Preview Width: {previewWidth ? previewWidth : 0}px
245+
Preview Width: {Width ? Width : 0}px
246246
</label>
247247
<input
248248
type="range"
249249
min="40"
250250
name="previewWidth"
251251
max="1920"
252-
value={previewWidth}
252+
value={Width}
253253
onChange={(e) =>
254254
setStateValue(e.target.name, Number(e.target.value))
255255
}
@@ -258,14 +258,14 @@ export default function TwitterEditor() {
258258
</div>
259259
<div className="flex flex-col mt-4 border p-2 rounded-md">
260260
<label className="block mb-2">
261-
Preview Height: {previewHeight ? previewHeight : 0}px
261+
Preview Height: {Height ? Height : 0}px
262262
</label>
263263
<input
264264
type="range"
265265
min="40"
266266
name="previewHeight"
267267
max="1920"
268-
value={previewHeight}
268+
value={Height}
269269
onChange={(e) =>
270270
setStateValue(e.target.name, Number(e.target.value))
271271
}
@@ -397,8 +397,8 @@ export default function TwitterEditor() {
397397
style={{
398398
zIndex: 10,
399399
backgroundColor: "transparent",
400-
width: `${previewWidth}px`,
401-
height: `${previewHeight}px`,
400+
width: `${Width}px`,
401+
height: `${Height}px`,
402402
overflow: "clip",
403403
}}
404404
className="transition-all duration-200 select-none preview-container-drag"

packages/ui/src/gradient-preview/PastelGradientCanvas.tsx

Lines changed: 0 additions & 120 deletions
This file was deleted.

packages/ui/src/gradient-preview/gradient-preview.style.css

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)