code-prompt-7.md 29.5 KB

[dotenv@17.2.3] injecting env (0) from .env -- tip: ✅ audit secrets and track compliance: https://dotenvx.com/ops You are a Pixel-Perfect React Frontend Engineer. Your goal is to implement a specific UI component from Figma design data with 100% visual fidelity while ensuring header scroll to sections on click.

{ "name": "SpyingCTA", "purpose": "Call to action banner", "layout": { "boundingBox": { "top": 22708, "left": 23100, "width": 1440, "height": 408 }, "relativeBoundingBox": { "top": 3943, "left": 0, "width": 1440, "height": 408 }, "spacing": { "next": 0 }, "layoutDirection": "VERTICAL" }, "elements": [ { "id": "728:17931", "name": "section", "type": "FRAME", "scrollBehavior": "SCROLLS", "children": [ { "id": "728:17932", "name": "div", "type": "FRAME", "scrollBehavior": "SCROLLS", "children": [ { "id": "728:17933", "name": "div", "type": "FRAME", "scrollBehavior": "SCROLLS", "children": [ { "id": "728:17934", "name": "Is someone spying on your phone?", "type": "TEXT", "scrollBehavior": "SCROLLS", "blendMode": "PASS_THROUGH", "fills": [ { "blendMode": "NORMAL", "type": "SOLID", "color": { "r": 1, "g": 1, "b": 1, "a": 1 } } ], "strokes": [], "strokeWeight": 1, "strokeAlign": "OUTSIDE", "absoluteBoundingBox": { "x": 23540.34375, "y": 22792.484375, "width": 559, "height": 45 }, "absoluteRenderBounds": { "x": 23542.431640625, "y": 22801.138671875, "width": 555.16015625, "height": 33.6875 }, "constraints": { "vertical": "TOP", "horizontal": "CENTER" }, "characters": "Is someone spying on your phone?", "characterStyleOverrides": [], "styleOverrideTable": {}, "lineTypes": [ "NONE" ], "lineIndentations": [ 0 ], "style": { "fontFamily": "Inter", "fontPostScriptName": null, "fontStyle": "Extra Bold", "fontWeight": 800, "textAutoResize": "WIDTH_AND_HEIGHT", "fontSize": 34, "textAlignHorizontal": "CENTER", "textAlignVertical": "CENTER", "letterSpacing": -0.7200000286102295, "lineHeightPx": 45, "lineHeightPercent": 109.36205291748047, "lineHeightPercentFontSize": 132.35293579101562, "lineHeightUnit": "PIXELS" }, "layoutVersion": 3, "effects": [], "interactions": [], "complexStrokeProperties": { "strokeType": "BASIC" }, "inlineStyles": {} }, { "id": "728:17935", "name": "Find out with Certo", "type": "TEXT", "scrollBehavior": "SCROLLS", "blendMode": "PASS_THROUGH", "fills": [ { "blendMode": "NORMAL", "type": "SOLID", "color": { "r": 1, "g": 1, "b": 1, "a": 1 } } ], "strokes": [], "strokeWeight": 1, "strokeAlign": "OUTSIDE", "absoluteBoundingBox": { "x": 23737.171875, "y": 22887.484375, "width": 164, "height": 30 }, "absoluteRenderBounds": { "x": 23738.8515625, "y": 22895.984375, "width": 161.302734375, "height": 13.705078125 }, "constraints": { "vertical": "TOP", "horizontal": "CENTER" }, "characters": "Find out with Certo", "characterStyleOverrides": [], "styleOverrideTable": {}, "lineTypes": [ "NONE" ], "lineIndentations": [ 0 ], "style": { "fontFamily": "Inter", "fontPostScriptName": null, "fontStyle": "Regular", "fontWeight": 400, "textAutoResize": "WIDTH_AND_HEIGHT", "fontSize": 18, "textAlignHorizontal": "CENTER", "textAlignVertical": "CENTER", "letterSpacing": 0, "lineHeightPx": 30, "lineHeightPercent": 137.71517944335938, "lineHeightPercentFontSize": 166.6666717529297, "lineHeightUnit": "PIXELS" }, "layoutVersion": 3, "effects": [], "interactions": [], "complexStrokeProperties": { "strokeType": "BASIC" }, "inlineStyles": {} } ], "blendMode": "PASS_THROUGH", "clipsContent": false, "strokeWeight": 1, "absoluteBoundingBox": { "x": 23460, "y": 22792.484375, "width": 720, "height": 125 }, "absoluteRenderBounds": { "x": 23460, "y": 22792.484375, "width": 720, "height": 125 }, "constraints": { "vertical": "TOP", "horizontal": "LEFT" }, "interactions": [], "complexStrokeProperties": { "strokeType": "BASIC" }, "inlineStyles": {} }, { "id": "728:17936", "name": "div", "type": "FRAME", "scrollBehavior": "SCROLLS", "children": [ { "id": "728:17937", "name": "a", "type": "FRAME", "scrollBehavior": "SCROLLS", "children": [ { "id": "728:17938", "name": "span", "type": "FRAME", "scrollBehavior": "SCROLLS", "children": [ { "id": "728:17939", "name": "Get Certo for iPhone", "type": "TEXT", "scrollBehavior": "SCROLLS", "blendMode": "PASS_THROUGH", "fills": [ { "blendMode": "NORMAL", "type": "SOLID", "color": { "r": 0.007843137718737125, "g": 0.0117647061124444, "b": 0.23137255012989044, "a": 1 } } ], "strokes": [], "strokeWeight": 1, "strokeAlign": "OUTSIDE", "absoluteBoundingBox": { "x": 23569.875, "y": 22993.484375, "width": 192, "height": 23 }, "absoluteRenderBounds": { "x": 23570.771484375, "y": 22996.76171875, "width": 189.85546875, "height": 14.92578125 }, "constraints": { "vertical": "TOP", "horizontal": "LEFT" }, "layoutAlign": "INHERIT", "layoutGrow": 0, "layoutSizingHorizontal": "HUG", "layoutSizingVertical": "HUG", "characters": "Get Certo for iPhone", "characterStyleOverrides": [], "styleOverrideTable": {}, "lineTypes": [ "NONE" ], "lineIndentations": [ 0 ], "style": { "fontFamily": "Inter", "fontPostScriptName": null, "fontStyle": "Extra Bold", "fontWeight": 800, "textAutoResize": "WIDTH_AND_HEIGHT", "fontSize": 19, "textAlignHorizontal": "LEFT", "textAlignVertical": "CENTER", "letterSpacing": 0, "lineHeightPx": 22.5, "lineHeightPercent": 97.85026550292969, "lineHeightPercentFontSize": 118.42105102539062, "lineHeightUnit": "PIXELS" }, "layoutVersion": 3, "effects": [], "interactions": [], "complexStrokeProperties": { "strokeType": "BASIC" }, "inlineStyles": {} }, { "id": "728:17940", "name": "span:after", "type": "IMAGE", "url": "@/assets/span-after-728-17940.svg", "absoluteBoundingBox": { "x": 23778.53125, "y": 22997.734375, "width": 20, "height": 14 }, "absoluteRenderBounds": { "x": 23778.53125, "y": 22997.734375, "width": 20, "height": 14 }, "inlineStyles": {} } ], "blendMode": "PASS_THROUGH", "clipsContent": false, "strokeWeight": 1, "layoutMode": "HORIZONTAL", "paddingRight": 4.65625, "layoutWrap": "NO_WRAP", "absoluteBoundingBox": { "x": 23569.875, "y": 22993.484375, "width": 196.65625, "height": 23 }, "absoluteRenderBounds": { "x": 23569.875, "y": 22993.484375, "width": 228.65625, "height": 23 }, "constraints": { "vertical": "TOP", "horizontal": "LEFT" }, "layoutAlign": "INHERIT", "layoutGrow": 0, "layoutSizingHorizontal": "HUG", "layoutSizingVertical": "HUG", "interactions": [], "complexStrokeProperties": { "strokeType": "BASIC" }, "inlineStyles": {} } ], "blendMode": "PASS_THROUGH", "clipsContent": true, "cornerSmoothing": 0, "strokeWeight": 1, "layoutMode": "HORIZONTAL", "paddingLeft": 20, "paddingRight": 52, "paddingTop": 16, "paddingBottom": 15.5, "layoutWrap": "NO_WRAP", "absoluteBoundingBox": { "x": 23549.875, "y": 22977.484375, "width": 268.65625, "height": 54.5 }, "absoluteRenderBounds": { "x": 23549.875, "y": 22977.484375, "width": 268.65625, "height": 54.5 }, "constraints": { "vertical": "TOP", "horizontal": "CENTER" }, "layoutAlign": "INHERIT", "layoutGrow": 0, "layoutSizingHorizontal": "HUG", "layoutSizingVertical": "HUG", "interactions": [], "complexStrokeProperties": { "strokeType": "BASIC" }, "inlineStyles": { "borderRadius": "42px", "background": "#FFC247", "overflow": "hidden" } }, { "id": "728:17943", "name": "a", "type": "FRAME", "scrollBehavior": "SCROLLS", "children": [ { "id": "728:17944", "name": "Get Certo for Android", "type": "TEXT", "scrollBehavior": "SCROLLS", "blendMode": "PASS_THROUGH", "fills": [ { "blendMode": "NORMAL", "type": "SOLID", "color": { "r": 1, "g": 1, "b": 1, "a": 1 } } ], "strokes": [], "strokeWeight": 1, "strokeAlign": "OUTSIDE", "absoluteBoundingBox": { "x": 23862.53125, "y": 22993.484375, "width": 202, "height": 23 }, "absoluteRenderBounds": { "x": 23863.427734375, "y": 22996.76171875, "width": 199.95703125, "height": 14.92578125 }, "constraints": { "vertical": "TOP", "horizontal": "LEFT" }, "layoutAlign": "INHERIT", "layoutGrow": 0, "layoutSizingHorizontal": "HUG", "layoutSizingVertical": "HUG", "characters": "Get Certo for Android", "characterStyleOverrides": [], "styleOverrideTable": {}, "lineTypes": [ "NONE" ], "lineIndentations": [ 0 ], "style": { "fontFamily": "Inter", "fontPostScriptName": null, "fontStyle": "Extra Bold", "fontWeight": 800, "textAutoResize": "WIDTH_AND_HEIGHT", "fontSize": 19, "textAlignHorizontal": "LEFT", "textAlignVertical": "CENTER", "letterSpacing": 0, "lineHeightPx": 22.5, "lineHeightPercent": 97.85026550292969, "lineHeightPercentFontSize": 118.42105102539062, "lineHeightUnit": "PIXELS" }, "layoutVersion": 3, "effects": [], "interactions": [], "complexStrokeProperties": { "strokeType": "BASIC" }, "inlineStyles": {} } ], "blendMode": "PASS_THROUGH", "clipsContent": true, "cornerSmoothing": 0, "strokeWeight": 1, "layoutMode": "HORIZONTAL", "paddingLeft": 20, "paddingRight": 25.59375, "paddingTop": 16, "paddingBottom": 15.5, "layoutWrap": "NO_WRAP", "absoluteBoundingBox": { "x": 23842.53125, "y": 22977.484375, "width": 247.59375, "height": 54.5 }, "absoluteRenderBounds": { "x": 23842.53125, "y": 22977.484375, "width": 247.59375, "height": 54.5 }, "constraints": { "vertical": "TOP", "horizontal": "CENTER" }, "layoutAlign": "INHERIT", "layoutGrow": 0, "layoutSizingHorizontal": "HUG", "layoutSizingVertical": "HUG", "interactions": [], "complexStrokeProperties": { "strokeType": "BASIC" }, "inlineStyles": { "borderRadius": "42px", "boxShadow": "inset 0px 0px 0px 2px #FFF", "background": "rgba(255, 255, 255, 0.00)", "overflow": "hidden" } } ], "blendMode": "PASS_THROUGH", "clipsContent": false, "strokeWeight": 1, "layoutMode": "HORIZONTAL", "paddingLeft": 89.875, "paddingRight": 113.875, "paddingBottom": 24, "itemSpacing": 24, "layoutWrap": "NO_WRAP", "absoluteBoundingBox": { "x": 23460, "y": 22977.484375, "width": 744, "height": 78.5 }, "absoluteRenderBounds": { "x": 23460, "y": 22977.484375, "width": 744, "height": 78.5 }, "constraints": { "vertical": "TOP", "horizontal": "LEFT" }, "layoutSizingHorizontal": "HUG", "layoutSizingVertical": "HUG", "interactions": [], "complexStrokeProperties": { "strokeType": "BASIC" }, "inlineStyles": {} } ], "blendMode": "PASS_THROUGH", "clipsContent": false, "strokeWeight": 1, "absoluteBoundingBox": { "x": 23445, "y": 22792.484375, "width": 750, "height": 239.5 }, "absoluteRenderBounds": { "x": 23445, "y": 22792.484375, "width": 759, "height": 263.5 }, "constraints": { "vertical": "TOP", "horizontal": "LEFT_RIGHT" }, "layoutAlign": "INHERIT", "layoutGrow": 0, "layoutSizingHorizontal": "FIXED", "layoutSizingVertical": "FIXED", "interactions": [], "complexStrokeProperties": { "strokeType": "BASIC" }, "inlineStyles": {} } ], "blendMode": "PASS_THROUGH", "clipsContent": false, "strokeWeight": 1, "layoutMode": "HORIZONTAL", "paddingLeft": 345, "paddingRight": 345, "paddingTop": 84, "paddingBottom": 84, "layoutWrap": "NO_WRAP", "absoluteBoundingBox": { "x": 23100, "y": 22708.484375, "width": 1440, "height": 407.5 }, "absoluteRenderBounds": { "x": 23100, "y": 22708.484375, "width": 1440, "height": 407.5 }, "constraints": { "vertical": "TOP", "horizontal": "LEFT" }, "layoutAlign": "INHERIT", "layoutGrow": 0, "layoutSizingHorizontal": "HUG", "layoutSizingVertical": "HUG", "interactions": [], "complexStrokeProperties": { "strokeType": "BASIC" }, "inlineStyles": { "background": "linear-gradient(180deg, #2925CC 0%, #4B48E5 100%)" } } ], "kebabName": "spying-cta", "path": "@/components/spying-cta" } Available asset files: a-728-17958.png, a-728-17965.png, a-728-17972.png, a-after-728-18065.svg, bg-circle-svg-728-17676.svg, div-728-17679.png, div-728-17706.svg, div-728-17780.svg, div-728-17799.svg, div-728-17818.svg, div-728-17837.svg, div-728-17860.png, div-728-17870.png, div-728-17875.png, div-728-17880.png, div-728-17885.png, div-728-17890.png, div-728-17895.png, figure-728-17698.png, form-newsletter-signup-footer-form-before-728-18030.svg, logo-svg-728-18047.svg, span-728-18004.svg, span-728-18009.svg, span-728-18014.svg, span-728-18019.svg, span-728-18024.svg, span-after-728-17693.svg, span-after-728-17855.svg, span-after-728-17903.svg, span-after-728-17919.svg, span-after-728-17940.svg, span-after-728-17953.svg, ul-728-17983.svg {"approach":"Tailwind V4 and Less","libraries":[{"name":"Tailwind V4","role":"utility_first"},{"name":"Less","role":"css_preprocessor"}]}

