feat: refine styling/navbar links and CSS in general#31
feat: refine styling/navbar links and CSS in general#31Julusian merged 24 commits intobitfocus:mainfrom
Conversation
- cleaner CSS - make navbar links look like tabs. - better styling for sidebar groups
|
Im not a fan of the boxing around the expandable sections in the sidebar. I think the border on the right is being cut off in firefox for me, which wont be helping. And there is some shifting of text when expanding/collapsing things. But im not sure about that part. The header bar changes, I dont mind either way. It does appear to have lost some padding above the text, which feels off to me, it no longer feels even compared to padding beside the text. |
- move the caret to the left margin, similar to MS Word's Headings Navigation panel. This really makes the groups more distinct. - Apply a much more subtle (and better-coded) group highlighting effect use box-shadows, mainly. other adjustments: - fix a mistake I introduced on the color-mode toggle in the previous commit - better visual style for the drop-down sidebar close icon. - rename some variables to more correctly reflect their use. - minor style adjustments. CodeRabbit advice from companion repo: - remove --ifm-link-hover-bg since it's both ineffective and wrong! - add comments explaining "magic units" for tabs - add comment questioning `.text-gray-50` and `.text-gray-500`
|
@Julusian wrote:
Yeah, I'm not surprised. After looking at how MS Word does things I realized that having the expand/collapse carets on the left makes a huge difference in readability (for me).
So the latest commits moves them to the left, and also does a much more subtle highlighting of the group in a way that should be both less confusing and has a cool "z-layered" effect for nested groups. (I also fixed the shifting text you mentioned.) What do you think?
OK. I think the second commit just now fixes it. It may need a bit of polish when the text wraps to two lines. I'm almost inclined to just turn off text-wrap for the edge case of the window being narrow but not so narrow that the header links disappear altogether. (Glad you're not opposed to this idea!) |
This is the best yet... reduce line-spacing for word-wrap and fine-tune everything.
|
I wrote:
OK, that should do it for the fine-tuning/polish. Let me know what you think about it all! |
Screencast.From.2026-02-07.22-23-34.webmA couple of bugs I can see is:
I suspect the second one is the width media-queries you have used not lining up for firefox (or linux?), I dont think using those will work reliably I've been thinking that the threshold of when it breaks to the side nav should be adjusted because everything does crush and become a mess before that point already |
- Main: define tab-like highlighting for the navlinks that is not dependent on manual tuning. Essentially this is done by managing which components can pad and/or clip their contents. - Secondary: make the "download" and "GitHub" buttons more compact and visually pleasing. This also has the intentional effect of reducing the ranges in which navlink text wraps to two lines. On my screen, word wrap happens only when the user-guide is selected. - Minor: fix complaint about hover highlight on the version dropdown toggle. - Minor: fill out some comments, do minor rearrangement to keep like-things together
|
Julian wrote:
I was afraid of that. Your system fonts are narrower than mine. Happily I finally had a brainstorm (brainwave for you?) of how to do it right, i.e. w/o media queries. Let me know what you think! (Check the commit description for details.)
Agreed. Related: I've been "irritated" by the "Download" and "GitHub" buttons which take up too much room and don't exactly look pretty. This commit replaces them with FontAwesome icons, which both looks slicker and frees up enough room that the tabs only word-wrap when User Guide is active (since it adds the version pulldown).
Funny... padding was always missing but I "revealed" it by adding hover behavior. The latest commit removes the hover behavior, so it's back to where it was. |
📝 WalkthroughWalkthroughUpdated the JSON import assertion in Changes
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. No actionable comments were generated in the recent review. 🎉 🧹 Recent nitpick comments
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 |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (3)
src/css/custom.css (3)
78-99: Heads-up: theborder-bottomcolor on the active tab is silently overridden by specificity.The selector
.theme-layout-navbar-left .navbar__link(specificity 0,2,0) on line 78 setsborder-bottom: 2em solid transparent. The.navbar__link--activeselector (specificity 0,1,0) on line 91 tries to override it withborder-bottom: 2em solid var(--companion-active-tab-bg)— but it loses the specificity battle.It happens to look correct because
background-clip: border-box(the default) lets thebackground-colorshine through the transparent border. So the visual result is fine today, but it's fragile — if someone later addsbackground-clip: padding-boxor changes the background, the tab will break in a confusing way.Consider bumping the active selector's specificity to make the intent explicit:
Suggested tweak
-.navbar__link--active { +.theme-layout-navbar-left .navbar__link--active { /* Make active link look a like a page-tab ... */ color: var(--companion-active-tab-color); background-color: var(--companion-active-tab-bg);
215-218: Bold styling choice — theh2 ~general sibling combinator indents broadly.
.markdown h2 ~ :not(h1, h2)will indent every sibling element after anyh2(includingh3–h6, tables, blockquotes, details, etc.) with a 2rem left margin. This creates a nice visual hierarchy, but a couple of things to keep in mind:
- Tables and wide elements may look cramped with the extra left margin on narrower viewports.
h3–h6headings also get indented, which is presumably intentional for the hierarchical effect but might surprise future content authors.If this is the desired behavior for the docs, looks good! Just wanted to make sure it's a deliberate choice rather than an overshoot. 🙂
207-213: These utility classes appear to be completely unused — safe to remove.Verified across the entire codebase:
.text-gray-50and.text-gray-500are defined only in this file and aren't referenced anywhere else (no HTML, JS, or MDX files use them). Your instinct to clean them up is spot on! Feel free to remove them along with the comment if you'd like to keep the stylesheet lean.
|
for CodeRabbit: some of these items have been discussed previously in bitfocus/companion#3943 which is a copy of this code (but before CodeRabbit was enabled here). Summarized here.
The styling is intentional and works fine.
For @Julusian to confirm. |
The Rabbit's insight made me realize that the bottom-border wasn't necessary for the look. The current version vertically shifts the tab-labels down, which makes them less tall and also visually separates them from the non-tab links in the navbar.
|
Note for Julian: the vertical offset of the tab labels is "intentional" but if you don't like it, I can change it. Here's my commit comment: The Rabbit's insight made me realize that the bottom-border wasn't necessary for the tab-look. The current version vertically shifts the tab-labels down, which makes them less tall and also visually separates them from the non-tab links in the navbar. |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
src/css/custom.css (2)
108-120: Consider merging the duplicate.theme-layout-navbar-right .clean-btn:not(:hover)blocksThe selector
.theme-layout-navbar-right .clean-btn:not(:hover)appears in two separate rule blocks (lines 111 and 118). I understand the split — the first block sharesbackground-colorwith.navbar-sidebar__brand .clean-btn:not(:hover), while the second addsmarginonly for the right container. It works correctly, but two blocks with the same selector can be a maintenance pitfall since someone might later add a property to one block unaware of the other.One option: keep the shared
background-colorrule as-is and fold themargininto it with a comment, or add a small note like/* see also rule at line N */to cross-reference them.Totally up to you — just a thought to help future readers! 🙂
167-204: Excellent DOM-structure documentation in the comments! 📝The block comment at lines 168–176 explaining the DOM nesting and why the "not collapsed" selector is needed is really valuable. This kind of documentation makes CSS much more approachable for the next person.
Tiny nit on line 188:
padding-right: 0em— the unit on zero values is unnecessary (0is the same in all units). Completely cosmetic though!Proposed nit
- padding-right: 0em; + padding-right: 0;
- fix a cut-and-paste error that the rabbit noticed but misidentified (still a great help!) - The download and github icons didn't format correctly in the dropdown sidebar (I hadn't even realized those link migrated to the sidebar when the window is narrow!!). The solution required a bit of added complexity under the hood, but looks fine in the UI. - add a "tab" for the homepage so that one tab is always active. This makes the tab section look more tab-like from the outset but at the expense of taking up a bit of space. (An alternative would be to move "Bitfocus Companion" from the logo to the tab label, but I'm not sure it's a good idea.)
- use docusaurus' `className` property in the icon definitions to remove an HTML element. - fix some comments
website PR: bitfocus/website#31 - changes caret styling in the dropdown sidebar - other bits shouldn't affect the app-bundled docs - fix some comments
|
I prefer the text vertically centered, I think it looks odd being lower, and especially as it doesnt align with the 'bitfocus companion' text. I'm not sure that there is a benefit to having that home tab though And there is hover behaviour on the 'bitfocus companion' text that I dont remember seeing, that I'm not sure I like. Again partly becuase of the vertical differeence, but also it doesnt surround the logo. Im not sure its necessary though |
Well to some extent, these two go together: the home tab makes it visually clear that the vertical offset is a "property" of the tab group (i.e. by always having an active tab no matter what page you're on). The vertical offset also makes the tabs shorter -- more like browser tabs in height, for example. The home tab makes the tab-behavior more consistent by showing an active tab for each page. It could be named something other than home, of course. If you're still against, just say the word and I'll recenter them vertically (and remove the home tab). So options:
So just let me know your final choice. Thanks!
It surrounds the logo but is hard to see, probably because it lacks additional vertical padding. I added it for consistency with all other links on the navbar but can easily remove it. Especially if we keep the home tab. 😀. |
- reduce `--ifm-navbar-height` to 3.25rem (from 3.75rem) - add formulas to simplify changing navlink vertical padding without affecting centering - prevent two-line buttons. Turns out we don't need word-wrap! - remove brand hover behavior - tidy up code and comments. @CodeRabbit, note that Docusaurus correctly handles nested CSS, as I mentioned in the related PR in the companion repo.
|
(oops, forgot an obvious option: 3. Leave the *&!% navbar height alone. Live with tall tabs... added in previous comment. but don't forget there are additional options unrelated to navbar height there... ) |
|
@coderabbitai resume |
✅ Actions performedReviews resumed. |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
docusaurus.config.ts (1)
9-9:⚠️ Potential issue | 🟠 MajorUpdate import syntax to
with—asserthas been removed in Node.js v22 and Chrome 126+.The
assertkeyword for import attributes has been deprecated and is now removed in modern environments. Node.js v22 and Chrome 126+ no longer support it and will throw a SyntaxError. Update the import to use the standardizedwithsyntax:import versions from './versions.json' with { type: 'json' }This ensures compatibility with current and future runtimes.
🧹 Nitpick comments (4)
src/css/custom.css (4)
17-31: Nice theming setup! 👍The custom properties for light/dark companion theming are well-organized and easy to follow. One small note: Stylelint is flagging unexpected empty lines before custom properties on lines 19, 25 (and similarly lines 43, 47 in the dark block). If you'd like a clean lint run, you could either remove those blank lines or adjust the Stylelint config to allow them — totally up to you and how strict you want to be with the linter.
63-88: Clever tab effect — one tiny readability nit on the calc expression.The negative-margin trick to create faux-tabs is really neat! On line 76,
calc(0rem - var(--ifm-navbar-height) / 2)works fine but0remas a way to negate is a bit unusual. A more conventional form would read slightly clearer:💅 Optional cleanup
- --margin-bottom: calc(0rem - var(--ifm-navbar-height) / 2); /* move the button down to create the tab-like effect */ + --margin-bottom: calc(-1 * var(--ifm-navbar-height) / 2); /* move the button down to create the tab-like effect */
134-141: Nested CSS selectors — worth a quick browser-support sanity check.CSS nesting (
.fontawesomenested inside.theme-layout-navbar-right .navbar__link) is used here and in several other places (lines 147–161, 192–194, 221–223). This is native CSS nesting, which is well-supported in modern browsers but not in older ones. Since this is a documentation site likely targeting modern browsers, it's probably fine — just mentioning it in case you need to support older browsers.
236-242: These utility classes aren't referenced anywhere—safe to remove.Good catch adding that comment! A quick check confirms that
.text-gray-50and.text-gray-500aren't used anywhere in the codebase, so they can be safely pruned. Feel free to remove them to keep the stylesheet clean, unless you're planning to add them for future use (in which case a quick TODO comment would be helpful for the next person).
|
@coderabbitai: Regarding the first nitpick, please apply @Julusian 's instructions to this repo. Quoted here:
@coderabbitai: Regarding the third nitpick, please note that your "Nested CSS selectors — worth a quick browser-support sanity check." advice is incorrect as explained in the linked PR -- here is a link to my specific comment: Docusaurus processes nested CSS. @coderabbitai: in general please crosslink all learnings from the companion repo with this repo and vice-versa |
|
Tip For best results, initiate chat on the files or code changes.
These have been added to my knowledge base for future reviews on both repositories! ✏️ Learnings added
|
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
src/css/custom.css (1)
55-67: Tab clipping approach is clever! One small a11y note.The
overflow: hiddenon.theme-layout-navbar-leftis a neat trick to avoid precise padding calculations. Just something to keep in mind: focus outlines (keyboard navigation rings) on tab links may get partially clipped at the container edges. If you ever notice truncated focus indicators during keyboard testing,overflow: clipwithoverflow-clip-margincould be a more targeted alternative — but honestly this is unlikely to be a problem in practice given how the tabs are positioned.
| /* Main body styling? CodeRabbit says these are safe to prune, but was there an intention to use these? */ | ||
| .text-gray-50 { | ||
| color: #f9fafb; | ||
| } | ||
| .text-gray-500 { | ||
| color: #6b7280; | ||
| } |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Search for usage of text-gray-50 and text-gray-500 in the codebase (excluding custom.css)
echo "=== Searching for text-gray-50 ==="
rg 'text-gray-50' --type-list | grep -q html && rg -n 'text-gray-50' --type html || echo "No matches found in HTML files"
echo ""
echo "=== Searching for text-gray-500 ==="
rg 'text-gray-500' --type-list | grep -q html && rg -n 'text-gray-500' --type html || echo "No matches found in HTML files"
echo ""
echo "=== Broader search across all file types except CSS ==="
rg -n 'text-gray-50|text-gray-500' --type-not cssRepository: bitfocus/website
Length of output: 1047
🏁 Script executed:
#!/bin/bash
# Simple direct search for these class names
echo "=== Searching for text-gray-50 usage ==="
rg 'text-gray-50' --type-not css 2>/dev/null | head -20 || echo "No matches found"
echo ""
echo "=== Searching for text-gray-500 usage ==="
rg 'text-gray-500' --type-not css 2>/dev/null | head -20 || echo "No matches found"
echo ""
echo "=== List key files in repository to understand structure ==="
git ls-files | grep -E '\.(html|jsx?|tsx?)$' | head -20Repository: bitfocus/website
Length of output: 447
These utility classes aren't used anywhere in the codebase — safe to remove!
Great instinct questioning these! Our search confirms that .text-gray-50 and .text-gray-500 aren't referenced anywhere in the project, so removing them would be a nice lightweight cleanup of the stylesheet.
There was a problem hiding this comment.
This is @Julusian 's call; it's not my code.
There was a problem hiding this comment.
Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!
...logo acts like tab only on the website, not in the app-package version, which has no tabs.
|
I'm not keen on the tab styling for that. |
|
@coderabbitai resume |
✅ Actions performedReviews resumed. |
|
OK. I went with opacity change, mostly to differentiate it from the tabs. |









Summary by CodeRabbit
New Features
Style
Chores