Skip to content

Commit

Permalink
feat: rename clsxm utility (#6)
Browse files Browse the repository at this point in the history
* feat: rename clsxm utils

* feat: add new type for page props
  • Loading branch information
fahmiidris authored Jan 6, 2024
1 parent 438f65a commit 0e62f7d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import '@/styles/main.css';

import * as React from 'react';

import clsxm from '@/utils/clsxm';
import cn from '@/utils/cn';

import type { Metadata } from 'next';
import type { TLayoutProps } from '@/types/layout.type';
Expand All @@ -21,7 +21,7 @@ export const metadata: Metadata = {

export default function Layout({ children }: TLayoutProps) {
return (
<html lang="en" className={clsxm('scroll-smooth [--scroll-mt:9.875rem]', 'lg:[--scroll-mt:6.3125rem]')}>
<html lang="en" className={cn(['scroll-smooth [--scroll-mt:9.875rem]', 'lg:[--scroll-mt:6.3125rem]'])}>
<body className="bg-white font-sans text-slate-500 antialiased">{children}</body>
</html>
);
Expand Down
4 changes: 4 additions & 0 deletions src/types/page.type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export type TPageProps<P = unknown, SP = Record<string, string | string[] | undefined>> = {
params: P;
searchParams: SP;
};
3 changes: 1 addition & 2 deletions src/utils/clsxm.ts → src/utils/cn.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { twMerge } from 'tailwind-merge';

import clsx, { type ClassArray } from 'clsx';

export default function clsxm(...classNames: ClassArray) {
export default function cn(...classNames: ClassArray) {
return twMerge(clsx(classNames));
}

0 comments on commit 0e62f7d

Please sign in to comment.