Skip to content

feat(landing): use new header style#494

Merged
hari merged 6 commits into
mainfrom
feat/header-roll-nav
Jun 9, 2026
Merged

feat(landing): use new header style#494
hari merged 6 commits into
mainfrom
feat/header-roll-nav

Conversation

@sudhashrestha

@sudhashrestha sudhashrestha commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features

    • Added RollText: an animated text component with rollout effect, supporting character, word, and no-stagger animation modes with customizable timing.
  • Documentation

    • Added comprehensive RollText documentation with usage examples and configuration guidance.
    • Updated text animations overview with new component preview.
  • Improvements

    • Enhanced site header with animated navigation labels.
    • Added "Index" link to main navigation.

sudhashrestha and others added 6 commits June 9, 2026 18:43
Drop the announcement ribbon offset, tighten the bar, and use RollText on main nav.

Co-authored-by: Cursor <cursoragent@cursor.com>
Shared with the resources page branch — small util for ?ref= on outbound URLs.

Co-authored-by: Cursor <cursoragent@cursor.com>
Document the roll-unit markup, data-roll-group hover, and latch playback.
Register Roll text in the text overview; wire header nav with character stagger.

Co-authored-by: Cursor <cursoragent@cursor.com>
Resolves CI typecheck failure on RollTextProps.type and ref assignment.

Co-authored-by: Cursor <cursoragent@cursor.com>
Drop polymorphic as/type; wrap links and buttons on the parent. Decorative
track stays aria-hidden; standalone labels stay tabbable via tabIndex 0.

Co-authored-by: Cursor <cursoragent@cursor.com>
Keep roll motion on fixed label colors instead of parent hover:text-*,
add disabled for active nav links, and tighten will-change to the animating phase.

Co-authored-by: Cursor <cursoragent@cursor.com>
@sudhashrestha sudhashrestha requested a review from hari June 9, 2026 17:09
@coderabbitai

coderabbitai Bot commented Jun 9, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds RollText, a new decorative text animation component that splits text into segments and animates them rolling into view with configurable stagger modes (none, word, character). Includes complete styling with CSS custom properties, Storybook stories, comprehensive documentation, site header integration, and a utility for appending analytics ref parameters to external links.

Changes

RollText Animation Component

Layer / File(s) Summary
RollText type contract and CSS styling foundation
animata/text/roll-text.tsx, animata/text/roll-text.css
Exports RollStagger type, RollTextProps interface, and default RollText component. CSS defines .roll-text base styles with custom properties (--roll-duration, --roll-ease, --roll-travel, etc.), front/back panel layering with backface-visibility, @keyframes roll-front-open / roll-back-open, state-driven animations via .roll-text--animating and .roll-text--open, and reduced-motion overrides.
RollText React component implementation
animata/text/roll-text.tsx
Implements segment generation for none/word/character stagger modes, phase state management (closedanimatingopen) via refs and useEffect, animation completion tracking via countdown refs, optional groupHover listener attachment to ancestor [data-roll-group] elements, direct span hover/focus listeners when groupHover is false, prefers-reduced-motion detection for immediate open state, and full JSX markup with visually-hidden accessible text and segment-mapped track rendering.
RollText documentation, stories, and examples
animata/text/roll-text.stories.tsx, content/docs/text/roll-text.mdx, content/docs/text/index.mdx
Storybook meta config and two stories (Primary with default args, InCardLink embedding in styled anchor with groupHover). Comprehensive MDX docs covering installation (CLI/manual), usage examples for all stagger modes, group-hover patterns with data-roll-group and pointer-events-none, playback state machine, segment timing, accessibility/ARIA rules, and prop reference. Index grid updated with RollText preview tile linking to full docs.
Outbound link reference utility
lib/outbound-ref.ts
New OUTBOUND_REF constant ("animata.design") and withOutboundRef(href, ref?) helper that appends ?ref=<value> to http(s) URLs using the URL API, preserving existing query strings and never duplicating existing ref parameters.
Site header navigation with RollText and outbound refs
components/site-header.tsx
Imports RollText and withOutboundRef, introduces headerIconLinkClassName for icon link styling, updates sticky header positioning/layout, replaces main nav link text with RollText (stagger: character, dynamic active coloring), changes nav link key from index to href, wraps external GitHub/Twitter href with withOutboundRef, and applies shared icon styling.
Navigation configuration and layout cleanup
config/docs.ts, app/(main)/layout.tsx
Adds new top-level "Index" navigation item linking to / in docsConfig.mainNav. Removes AnnouncementRibbon import and element from MainLayout.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • codse/animata#439: Introduces the AnnouncementRibbon component that this PR removes from the main layout.
  • codse/animata#443: Also updates the text animations preset grid in content/docs/text/index.mdx by modifying component tiles.

