-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix(navbar): use twMerge for className merging #4813
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
b9bbb76
e1d42ca
7d374f4
932c106
f3da270
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -4,8 +4,11 @@ import { useRouter } from 'next/router'; | |||||
| import { useTranslation } from 'next-i18next'; | ||||||
| import React, { useEffect, useState } from 'react'; | ||||||
|
|
||||||
| import { twMerge } from 'tailwind-merge'; | ||||||
|
|
||||||
| import { defaultLanguage, i18nPaths, languages } from '@/utils/i18n'; | ||||||
|
|
||||||
|
|
||||||
| import { SearchButton } from '../AlgoliaSearch'; | ||||||
| import GithubButton from '../buttons/GithubButton'; | ||||||
| import { isMobileDevice } from '../helpers/is-mobile'; | ||||||
|
|
@@ -20,6 +23,8 @@ import NavItem from './NavItem'; | |||||
| import otherItems from './otherItems'; | ||||||
| import ToolsPanel from './ToolsPanel'; | ||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Comment on lines
+26
to
+27
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove extra blank lines. Lines 26-27 have excess blank lines causing prettier and linting failures. Only one blank line should separate the imports from the interface declaration. 🔎 Proposed fix import ToolsPanel from './ToolsPanel';
-
-
interface NavBarProps {🧰 Tools🪛 GitHub Actions: PR testing - if Node project[error] 26-26: More than 1 blank line not allowed. no-multiple-empty-lines 🤖 Prompt for AI Agents |
||||||
| interface NavBarProps { | ||||||
| className?: string; | ||||||
| hideLogo?: boolean; | ||||||
|
|
@@ -144,7 +149,7 @@ export default function NavBar({ className = '', hideLogo = false }: NavBarProps | |||||
| }, [asPath]); | ||||||
|
|
||||||
| return ( | ||||||
| <div className={`bg-white ${className} z-50`}> | ||||||
| <div className={twMerge('bg-white z-50', className)}> | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # Find NavBar.tsx file
fd -e tsx -e ts "NavBar" | head -20Repository: asyncapi/website Length of output: 92 🏁 Script executed: # Read the NavBar.tsx file to examine line 149 and context
cat -n components/navigation/NavBar.tsx | sed -n '140,160p'Repository: asyncapi/website Length of output: 807 🏁 Script executed: # Search for NavBar component usage across the codebase
rg -nP --type=tsx --type=ts '<NavBar\s+' -g '!components/navigation/NavBar.tsx' -C2 | head -100Repository: asyncapi/website Length of output: 87 🏁 Script executed: # Check for prettier configuration in the repository
fd -e json -e js -e yml -e yaml "prettier" | head -10Repository: asyncapi/website Length of output: 42 🏁 Script executed: # Check the import statements in NavBar.tsx to verify twMerge is properly imported
head -30 components/navigation/NavBar.tsxRepository: asyncapi/website Length of output: 1121 🏁 Script executed: # Find prettier config files
fd -type f \( -name ".prettierrc*" -o -name "prettier.config.*" \) | head -10Repository: asyncapi/website Length of output: 230 🏁 Script executed: # Check for prettier config in package.json
cat package.json | grep -A 20 '"prettier"' 2>/dev/null || echo "No prettier field found"Repository: asyncapi/website Length of output: 723 🏁 Script executed: # Search for NavBar usage with simpler pattern matching
rg 'NavBar' --type-list | head -5Repository: asyncapi/website Length of output: 449 🏁 Script executed: # Try searching for NavBar usage in JavaScript/TypeScript files
rg '<NavBar' -g '!NavBar.tsx' -C2 | head -80Repository: asyncapi/website Length of output: 311 🏁 Script executed: # Check the exact indentation at line 149 using od or hexdump
sed -n '149p' components/navigation/NavBar.tsx | od -c | head -20Repository: asyncapi/website Length of output: 100 🏁 Script executed: # Check prettier config file if it exists
cat .prettierrc .prettierrc.json .prettierrc.js 2>/dev/null | head -50Repository: asyncapi/website Length of output: 42 🏁 Script executed: # Count exact spaces in line 149 using sed and printf
sed -n '149p' components/navigation/NavBar.tsx | sed 's/[^ ].*//' | wc -cRepository: asyncapi/website Length of output: 61 🏁 Script executed: # Count exact spaces in line 150 for comparison
sed -n '150p' components/navigation/NavBar.tsx | sed 's/[^ ].*//' | wc -cRepository: asyncapi/website Length of output: 61 🏁 Script executed: # Check lines 148-150 context with visible spaces
sed -n '148,150p' components/navigation/NavBar.tsx | cat -ARepository: asyncapi/website Length of output: 232 Fix indentation to resolve prettier formatting error. The twMerge usage is correct and properly merges the base Tailwind classes with passed className prop—verified against the actual usage in Line 149 has incorrect indentation (5 spaces instead of 4). This is causing the prettier pipeline failure. Fix- <div className={twMerge('bg-white z-50', className)}>
+ <div className={twMerge('bg-white z-50', className)}>📝 Committable suggestion
Suggested change
🧰 Tools🪛 GitHub Actions: PR testing - if Node project[error] 149-149: Prettier: Delete whitespace character prettier/prettier 🤖 Prompt for AI Agents |
||||||
| <div className='flex w-full items-center justify-between py-6 lg:justify-start lg:space-x-2'> | ||||||
| {!hideLogo && ( | ||||||
| <div className='lg:w-auto lg:flex-1'> | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix import order and remove extra blank lines.
The pipeline is still failing due to formatting violations:
no-multiple-empty-linesrule🔎 Fix by running autofix
Run the project's autofix command to automatically resolve import sorting and formatting:
Or manually ensure imports follow this order:
Remove extra blank lines at line 11.
🧰 Tools
🪛 GitHub Actions: PR testing - if Node project
[error] 11-11: Delete
⏎prettier/prettier[error] 11-11: More than 1 blank line not allowed. no-multiple-empty-lines
🤖 Prompt for AI Agents