-
-
Notifications
You must be signed in to change notification settings - Fork 96
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
Improved accessibility and Fixed main nav active states #110
Conversation
@SameerJadav is attempting to deploy a commit to the t3-oss Team on Vercel. A member of the Team first needs to authorize it. |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
docs/next.config.mjs
Outdated
@@ -7,6 +7,7 @@ import { getHighlighter } from "shiki"; | |||
|
|||
/** @type {import('next').NextConfig} */ | |||
const nextConfig = { | |||
swcMinify: true, |
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.
this is on by default iirc
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.
yes, it is the default js compiler. i'll remove it from the config
export function MainNav(props: { items: NavItem[] }) { | ||
const pathname = usePathname(); | ||
function isActive(href: string) { | ||
const segment = useSelectedLayoutSegment(); |
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.
this doesn't adhere to rules of hooks
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.
i have moved it inside the component
export function MainNav() {
const segment = useSelectedLayoutSegment();
const isActive = (href: string) => {
if (!segment) return false;
return href.startsWith(`/${segment}`);
};
// ...
}
is this okay?? if it is i will commit it
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.
I have changed the docs site to make it more accessible and improve SEO. I also fixed the issue where the main navigation links were not showing in their active state. Here are the details of the changes we made:
useSelectedLayoutSegment()
hoverOnlyWhenSupported
, which will prevent any hover styles from being shipped to devices that don't support hover (phones). You can look at the PR this feature was introduced in Only apply hover styles when supported (future) tailwindlabs/tailwindcss#8394We can also use 'next/images' in the docs and get all the benefits like lazy loading, blur placeholder, etc. and increase the performance even more. However, implementing this would require downloading each image.
Take your time to review the changes. I'm totally up for any feedback or suggestions you might have.