mirror of
https://github.com/coollabsio/coolify-examples.git
synced 2026-03-06 21:28:03 +00:00
laravel pure
This commit is contained in:
18
laravel-pure/resources/js/lib/utils.ts
Normal file
18
laravel-pure/resources/js/lib/utils.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
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