Added noise effect to gift card preview and gift link preview image#27809
Conversation
|
ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (7)
✅ Files skipped from review due to trivial changes (2)
🚧 Files skipped from review as they are similar to previous changes (3)
WalkthroughThis PR updates gift card visual styling by introducing a noise texture overlay and a dedicated notch decorative element. Frontend changes add CSS styling with improved layer composition and insert notch elements into gift card markup across three portal pages. Backend changes update server-side image generation to composite a tiled noise buffer and SVG notch overlay with accent-derived colors beneath text overlays, with module-level caching to avoid re-rendering the noise tile. Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| const sharp = require('sharp'); | ||
|
|
||
| const svg = buildSvg({accentColor}); | ||
| const noiseTile = await getGiftCardNoiseTile(sharp); |
There was a problem hiding this comment.
nit: works, but feels weird to pass sharp as parameter
We should be okay to lazy-require sharp in getGiftCardNoiseTile, as Node caches require() results
so e.g.
async function getGiftCardNoiseTile() {
if (giftCardNoiseTile !== undefined) {
return giftCardNoiseTile;
}
const sharp = require('sharp');
giftCardNoiseTile = await sharp(GIFT_CARD_NOISE_PATH)
.resize(192, 192, {kernel: 'nearest'})
.png()
.toBuffer();
return giftCardNoiseTile;
}
Applied the Figma noise treatment to Portal gift card previews while keeping card text, publisher details, and the notch above the texture.
Matched the generated gift link preview image to the Portal card treatment, with baked-alpha noise below the notch and text for stable Sharp output.
Changelog for v2.68.36 -> 2.68.37:
a5972de to
ef51a29
Compare
ref https://linear.app/ghost/issue/BER-3600/design-iteration
Adds a subtle noise texture to the gift card preview and the gift link OG preview image, and reworks the card's notch into a brand-tinted element for a more polished look.
Changes
Portal (in-app gift card)
gift-card-noise.webp) applied to.gh-portal-gift-checkout-cardvia a::afterpseudo-element at 10% opacity::after→::beforeto make room for the noise layerisolation: isolateadded to the card so the noise stays contained in its own stacking context::beforepseudo-element to a real<div class="gh-portal-gift-checkout-card-notch">(witharia-hidden) — needed because both pseudo slots are now used for orb + noisergba(0, 0, 0, 0.35)tocolor-mix(in srgb, var(--brandcolor) 65%, #000 35%)so it picks up the site's accent color::beforeso the noise overlay can sit above it2.68.37Server (OG preview image)
gift-card-noise.pngtiled across the rendered 1200×630 image via Sharp'scomposite({ tile: true })buildNotchOverlaySVG composite, tinted withmixWithBlack(accentColor, 0.65)to mirror the CSScolor-mixon the front endparseHexColor/mixWithBlackto compute the notch color server-sidegetGiftCardNoiseTile()so Sharp only resizes it once per process