React 18 and Vite (#4510)
This commit is contained in:
parent
1bb1b13f6d
commit
21613fa602
244 changed files with 4547 additions and 8933 deletions
|
@ -1,10 +1,11 @@
|
|||
import React, { useState } from 'react';
|
||||
import type { ComponentProps, ComponentType, FunctionComponent } from 'react';
|
||||
import { useState } from 'react';
|
||||
import { Dialog, DialogProps, DialogWrapperContext, WrapperProps } from '@/components/elements/dialog';
|
||||
|
||||
function asDialog(
|
||||
initialProps?: WrapperProps
|
||||
initialProps?: WrapperProps,
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
): <P extends {}>(C: React.ComponentType<P>) => React.FunctionComponent<P & DialogProps> {
|
||||
): <P extends {}>(C: ComponentType<P>) => FunctionComponent<P & DialogProps> {
|
||||
return function (Component) {
|
||||
return function ({ open, onClose, ...rest }) {
|
||||
const [props, setProps] = useState<WrapperProps>(initialProps || {});
|
||||
|
@ -12,7 +13,7 @@ function asDialog(
|
|||
return (
|
||||
<DialogWrapperContext.Provider value={{ props, setProps, close: onClose }}>
|
||||
<Dialog {...props} open={open} onClose={onClose}>
|
||||
<Component {...(rest as React.ComponentProps<typeof Component>)} />
|
||||
<Component {...(rest as unknown as ComponentProps<typeof Component>)} />
|
||||
</Dialog>
|
||||
</DialogWrapperContext.Provider>
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue