refactor: PropsWithChildren
This commit is contained in:
@@ -1,13 +1,12 @@
|
||||
import { FC, ReactNode, useEffect, useState } from "react";
|
||||
import { FC, useEffect, useState, PropsWithChildren } from "react";
|
||||
import { createPortal } from "react-dom";
|
||||
|
||||
interface Props {
|
||||
id?: string;
|
||||
mask?: boolean;
|
||||
children?: ReactNode;
|
||||
}
|
||||
|
||||
const Modal: FC<Props> = ({ id = "root-modal", mask = true, children }) => {
|
||||
const Modal: FC<PropsWithChildren<Props>> = ({ id = "root-modal", mask = true, children }) => {
|
||||
const [wrapper, setWrapper] = useState<HTMLDivElement | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { FC, ReactNode } from "react";
|
||||
import { FC, PropsWithChildren, ReactNode } from "react";
|
||||
import styled from "styled-components";
|
||||
import { useLocation, NavLink } from "react-router-dom";
|
||||
import backIcon from "../../assets/icons/arrow.left.svg?url";
|
||||
@@ -102,10 +102,9 @@ interface Props {
|
||||
navs: Nav[];
|
||||
dangers: [Danger | boolean];
|
||||
nav: { title: string; name?: string; component?: ReactNode };
|
||||
children: ReactNode;
|
||||
}
|
||||
|
||||
const StyledSettingContainer: FC<Props> = ({
|
||||
const StyledSettingContainer: FC<PropsWithChildren<Props>> = ({
|
||||
closeModal,
|
||||
title = "Settings",
|
||||
navs = [],
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// import React from 'react'
|
||||
import Tippy, { TippyProps } from "@tippyjs/react";
|
||||
import styled from "styled-components";
|
||||
import { FC, ReactElement } from "react";
|
||||
import { FC } from "react";
|
||||
|
||||
const StyledTip = styled.div`
|
||||
position: relative;
|
||||
@@ -39,18 +39,11 @@ const StyledTip = styled.div`
|
||||
}
|
||||
`;
|
||||
|
||||
interface IProps extends TippyProps {
|
||||
type Props = {
|
||||
tip: string;
|
||||
children: ReactElement;
|
||||
}
|
||||
} & TippyProps;
|
||||
|
||||
const Tooltip: FC<IProps> = ({
|
||||
tip = "",
|
||||
placement = "right",
|
||||
delay = null,
|
||||
children,
|
||||
...rest
|
||||
}) => {
|
||||
const Tooltip: FC<Props> = ({ tip = "", placement = "right", delay = null, children, ...rest }) => {
|
||||
const defaultDuration: [number, number] = [300, 250];
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user