Suggested reviewers

  • hari

Poem

🎬 A ribbon of text spins into view,
Letters tumble, each one right on cue—
Staggered, smooth, with motion respect,
Hop hop! The header looks quite correct. ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 28.57% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'feat(landing): use new header style' accurately reflects the main changes: updating the site header with new styling, including RollText animations for navigation and layout adjustments.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/header-roll-nav

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

🧹 Nitpick comments (1)
animata/text/roll-text.css (1)

9-9: 💤 Low value

Minor formatting: Add empty line before declaration.

Stylelint reports that an empty line is expected before the font-kerning declaration for consistency with the project's CSS formatting rules.

♻️ Proposed fix
   --roll-layer-gap: 0.05em;
   --roll-line-height: 1.15;
+
   font-kerning: none;
   line-height: var(--roll-line-height);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@animata/text/roll-text.css` at line 9, Add a single blank line immediately
before the font-kerning: none; declaration in roll-text.css so it matches the
project's CSS formatting rules; locate the font-kerning declaration and insert
an empty line above it, then re-run stylelint to confirm the formatting warning
is resolved.

Source: Linters/SAST tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@animata/text/roll-text.stories.tsx`:
- Line 46: The className on the JSX element in roll-text.stories.tsx contains an
invalid Tailwind token "font-(family-name:--font-display)"; replace that token
with a valid Tailwind approach by either using your configured utility (e.g.,
font-display) or Tailwind's arbitrary property syntax to reference the CSS
variable (use the [font-family:var(--font-display)] form), and update the
className string accordingly so it uses only valid Tailwind utility classes.
- Line 27: The className string "font-(family-name:--font-display) text-4xl
tracking-tight text-foreground" uses invalid Tailwind syntax; update the font
part to a valid Tailwind utility—either use the configured font family utility
like "font-display" if it exists, or use the arbitrary value syntax referencing
the CSS variable as "font-[var(--font-display)]" (keep the rest of the classes
unchanged). Locate the className property in roll-text.stories.tsx and replace
only the invalid font token accordingly.

In `@animata/text/roll-text.tsx`:
- Line 17: The component currently imports external CSS (roll-text.css) which
violates the guideline; remove the import statement and move the CSS rules into
an inline <style> block inside the RollText component file (either returned from
the component or at module scope within the same .tsx) by copying the contents
of roll-text.css into a JSX style tag (e.g., <style jsx>{`...`}</style>)
ensuring you preserve selectors like .roll-text, animations, and custom
properties such as --roll-duration so the RollText component, its class names,
and keyframes continue to work unchanged.

