Installed Laravel
This commit is contained in:
15
resources/js/lib/utils.ts
Normal file
15
resources/js/lib/utils.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { InertiaLinkProps } from '@inertiajs/vue3';
|
||||
import { clsx, type ClassValue } from 'clsx';
|
||||
import { twMerge } from 'tailwind-merge';
|
||||
|
||||
export function cn(...inputs: ClassValue[]) {
|
||||
return twMerge(clsx(inputs));
|
||||
}
|
||||
|
||||
export function urlIsActive(urlToCheck: NonNullable<InertiaLinkProps['href']>, currentUrl: string) {
|
||||
return toUrl(urlToCheck) === currentUrl;
|
||||
}
|
||||
|
||||
export function toUrl(href: NonNullable<InertiaLinkProps['href']>) {
|
||||
return typeof href === 'string' ? href : href?.url;
|
||||
}
|
||||
Reference in New Issue
Block a user