aboutsummaryrefslogtreecommitdiff
path: root/packages/ui/src/utils.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'packages/ui/src/utils.tsx')
-rw-r--r--packages/ui/src/utils.tsx14
1 files changed, 7 insertions, 7 deletions
diff --git a/packages/ui/src/utils.tsx b/packages/ui/src/utils.tsx
index 5ccb488..67782bb 100644
--- a/packages/ui/src/utils.tsx
+++ b/packages/ui/src/utils.tsx
@@ -1,16 +1,16 @@
import clsx from 'clsx';
import React from 'react';
-const twFactory =
- (element: any) =>
- ([newClassNames, ..._]: TemplateStringsArray) =>
+function twFactory(element: any) {
+ return ([newClassNames, ..._]: TemplateStringsArray) =>
React.forwardRef(({ className, ...props }: any, ref) =>
React.createElement(element, {
...props,
className: clsx(newClassNames, className),
- ref
- })
+ ref,
+ }),
);
+}
type ClassnameFactory<T> = (s: TemplateStringsArray) => T;
@@ -19,10 +19,10 @@ type TailwindFactory = {
React.ForwardRefExoticComponent<JSX.IntrinsicElements[K]>
>;
} & {
- <T>(c: T): ClassnameFactory<T>;
+ <T>(c: T): ClassnameFactory<T>
};
export const tw = new Proxy((() => {}) as unknown as TailwindFactory, {
get: (_, property: string) => twFactory(property),
- apply: (_, __, [el]: [React.ReactElement]) => twFactory(el)
+ apply: (_, __, [el]: [React.ReactElement]) => twFactory(el),
});