Skip to content

Commit 640bc70

Browse files
committed
feat: magaziner with tweet creator options
1 parent 4bc257a commit 640bc70

File tree

1 file changed

+64
-1
lines changed

1 file changed

+64
-1
lines changed

src/pages/apps/MagazinerPage.jsx

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import BrutalistDialog from '../../components/BrutalistDialog';
2323
const STYLES = [
2424
{ value: 'brutalist', label: 'BRUTALIST_CHAOS' },
2525
{ value: 'posh', label: 'ELITE_AND_POSH' },
26+
{ value: 'glassy', label: 'GLASSY_FLUX' },
2627
];
2728

2829
const FONTS = [
@@ -156,6 +157,23 @@ const MagazinerPage = () => {
156157
}));
157158
setPrimaryColor(COLORS[1]);
158159
setAccentColor(COLORS[0]);
160+
} else if (style === 'glassy') {
161+
setInputs(prev => ({
162+
...prev,
163+
issueNo: { ...prev.issueNo, font: 'JetBrains Mono', size: 12 },
164+
title: { ...prev.title, font: 'Playfair Display', size: 100 },
165+
subtitle: { ...prev.subtitle, font: 'JetBrains Mono', size: 14 },
166+
mainStory: { ...prev.mainStory, font: 'Arvo', size: 45 },
167+
mainStorySub: { ...prev.mainStorySub, font: 'JetBrains Mono', size: 12 },
168+
secondStory: { ...prev.secondStory, font: 'Playfair Display', size: 24 },
169+
secondStorySub: { ...prev.secondStorySub, font: 'JetBrains Mono', size: 10 },
170+
bottomText: { ...prev.bottomText, font: 'JetBrains Mono', size: 10 },
171+
rightEdgeText: { ...prev.rightEdgeText, font: 'JetBrains Mono', size: 8 },
172+
bottomLeftText: { ...prev.bottomLeftText, font: 'JetBrains Mono', size: 8 },
173+
}));
174+
setPrimaryColor({ name: 'Glassy Indigo', hex: '#6366f1', text: '#FFFFFF' });
175+
setAccentColor({ name: 'White', hex: '#FFFFFF', text: '#000000' });
176+
setPattern('generative_art');
159177
} else {
160178
setInputs(initialInputs);
161179
setPrimaryColor(COLORS[0]);
@@ -198,6 +216,29 @@ const MagazinerPage = () => {
198216
ctx.fillStyle = primaryColor.hex;
199217
ctx.fillRect(0, 0, width, height);
200218

219+
if (style === 'glassy' && !bgImage) {
220+
const bgGradient = ctx.createLinearGradient(0, 0, width, height);
221+
bgGradient.addColorStop(0, '#6366f1');
222+
bgGradient.addColorStop(0.5, '#a855f7');
223+
bgGradient.addColorStop(1, '#ec4899');
224+
ctx.fillStyle = bgGradient;
225+
ctx.fillRect(0, 0, width, height);
226+
227+
const drawBlob = (x, y, r, color) => {
228+
ctx.save();
229+
ctx.beginPath();
230+
ctx.arc(x, y, r, 0, Math.PI * 2);
231+
ctx.fillStyle = color;
232+
ctx.filter = 'blur(80px)';
233+
ctx.globalAlpha = 0.4;
234+
ctx.fill();
235+
ctx.restore();
236+
};
237+
drawBlob(width * 0.2, height * 0.2, 300 * scale, '#c084fc');
238+
drawBlob(width * 0.8, height * 0.1, 250 * scale, '#facc15');
239+
drawBlob(width * 0.5, height * 0.9, 350 * scale, '#f472b6');
240+
}
241+
201242
if (bgImage && options.includeBgImage) {
202243
const imgRatio = bgImage.width / bgImage.height;
203244
const canvasRatio = width / height;
@@ -430,7 +471,29 @@ const MagazinerPage = () => {
430471
ctx.strokeStyle = accentColor.hex;
431472
ctx.lineWidth = borderWidth * scale;
432473
const bPadding = 30 * scale;
433-
ctx.strokeRect(bPadding, bPadding, width - bPadding * 2, height - bPadding * 2);
474+
475+
if (style === 'glassy') {
476+
const r = 40 * scale;
477+
const bx = bPadding;
478+
const by = bPadding;
479+
const bw = width - bPadding * 2;
480+
const bh = height - bPadding * 2;
481+
482+
ctx.beginPath();
483+
ctx.moveTo(bx + r, by);
484+
ctx.lineTo(bx + bw - r, by);
485+
ctx.quadraticCurveTo(bx + bw, by, bx + bw, by + r);
486+
ctx.lineTo(bx + bw, by + bh - r);
487+
ctx.quadraticCurveTo(bx + bw, by + bh, bx + bw - r, by + bh);
488+
ctx.lineTo(bx + r, by + bh);
489+
ctx.quadraticCurveTo(bx, by + bh, bx, by + bh - r);
490+
ctx.lineTo(bx, by + r);
491+
ctx.quadraticCurveTo(bx, by, bx + r, by);
492+
ctx.closePath();
493+
ctx.stroke();
494+
} else {
495+
ctx.strokeRect(bPadding, bPadding, width - bPadding * 2, height - bPadding * 2);
496+
}
434497
}
435498

436499
// 5. Noise

0 commit comments

Comments
 (0)