From e9d485fe3b5db8c426ac03b30ed8917df0baa62d Mon Sep 17 00:00:00 2001 From: Pauline Date: Sun, 26 Nov 2023 17:13:07 -0500 Subject: feat(lint): switch to eslint config and formatting (use vscode for autoformat) --- packages/ui/src/utils.tsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'packages/ui/src/utils.tsx') 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 = (s: TemplateStringsArray) => T; @@ -19,10 +19,10 @@ type TailwindFactory = { React.ForwardRefExoticComponent >; } & { - (c: T): ClassnameFactory; + (c: T): ClassnameFactory }; 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), }); -- cgit