[WEB-5459] feat(codemods): add function declaration transformer with tests (#8137)
- Add jscodeshift-based codemod to convert arrow function components to function declarations - Support React.FC, observer-wrapped, and forwardRef components - Include comprehensive test suite covering edge cases - Add npm script to run transformer across codebase - Target only .tsx files in source directories, excluding node_modules and declaration files * [WEB-5459] chore: updates after running codemod --------- Co-authored-by: sriramveeraghanta <veeraghanta.sriram@gmail.com>
This commit is contained in:
parent
90866fb925
commit
83fdebf64d
1771 changed files with 17003 additions and 13856 deletions
|
|
@ -13,7 +13,8 @@ export interface HeaderProps {
|
|||
}
|
||||
|
||||
const HeaderContext = React.createContext<THeaderVariant | null>(null);
|
||||
const Header = (props: HeaderProps) => {
|
||||
|
||||
function Header(props: HeaderProps) {
|
||||
const {
|
||||
variant = EHeaderVariant.PRIMARY,
|
||||
className = "",
|
||||
|
|
@ -35,19 +36,22 @@ const Header = (props: HeaderProps) => {
|
|||
</Row>
|
||||
</HeaderContext.Provider>
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
const LeftItem = (props: HeaderProps) => (
|
||||
<div
|
||||
className={cn(
|
||||
"flex flex-wrap items-center gap-2 overflow-ellipsis whitespace-nowrap max-w-[80%] flex-grow",
|
||||
props.className
|
||||
)}
|
||||
>
|
||||
{props.children}
|
||||
</div>
|
||||
);
|
||||
const RightItem = (props: HeaderProps) => {
|
||||
function LeftItem(props: HeaderProps) {
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
"flex flex-wrap items-center gap-2 overflow-ellipsis whitespace-nowrap max-w-[80%] flex-grow",
|
||||
props.className
|
||||
)}
|
||||
>
|
||||
{props.children}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function RightItem(props: HeaderProps) {
|
||||
const variant = React.useContext(HeaderContext);
|
||||
if (variant === undefined) throw new Error("RightItem must be used within Header");
|
||||
return (
|
||||
|
|
@ -63,7 +67,7 @@ const RightItem = (props: HeaderProps) => {
|
|||
{props.children}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
Header.LeftItem = LeftItem;
|
||||
Header.RightItem = RightItem;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue