Update nesting of Button and Link components
The Link component is modified to be nested within the Button component in various JSX files. This change was made with the aid of the 'asChild' property, it ensures that the link remains operable even when wrapped by the button, improving the site's semantics and accessibility.
This commit is contained in:
@@ -71,15 +71,15 @@ function AuthButtons() {
|
|||||||
<div className={'hidden space-x-0.5 md:flex'}>
|
<div className={'hidden space-x-0.5 md:flex'}>
|
||||||
<ModeToggle className={textClassName} />
|
<ModeToggle className={textClassName} />
|
||||||
|
|
||||||
<Link href={pathsConfig.auth.signIn}>
|
<Button asChild variant={'ghost'} className={textClassName}>
|
||||||
<Button variant={'ghost'} className={textClassName}>
|
<Link href={pathsConfig.auth.signIn}>
|
||||||
<Trans i18nKey={'auth:signIn'} />
|
<Trans i18nKey={'auth:signIn'} />
|
||||||
</Button>
|
</Link>
|
||||||
</Link>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Link href={pathsConfig.auth.signUp}>
|
<Button asChild className="group" variant={'default'}>
|
||||||
<Button className="group" variant={'default'}>
|
<Link href={pathsConfig.auth.signUp}>
|
||||||
<Trans i18nKey={'auth:signUp'} />
|
<Trans i18nKey={'auth:signUp'} />
|
||||||
|
|
||||||
<ChevronRight
|
<ChevronRight
|
||||||
@@ -87,8 +87,8 @@ function AuthButtons() {
|
|||||||
'ml-1 h-4 w-4 transition-transform duration-500 group-hover:translate-x-1'
|
'ml-1 h-4 w-4 transition-transform duration-500 group-hover:translate-x-1'
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</Button>
|
</Link>
|
||||||
</Link>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ function MobileDropdown() {
|
|||||||
const className = 'flex w-full h-full items-center';
|
const className = 'flex w-full h-full items-center';
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DropdownMenuItem key={item.path}>
|
<DropdownMenuItem key={item.path} asChild>
|
||||||
<Link className={className} href={item.path}>
|
<Link className={className} href={item.path}>
|
||||||
<Trans i18nKey={item.label} />
|
<Trans i18nKey={item.label} />
|
||||||
</Link>
|
</Link>
|
||||||
|
|||||||
@@ -86,15 +86,15 @@ async function FAQPage() {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<Link href={'/contact'}>
|
<Button variant={'outline'}>
|
||||||
<Button variant={'outline'}>
|
<Link asChild href={'/contact'}>
|
||||||
<span>
|
<span>
|
||||||
<Trans i18nKey={'marketing:contactFaq'} />
|
<Trans i18nKey={'marketing:contactFaq'} />
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<ArrowRight className={'ml-2 w-4'} />
|
<ArrowRight className={'ml-2 w-4'} />
|
||||||
</Button>
|
</Link>
|
||||||
</Link>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -347,14 +347,14 @@ function FeatureContainer(
|
|||||||
function MainCallToActionButton() {
|
function MainCallToActionButton() {
|
||||||
return (
|
return (
|
||||||
<div className={'flex space-x-2'}>
|
<div className={'flex space-x-2'}>
|
||||||
<Link href={'/docs'}>
|
<Button asChild variant={'link'}>
|
||||||
<Button variant={'link'}>
|
<Link href={'/docs'}>
|
||||||
<Trans i18nKey={'common:documentation'} />
|
<Trans i18nKey={'common:documentation'} />
|
||||||
</Button>
|
</Link>
|
||||||
</Link>
|
</Button>
|
||||||
|
|
||||||
<Link href={'/auth/sign-up'}>
|
<Button asChild>
|
||||||
<Button>
|
<Link href={'/auth/sign-up'}>
|
||||||
<span className={'flex items-center space-x-0.5'}>
|
<span className={'flex items-center space-x-0.5'}>
|
||||||
<span>
|
<span>
|
||||||
<Trans i18nKey={'common:getStarted'} />
|
<Trans i18nKey={'common:getStarted'} />
|
||||||
@@ -367,8 +367,8 @@ function MainCallToActionButton() {
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
</Button>
|
</Link>
|
||||||
</Link>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ function AuthCallbackErrorPage({ searchParams }: Params) {
|
|||||||
</Alert>
|
</Alert>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Button>
|
<Button asChild>
|
||||||
<Link href={signInPath}>
|
<Link href={signInPath}>
|
||||||
<Trans i18nKey={'auth:signIn'} />
|
<Trans i18nKey={'auth:signIn'} />
|
||||||
</Link>
|
</Link>
|
||||||
|
|||||||
@@ -31,11 +31,11 @@ function PasswordResetPage() {
|
|||||||
<PasswordResetRequestContainer redirectPath={redirectPath} />
|
<PasswordResetRequestContainer redirectPath={redirectPath} />
|
||||||
|
|
||||||
<div className={'flex justify-center text-xs'}>
|
<div className={'flex justify-center text-xs'}>
|
||||||
<Link href={signIn}>
|
<Button asChild variant={'link'} size={'sm'}>
|
||||||
<Button variant={'link'} size={'sm'}>
|
<Link href={signIn}>
|
||||||
<Trans i18nKey={'auth:passwordRecoveredQuestion'} />
|
<Trans i18nKey={'auth:passwordRecoveredQuestion'} />
|
||||||
</Button>
|
</Link>
|
||||||
</Link>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -33,11 +33,11 @@ function SignInPage() {
|
|||||||
<SignInMethodsContainer paths={paths} providers={authConfig.providers} />
|
<SignInMethodsContainer paths={paths} providers={authConfig.providers} />
|
||||||
|
|
||||||
<div className={'flex justify-center'}>
|
<div className={'flex justify-center'}>
|
||||||
<Link href={pathsConfig.auth.signUp}>
|
<Button asChild variant={'link'} size={'sm'}>
|
||||||
<Button variant={'link'} size={'sm'}>
|
<Link href={pathsConfig.auth.signUp}>
|
||||||
<Trans i18nKey={'auth:doNotHaveAccountYet'} />
|
<Trans i18nKey={'auth:doNotHaveAccountYet'} />
|
||||||
</Button>
|
</Link>
|
||||||
</Link>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -45,11 +45,11 @@ function SignUpPage({ searchParams }: Props) {
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<div className={'justify-centers flex'}>
|
<div className={'justify-centers flex'}>
|
||||||
<Link href={pathsConfig.auth.signIn}>
|
<Button asChild variant={'link'} size={'sm'}>
|
||||||
<Button variant={'link'} size={'sm'}>
|
<Link href={pathsConfig.auth.signIn}>
|
||||||
<Trans i18nKey={'auth:alreadyHaveAnAccount'} />
|
<Trans i18nKey={'auth:alreadyHaveAnAccount'} />
|
||||||
</Button>
|
</Link>
|
||||||
</Link>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -119,12 +119,12 @@ function InviteNotFoundOrExpired() {
|
|||||||
<Trans i18nKey={'teams:inviteNotFoundOrExpiredDescription'} />
|
<Trans i18nKey={'teams:inviteNotFoundOrExpiredDescription'} />
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<Link href={pathsConfig.app.home}>
|
<Button asChild className={'w-full'} variant={'outline'}>
|
||||||
<Button className={'w-full'} variant={'outline'}>
|
<Link href={pathsConfig.app.home}>
|
||||||
<ArrowLeft className={'mr-2 w-4'} />
|
<ArrowLeft className={'mr-2 w-4'} />
|
||||||
<Trans i18nKey={'teams:backToHome'} />
|
<Trans i18nKey={'teams:backToHome'} />
|
||||||
</Button>
|
</Link>
|
||||||
</Link>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,13 +56,13 @@ const NotFoundPage = async () => {
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Link href={'/'}>
|
<Button asChild variant={'outline'}>
|
||||||
<Button variant={'outline'}>
|
<Link href={'/'}>
|
||||||
<ArrowLeft className={'mr-2 h-4'} />
|
<ArrowLeft className={'mr-2 h-4'} />
|
||||||
|
|
||||||
<Trans i18nKey={'common:backToHomePage'} />
|
<Trans i18nKey={'common:backToHomePage'} />
|
||||||
</Button>
|
</Link>
|
||||||
</Link>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -88,16 +88,17 @@ export const PasswordSignInForm: React.FC<{
|
|||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
|
|
||||||
<Link href={'/auth/password-reset'}>
|
<Button
|
||||||
<Button
|
asChild
|
||||||
type={'button'}
|
type={'button'}
|
||||||
size={'sm'}
|
size={'sm'}
|
||||||
variant={'link'}
|
variant={'link'}
|
||||||
className={'text-xs'}
|
className={'text-xs'}
|
||||||
>
|
>
|
||||||
|
<Link href={'/auth/password-reset'}>
|
||||||
<Trans i18nKey={'auth:passwordForgottenQuestion'} />
|
<Trans i18nKey={'auth:passwordForgottenQuestion'} />
|
||||||
</Button>
|
</Link>
|
||||||
</Link>
|
</Button>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -164,14 +164,15 @@ export function SidebarItem({
|
|||||||
const size = collapsed ? 'icon' : 'sm';
|
const size = collapsed ? 'icon' : 'sm';
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Link key={path} href={path}>
|
<Button
|
||||||
<Button
|
asChild
|
||||||
className={cn('flex w-full text-sm shadow-none', {
|
className={cn('flex w-full text-sm shadow-none', {
|
||||||
'justify-start space-x-2': !collapsed,
|
'justify-start space-x-2': !collapsed,
|
||||||
})}
|
})}
|
||||||
size={size}
|
size={size}
|
||||||
variant={variant}
|
variant={variant}
|
||||||
>
|
>
|
||||||
|
<Link key={path} href={path}>
|
||||||
<If condition={collapsed} fallback={Icon}>
|
<If condition={collapsed} fallback={Icon}>
|
||||||
<TooltipProvider>
|
<TooltipProvider>
|
||||||
<Tooltip>
|
<Tooltip>
|
||||||
@@ -185,8 +186,8 @@ export function SidebarItem({
|
|||||||
</If>
|
</If>
|
||||||
|
|
||||||
<span className={cn({ hidden: collapsed })}>{children}</span>
|
<span className={cn({ hidden: collapsed })}>{children}</span>
|
||||||
</Button>
|
</Link>
|
||||||
</Link>
|
</Button>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user