<component_structure>
  The `component_details` parameter contains:
  - `elements`: Array of CSS styles and asset URLs for all elements in this component (colors, spacing, fonts, backgrounds, etc.)
  - `componentName` (optional): If present, indicates this is a **reusable component**; if absent, it's a **regular component**
  - `props` (optional): Props interface definition, only present when `componentName` exists
</component_structure>

<global_styles>
  .gradientBorder {
    position: relative;
    z-index: 0;
    &::before {
      content: '';
      position: absolute;
      inset: 0;
      padding: 1px;  // From strokeWidth
      border-radius: inherit;
      background: linear-gradient(278deg, rgba(170, 255, 248, 0.60) 1.63%, rgba(71, 169, 255, 0.60) 104.34%);  // From strokeColor
      -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
      -webkit-mask-composite: destination-out;
      mask-composite: exclude;
      z-index: -1;
    }
  } 
</global_styles>

<visual_reference>
  Refer to the conversation history for the page thumbnail and context.
  Use it to verify visual details like shadows, gradients, and spacing.
</visual_reference>

High Fidelity & Responsive:

  - **Style Consistency**: Implement styles using the technical stack and libraries listed in <styling>.
  - **Strict Restriction**: Absolutely ONLY use the technical stack and libraries listed in <styling>. Do NOT use any other styling methods, libraries, or frameworks (e.g., if clsx is not listed, do not use clsx).
  - **Default Styling**: If <styling> is empty or does not contain specific libraries, DEFAULT to standard vanilla CSS.

  - **Tailwind CSS + CSS Modules (CRITICAL)**:
    - If the stack includes BOTH Tailwind and CSS Modules (Less/SCSS), use them correctly:
      1. **Tailwind utilities**: Use DIRECTLY in JSX className (e.g., `className="flex items-center gap-4"`)
      2. **CSS Modules**: Use ONLY for complex styles that can't be expressed with Tailwind utilities (e.g., gradients, animations, pseudo-elements)
      3. **NEVER use `@apply` in CSS Module files** - it's a Tailwind-specific directive that doesn't work in Less/SCSS
      4. Example correct usage:
         TSX: `<div className={`flex ${styles.customGradient}`}>`
         Less: `.customGradient { background: linear-gradient(...); }`

  - **CSS Modules Only**: If the tech stack specifies CSS Modules without Tailwind:
    1. Create a corresponding style file (e.g., `index.module.less`, `index.module.scss`, or `index.module.css`)
    2. Import it as `import styles from './index.module.[ext]';` in the TSX
    3. Define all styles in the style file using standard CSS/Less/SCSS syntax
    4. Use `styles.className` in JSX
  - **CRITICAL**: Use exact design values from `component_details.elements` (colors, spacing, font sizes, gradients, shadows, etc.)
  - Use responsive utilities provided by the chosen libraries
  - For complex styles (gradients, shadows), use values from `elements` directly in CSS Modules or inline styles
  - For gradient rounded borders, CHECK `global_styles` for `.gradientBorder` mixin
</req_1>

<req_2>
  **DOM Identification**:
  - EVERY DOM element corresponding to a Figma node MUST have an `id` attribute.
  - The `id` value must match the `id` in the Figma Data exactly.
  - This is crucial for automated position validation.
</req_2>

<req_3>
  **Images & Assets**:

  - **CRITICAL**: For any image URL starting with `@/assets`, you MUST import it at the top of the file.
  - **Asset Name Matching**: 
    - Check the `<available_assets>` list for actual filenames in the project.
    - Asset filenames follow the pattern: `kebab-case-name-id1-id2.ext` (e.g., "Star 2.svg" → "star-2-1-2861.svg")
    - Match the base name (ignoring spaces, case, and ID suffix): "@/assets/arXiv.svg" → look for "arxiv-*.svg" in the list
    - Use the EXACT filename from the available assets list in your import.
  - Example: If available_assets contains "arxiv-1-2956.svg", use:
    `import ArXivIcon from '@/assets/arxiv-1-2956.svg';`
  - **Usage**: `<img src={ArXivIcon} />`, do not use backgroundImage property.
  - **NEVER** use the string path directly in JSX or styles.
</req_3>

<req_4>
  **Semantic HTML**:
  - Use semantic tags: `<header>`, `<footer>`, `<nav>`, `<article>`, `<section>`, `<button>`.
</req_4>

<req_5>
  **Layout Strategy**:
  - PREFER relative/flex/grid layout.
  - Use absolute positioning ONLY for decoration/overlays or if Figma structure explicitly implies overlay.
</req_5>

<req_6>
  **Naming Conventions**:
  - Component Name: **SpyingCTA** (PascalCase).
  - Export default.
</req_6>

<req_7>
  **Component Type & Props (CRITICAL)**:

  **IF `component_details.componentName` exists:**
  - This is a **reusable component**
  - Generate props interface from `component_details.props`: `interface SpyingCTAProps { ... }`
  - Reference props in JSX: `{title}`, `<img src={iconSrc} />` (NOT hardcoded values)

  **IF `component_details.componentName` does NOT exist:**
  - This is a **regular component**
  - Do NOT generate props interface
  - Directly hardcode content from `component_details.elements` into JSX

  **Both types**: Do NOT repeat JSX to simulate grids; parent components handle iteration.
</req_7>

<req_9>
  **React Import**:

  - Do **NOT** include `import React from 'react';` at the top of the file.
</req_9>

<req_10>
  **File Naming**:

  - ALWAYS name the main component file `index.tsx`.
  - ALWAYS name the style file (if applicable) `index.module.[css|less|scss]`.
  - NEVER use PascalCase or other names for filenames (e.g., DO NOT use `MainFrame.tsx` or `Button.tsx`).
</req_10>

If only one file (TSX) is needed: tsx // code...

If multiple files are needed (e.g., TSX + Styles):
## index.tsx
```tsx
// code...
```

## index.module.[css|less|scss]
```[css|less|scss]
// styles...
```