Skip to content

Commit dee6100

Browse files
fix(tailwind): resolve custom classNames recognition
1 parent 37052b2 commit dee6100

File tree

9 files changed

+30
-23
lines changed

9 files changed

+30
-23
lines changed

app/[locale]/institute/sections/library/collection-and-resources/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ export default async function CollectionAndResources({
125125
</section>
126126

127127
<section className="container my-10">
128-
<Table scrollAreaClassName="h-96">
128+
<Table classNames={{ scrollArea: 'h-96' }}>
129129
<TableHeader>
130130
<TableRow>
131131
<TableHead>{text.eResourcesTable.heading.srno}</TableHead>

app/[locale]/login/login.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const Login = async ({ locale }: { locale: string }) => {
2626
</header>
2727
<section className="w-full space-y-4 md:space-y-6">
2828
<Input
29-
inputClassName="sm:px-4 sm:py-3 md:px-5 md:py-4"
29+
classNames={{ input: 'sm:px-4 sm:py-3 md:px-5 md:py-4' }}
3030
id="email"
3131
label={text.enterEmail}
3232
placeholder="[email protected]"

app/[locale]/search/search.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ export default async function Search({
4444
<Input
4545
debounceTo="query"
4646
id="search"
47-
inputClassName="border-primary-700 focus-visible:ring-primary-700"
47+
classNames={{
48+
input: 'border-primary-700 focus-visible:ring-primary-700',
49+
}}
4850
placeholder={text.placeholder}
4951
type="search"
5052
/>
@@ -269,7 +271,7 @@ const ResultsView = async ({
269271
<h4>{categories[category]}</h4>
270272
{currentCategory === 'all' && (
271273
<BouncyArrowButton
272-
arrowClassName="md:size-2 lg:size-3"
274+
classNames={{ arrow: 'md:size-2 lg:size-3' }}
273275
buttonProps={{
274276
className: cn(
275277
'inline-flex h-fit gap-1 md:gap-2',

components/buttons/bouncy-arrow.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ import { Button, type ButtonProps } from '~/components/buttons';
55
import { cn } from '~/lib/utils';
66

77
export const BouncyArrowButton = ({
8-
arrowClassName,
8+
classNames,
99
buttonProps,
1010
linkProps,
1111
text,
1212
}: {
13-
arrowClassName?: string;
13+
classNames?: { arrow?: string };
1414
buttonProps?: ButtonProps;
1515
linkProps: LinkProps;
1616
text: string;
@@ -23,7 +23,7 @@ export const BouncyArrowButton = ({
2323
className={cn(
2424
'mx-auto animate-bounce',
2525
'size-2 md:size-3 lg:size-4',
26-
arrowClassName
26+
classNames?.arrow
2727
)}
2828
/>
2929
</span>

components/carousels/gallery.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ const GalleryCarousel = ({
1212
carouselProps,
1313
children,
1414
className,
15-
itemClassName,
15+
classNames,
1616
}: {
1717
carouselProps?: CarouselProps;
1818
children: React.ReactNode[];
1919
className?: string;
20-
itemClassName?: string;
20+
classNames?: { item?: string };
2121
}) => {
2222
return (
2323
<article className={cn('container relative px-10 lg:px-14', className)}>
@@ -35,7 +35,7 @@ const GalleryCarousel = ({
3535
key={index}
3636
className={cn(
3737
'sm:basis-1/2 lg:basis-1/3 xl:basis-1/4 2xl:basis-1/5',
38-
itemClassName
38+
classNames?.item
3939
)}
4040
>
4141
{child}

components/inputs/input.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export interface InputProps
1919
debounceTo?: string;
2020
description?: string;
2121
id: string;
22-
inputClassName?: string;
22+
classNames?: { input?: string };
2323
label?: string;
2424
reserveSpaceForError?: boolean;
2525
showError?: boolean;
@@ -54,7 +54,7 @@ const Input = forwardRef<HTMLInputElement, InputProps>(
5454
debounceEvery,
5555
debounceTo,
5656
description,
57-
inputClassName,
57+
classNames,
5858
label,
5959
onBlur,
6060
onChange,
@@ -124,7 +124,7 @@ const Input = forwardRef<HTMLInputElement, InputProps>(
124124
focusedOnce &&
125125
'invalid:border-primary-500 invalid:focus-visible:ring-primary-500',
126126
(type === 'checkbox' || type === 'radio') && 'h-5 w-5 ', //incomplete
127-
inputClassName
127+
classNames?.input
128128
)}
129129
onBlur={(event) => {
130130
if (!focusedOnce) setFocusedOnce(true);

components/inputs/multi-select.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export interface MultipleSelectorProps {
5656
/** Group the options base on provided key. */
5757
groupBy?: string;
5858
className?: string;
59-
badgeClassName?: string;
59+
classNames?: { badge?: string };
6060
/**
6161
* First item selected is a default behavior by cmdk. That is why the default is true.
6262
* This is a workaround solution by add a dummy item.
@@ -172,7 +172,7 @@ const MultipleSelector = React.forwardRef<
172172
disabled,
173173
groupBy,
174174
className,
175-
badgeClassName,
175+
classNames,
176176
selectFirstItem = true,
177177
creatable = false,
178178
triggerSearchOnFocus = false,
@@ -375,7 +375,7 @@ const MultipleSelector = React.forwardRef<
375375
className={cn(
376376
'data-[disabled]:cursor-not-allowed data-[disabled]:border-0 data-[disabled]:bg-neutral-200/30 data-[disabled]:ring-0',
377377
'bg-primary-300 data-[fixed]:bg-neutral-400 data-[fixed]:text-neutral-700 data-[fixed]:hover:bg-neutral-400',
378-
badgeClassName
378+
classNames?.badge
379379
)}
380380
>
381381
{option}

components/ui/scroll-area.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ import { cn } from '~/lib/utils';
88
const ScrollArea = forwardRef<
99
React.ElementRef<typeof ScrollAreaPrimitive.Root>,
1010
React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root> & {
11-
scrollBarClassName?: string;
11+
classNames?: {
12+
scrollBar?: string;
13+
};
1214
}
13-
>(({ className, children, scrollBarClassName, ...props }, ref) => (
15+
>(({ children, className, classNames, ...props }, ref) => (
1416
<ScrollAreaPrimitive.Root
1517
ref={ref}
1618
className={cn('relative overflow-hidden', className)}
@@ -20,7 +22,7 @@ const ScrollArea = forwardRef<
2022
<ScrollAreaPrimitive.Viewport className="h-full w-full rounded-[inherit]">
2123
{children}
2224
</ScrollAreaPrimitive.Viewport>
23-
<ScrollBar className={scrollBarClassName} />
25+
<ScrollBar className={classNames?.scrollBar} />
2426
<ScrollAreaPrimitive.Corner />
2527
</ScrollAreaPrimitive.Root>
2628
));

components/ui/table.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,19 @@ import { ScrollArea } from '.';
77
const Table = React.forwardRef<
88
HTMLTableElement,
99
React.HTMLAttributes<HTMLTableElement> & {
10-
scrollAreaClassName?: string;
10+
classNames?: {
11+
scrollArea?: string;
12+
scrollBar?: string;
13+
};
1114
}
12-
>(({ className, scrollAreaClassName, ...props }, ref) => (
15+
>(({ className, classNames, ...props }, ref) => (
1316
<ScrollArea
1417
className={cn(
1518
'relative w-full rounded-md border border-primary-700 shadow-2xl',
1619
'px-2 py-3',
17-
scrollAreaClassName
20+
classNames?.scrollArea
1821
)}
19-
scrollBarClassName="mt-[60px] pb-[60px]"
22+
classNames={{ scrollBar: classNames?.scrollBar ?? 'mt-[60px] pb-[60px]' }}
2023
>
2124
<table
2225
ref={ref}

0 commit comments

Comments
 (0)