In `@components/site-header.tsx`:
- Around line 54-81: The active nav item uses the "text-accent" class (inside
the docsConfig.mainNav.map render where isActive is computed and applied to the
RollText component) which resolves to a purple accent; change that to the brand
yellow by replacing the conditional class value (isActive ? "text-accent" :
"text-muted-foreground") with a class that outputs `#ffcc00` (for example use
Tailwind's arbitrary color class text-[`#ffcc00`]) or alternatively update your
Tailwind/Theme accent token to the hex `#ffcc00` so the active state uses the
brand yellow.

In `@content/docs/text/index.mdx`:
- Line 161: The className contains invalid Tailwind syntax: replace
className="font-(family-name:--font-display) text-3xl tracking-tight
text-foreground" with a valid approach — either use a real Tailwind utility
(e.g. className="font-sans text-3xl tracking-tight text-foreground") or remove
the malformed font-... token and apply the CSS variable via the style prop (e.g.
style={{ fontFamily: 'var(--font-display)' }} alongside className="text-3xl
tracking-tight text-foreground"); update the className string or add the style
prop in the same element where that className appears.

In `@content/docs/text/roll-text.mdx`:
- Line 45: The examples use an invalid Tailwind className token
"font-(family-name:--font-display)"; update all RollText usages (e.g., the
<RollText ... /> instances) to use a valid Tailwind font class or an arbitrary
value syntax such as "font-[var(--font-display)]" or the theme-defined class
like "font-display" (whichever matches your project theme). Replace the invalid
token in every occurrence (lines referenced in the review) so the examples show
a valid Tailwind className.

In `@lib/outbound-ref.ts`:
- Around line 5-16: withOutboundRef currently constructs a URL from href using
the URL constructor which can throw for malformed but regex-passing inputs; wrap
the URL(...) call in a try/catch inside withOutboundRef (referencing function
name withOutboundRef and constant OUTBOUND_REF) and on error simply return the
original href (or a safe fallback) instead of letting the exception propagate,
ensuring the function remains a no-op for invalid URLs while preserving existing
behavior for valid ones.

---

Nitpick comments:
In `@animata/text/roll-text.css`:
- Line 9: Add a single blank line immediately before the font-kerning: none;
declaration in roll-text.css so it matches the project's CSS formatting rules;
locate the font-kerning declaration and insert an empty line above it, then
re-run stylelint to confirm the formatting warning is resolved.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d644c58b-1e90-45ca-a8ab-3f01ed2d0bbd

📥 Commits

Reviewing files that changed from the base of the PR and between 5e0a651 and f7aaa66.

📒 Files selected for processing (9)
  • animata/text/roll-text.css
  • animata/text/roll-text.stories.tsx
  • animata/text/roll-text.tsx
  • app/(main)/layout.tsx
  • components/site-header.tsx
  • config/docs.ts
  • content/docs/text/index.mdx
  • content/docs/text/roll-text.mdx
  • lib/outbound-ref.ts
💤 Files with no reviewable changes (1)
  • app/(main)/layout.tsx

stagger: "character",
staggerMs: 32,
durationMs: 250,
className: "font-(family-name:--font-display) text-4xl tracking-tight text-foreground",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Invalid Tailwind className syntax.

The className font-(family-name:--font-display) is not valid Tailwind CSS syntax and will not apply the intended font-family styling. As per coding guidelines, use Tailwind CSS only for styling.

🎨 Proposed fix using Tailwind arbitrary value syntax
-    className: "font-(family-name:--font-display) text-4xl tracking-tight text-foreground",
+    className: "font-[var(--font-display)] text-4xl tracking-tight text-foreground",

Alternatively, if font-display is configured as a custom utility in tailwind.config.js:

-    className: "font-(family-name:--font-display) text-4xl tracking-tight text-foreground",
+    className: "font-display text-4xl tracking-tight text-foreground",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
className: "font-(family-name:--font-display) text-4xl tracking-tight text-foreground",
className: "font-[var(--font-display)] text-4xl tracking-tight text-foreground",
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@animata/text/roll-text.stories.tsx` at line 27, The className string
"font-(family-name:--font-display) text-4xl tracking-tight text-foreground" uses
invalid Tailwind syntax; update the font part to a valid Tailwind utility—either
use the configured font family utility like "font-display" if it exists, or use
the arbitrary value syntax referencing the CSS variable as
"font-[var(--font-display)]" (keep the rest of the classes unchanged). Locate
the className property in roll-text.stories.tsx and replace only the invalid
font token accordingly.

Source: Coding guidelines

<RollText
{...args}
groupHover
className="pointer-events-none font-(family-name:--font-display) text-2xl text-foreground"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Invalid Tailwind className syntax.

Same issue as the Primary story: font-(family-name:--font-display) is not valid Tailwind CSS syntax. As per coding guidelines, use Tailwind CSS only for styling.

🎨 Proposed fix
-        className="pointer-events-none font-(family-name:--font-display) text-2xl text-foreground"
+        className="pointer-events-none font-[var(--font-display)] text-2xl text-foreground"

Or, if using a configured utility:

-        className="pointer-events-none font-(family-name:--font-display) text-2xl text-foreground"
+        className="pointer-events-none font-display text-2xl text-foreground"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
className="pointer-events-none font-(family-name:--font-display) text-2xl text-foreground"
className="pointer-events-none font-[var(--font-display)] text-2xl text-foreground"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@animata/text/roll-text.stories.tsx` at line 46, The className on the JSX
element in roll-text.stories.tsx contains an invalid Tailwind token
"font-(family-name:--font-display)"; replace that token with a valid Tailwind
approach by either using your configured utility (e.g., font-display) or
Tailwind's arbitrary property syntax to reference the CSS variable (use the
[font-family:var(--font-display)] form), and update the className string
accordingly so it uses only valid Tailwind utility classes.

Source: Coding guidelines


import { cn } from "@/lib/utils";

import "./roll-text.css";

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

Move CSS animations to an inline <style> block.

The component imports a separate CSS file, which violates the coding guidelines. As per coding guidelines, CSS animations for components in animata/**/*.tsx must belong in inline <style> blocks inside the component, not in separate CSS modules or styled-components.

♻️ Recommended refactor to move CSS inline

Remove the import and add the CSS content within a <style> JSX block in the component. Example structure:

-import "./roll-text.css";
-
 export type RollStagger = "none" | "word" | "character";

 export interface RollTextProps extends Omit<React.ComponentPropsWithoutRef<"span">, "children"> {

Then, within the RollText component function body or at the end of the file, add:

// Add inside the component's return statement or at module level
<style jsx>{`
  `@layer` components {
    .roll-text {
      --roll-duration: 450ms;
      /* ... rest of CSS from roll-text.css ... */
    }
  }
`}</style>

Or use a template literal style tag in the component's render return.

As per coding guidelines: "CSS animations must belong in inline <style> blocks inside the component, not in separate CSS modules or styled-components" applies to animata/**/*.tsx.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@animata/text/roll-text.tsx` at line 17, The component currently imports
external CSS (roll-text.css) which violates the guideline; remove the import
statement and move the CSS rules into an inline <style> block inside the
RollText component file (either returned from the component or at module scope
within the same .tsx) by copying the contents of roll-text.css into a JSX style
tag (e.g., <style jsx>{`...`}</style>) ensuring you preserve selectors like
.roll-text, animations, and custom properties such as --roll-duration so the
RollText component, its class names, and keyframes continue to work unchanged.

Source: Coding guidelines

Comment on lines +54 to 81
{docsConfig.mainNav.map((item) => {
const href = item.href as string;
const isActive = href === "/" ? pathname === "/" : pathname.startsWith(href);
return (
<Link
key={index}
key={href}
href={href}
data-roll-group
className={cn(
"rounded-md px-3 py-1.5 text-[13px] font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
isActive
? "bg-foreground/10 text-foreground"
: "text-muted-foreground hover:text-foreground",
"group/roll relative inline-flex items-center overflow-visible px-2 py-0.5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
)}
aria-current={isActive ? "page" : undefined}
>
{item.title}
<RollText
groupHover
disabled={isActive}
text={item.title}
stagger="character"
staggerMs={32}
durationMs={200}
className={cn(
"pointer-events-none text-xs font-medium [font-kerning:none]",
isActive ? "text-accent" : "text-muted-foreground",
)}
/>
</Link>
);
})}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Verify accent color is set to brand yellow `#ffcc00`

# Search for accent color definition in Tailwind config and CSS files
rg -n "accent.*#?ffcc00|ffcc00.*accent" --glob '*tailwind*.{js,ts,cjs,mjs}' --glob '**/*.css'

Repository: codse/animata

Length of output: 39


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Tailwind config files =="
fd -t f "tailwind.config.*" .

echo
echo "== Locate globals.css =="
fd -t f "globals.css" . || true

echo
echo "== Search for accent color mapping (Tailwind/theme variables) =="
rg -n "(--color-accent|--accent|accent-foreground|text-accent\b|`@theme`|theme\.)" --glob "**/*.{css,ts,tsx,js,jsx,cjs,mjs}" .

echo
echo "== Print relevant excerpts from globals.css (if present) =="
g=$(fd -t f "globals.css" . | head -n 1 || true)
if [ -n "${g}" ]; then
  echo "--- File: $g (around --accent / --color-accent) ---"
  rg -n "--color-accent|--accent\b|accent-foreground" "$g" || true
  # Show a broader window around the first match region(s)
  for pat in "--color-accent" "--accent" "accent-foreground"; do
    line=$(rg -n "$pat" "$g" | head -n 1 | cut -d: -f1 || true)
    if [ -n "$line" ]; then
      start=$(( line>40 ? line-40 : 1 ))
      end=$(( line+120 ))
      echo "--- $pat around lines $start-$end ---"
      sed -n "${start},${end}p" "$g" | nl -ba -w2 -s':'
    fi
  done
else
  echo "globals.css not found via fd."
fi

Repository: codse/animata

Length of output: 6946


Fix active nav highlight color to use brand yellow (#ffcc00)
text-accent in components/site-header.tsx resolves to --color-accent: hsl(var(--accent)), and --accent is 262 83% 58% (purple), so the active nav item isn’t using the required brand yellow #ffcc00. Update the active nav class to use #ffcc00 (or adjust the Tailwind accent token to #ffcc00) instead of text-accent.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@components/site-header.tsx` around lines 54 - 81, The active nav item uses
the "text-accent" class (inside the docsConfig.mainNav.map render where isActive
is computed and applied to the RollText component) which resolves to a purple
accent; change that to the brand yellow by replacing the conditional class value
(isActive ? "text-accent" : "text-muted-foreground") with a class that outputs
`#ffcc00` (for example use Tailwind's arbitrary color class text-[`#ffcc00`]) or
alternatively update your Tailwind/Theme accent token to the hex `#ffcc00` so the
active state uses the brand yellow.

Source: Coding guidelines

text="Roll text"
stagger="character"
staggerMs={32}
className="font-(family-name:--font-display) text-3xl tracking-tight text-foreground"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Invalid Tailwind className syntax.

The className font-(family-name:--font-display) is not valid Tailwind CSS syntax. As per coding guidelines, use Tailwind CSS only for styling.

🎨 Proposed fix
-      className="font-(family-name:--font-display) text-3xl tracking-tight text-foreground"
+      className="font-[var(--font-display)] text-3xl tracking-tight text-foreground"

Or, if using a configured utility:

-      className="font-(family-name:--font-display) text-3xl tracking-tight text-foreground"
+      className="font-display text-3xl tracking-tight text-foreground"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
className="font-(family-name:--font-display) text-3xl tracking-tight text-foreground"
className="font-[var(--font-display)] text-3xl tracking-tight text-foreground"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@content/docs/text/index.mdx` at line 161, The className contains invalid
Tailwind syntax: replace className="font-(family-name:--font-display) text-3xl
tracking-tight text-foreground" with a valid approach — either use a real
Tailwind utility (e.g. className="font-sans text-3xl tracking-tight
text-foreground") or remove the malformed font-... token and apply the CSS
variable via the style prop (e.g. style={{ fontFamily: 'var(--font-display)' }}
alongside className="text-3xl tracking-tight text-foreground"); update the
className string or add the style prop in the same element where that className
appears.

Source: Coding guidelines

```tsx
import RollText from "@/animata/text/roll-text";

<RollText text="Hello world" className="font-(family-name:--font-display) text-4xl text-foreground" />

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Invalid Tailwind className syntax in documentation examples.

Multiple code examples use font-(family-name:--font-display), which is not valid Tailwind CSS syntax. This will mislead developers copying these examples. As per coding guidelines, use Tailwind CSS only for styling.

🎨 Proposed fixes for all examples

Line 45:

-<RollText text="Hello world" className="font-(family-name:--font-display) text-4xl text-foreground" />
+<RollText text="Hello world" className="font-[var(--font-display)] text-4xl text-foreground" />

Line 51:

-<RollText text="Word by word" stagger="word" staggerMs={50} className="text-4xl text-foreground" />
+<RollText text="Word by word" stagger="word" staggerMs={50} className="font-[var(--font-display)] text-4xl text-foreground" />

Line 52:

-<RollText text="Letters" stagger="character" staggerMs={32} className="text-4xl text-foreground" />
+<RollText text="Letters" stagger="character" staggerMs={32} className="font-[var(--font-display)] text-4xl text-foreground" />

Line 65:

-    className="pointer-events-none text-2xl text-foreground"
+    className="pointer-events-none font-[var(--font-display)] text-2xl text-foreground"

Also applies to: 51-52, 65-65

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@content/docs/text/roll-text.mdx` at line 45, The examples use an invalid
Tailwind className token "font-(family-name:--font-display)"; update all
RollText usages (e.g., the <RollText ... /> instances) to use a valid Tailwind
font class or an arbitrary value syntax such as "font-[var(--font-display)]" or
the theme-defined class like "font-display" (whichever matches your project
theme). Replace the invalid token in every occurrence (lines referenced in the
review) so the examples show a valid Tailwind className.

Source: Coding guidelines

Comment thread lib/outbound-ref.ts
Comment on lines +5 to +16
export function withOutboundRef(href: string, ref = OUTBOUND_REF) {
if (!/^https?:\/\//i.test(href)) {
return href;
}

const url = new URL(href);
if (!url.searchParams.has("ref")) {
url.searchParams.set("ref", ref);
}

return url.toString();
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Add error handling for malformed URLs.

The URL constructor on line 10 will throw a TypeError if href passes the regex test but is malformed (e.g., "http://" or "https://invalid"). While siteConfig.links values are well-formed in practice, as a general utility this function should handle edge cases gracefully.

🛡️ Proposed fix with try-catch wrapper
 export function withOutboundRef(href: string, ref = OUTBOUND_REF) {
   if (!/^https?:\/\//i.test(href)) {
     return href;
   }
 
+  try {
     const url = new URL(href);
     if (!url.searchParams.has("ref")) {
       url.searchParams.set("ref", ref);
     }
-
     return url.toString();
+  } catch {
+    // Return original href if URL parsing fails
+    return href;
+  }
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lib/outbound-ref.ts` around lines 5 - 16, withOutboundRef currently
constructs a URL from href using the URL constructor which can throw for
malformed but regex-passing inputs; wrap the URL(...) call in a try/catch inside
withOutboundRef (referencing function name withOutboundRef and constant
OUTBOUND_REF) and on error simply return the original href (or a safe fallback)
instead of letting the exception propagate, ensuring the function remains a
no-op for invalid URLs while preserving existing behavior for valid ones.

@hari hari merged commit ba82518 into main Jun 9, 2026
6 checks passed
@hari hari deleted the feat/header-roll-nav branch June 9, 2026 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants