Skip to content

feat: store BaseHeader height in a CSS variable#675

Open
SupaSeeka wants to merge 1 commit intoUTDNebula:developfrom
SupaSeeka:feature/base-header-height-css-var
Open

feat: store BaseHeader height in a CSS variable#675
SupaSeeka wants to merge 1 commit intoUTDNebula:developfrom
SupaSeeka:feature/base-header-height-css-var

Conversation

@SupaSeeka
Copy link
Copy Markdown

Closes #671

Added the ResizeObserver in BaseHeader.tsx.

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 6, 2026

@SupaSeeka is attempting to deploy a commit to the Nebula Labs Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Copy Markdown
Contributor

@Isoscelestial Isoscelestial left a comment

Choose a reason for hiding this comment

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

I wasn't expecting the issue to be done so fast lol, nice

I forgot to put this in the original issue, but I want to merge the most recent version of BaseHeader from UTD Trends into this file. Would you like to do this, or would you be comfortable with me adding a commit to this PR?

Also this PR is waiting on #651


const observer = new ResizeObserver(([entry]) => {
const height =
entry.borderBoxSize[0]?.blockSize ?? entry.contentRect.height;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

TypeScript complains about entry possibly being undefined, add optional chaining to entry

Suggested change
entry.borderBoxSize[0]?.blockSize ?? entry.contentRect.height;
entry?.borderBoxSize[0]?.blockSize ?? entry?.contentRect.height;

const [openCompactSearchBar, setOpenCompactSearchBar] = useState(false);

const headerRef = useRef<HTMLDivElement>(null);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Add comment here to explain what this does

Suggested change
// Dynamically stores header height into a CSS variable called `--base-header-height`.
// Useful for elements that need top offsets with `position: fixed` or `scroll-margin-top`.

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.

Store BaseHeader height in a CSS variable

2 participants