From 396836deddae750f7cb8de7b464fdac1a47feb19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BF=BD=E5=A6=82=E5=AF=84?= Date: Fri, 25 Mar 2022 08:45:36 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E2=99=BB=EF=B8=8F=20del=20children?= =?UTF-8?q?=20type=20(#3283)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * refactor: 🔧 del unnecessary children type Change-Id: I3dea5e07f5401bdbdd168eb959fe361c57784167 * feat: 💄 eslint Change-Id: Ie173adeca9e3112d8cdfc1f85964332105dcb424 * feat: 🔧 add css type Change-Id: I8850c4d09b152f4d9c4d98e6eebca58bd9eecd37 * fix: 💄 ci lint Change-Id: I69ff89c7a30e2bdcd26475ec83f3f5ec143121b6 --- app/components/Analytics.ts | 6 +--- app/components/AuthenticatedLayout.tsx | 5 +-- app/components/Breadcrumb.tsx | 8 +++-- app/components/ButtonLink.tsx | 3 +- app/components/CenteredContent.tsx | 3 +- app/components/DocumentBreadcrumb.tsx | 7 ++-- app/components/ErrorBoundary.tsx | 1 - app/components/EventBoundary.tsx | 7 ++-- app/components/Guide.tsx | 5 ++- app/components/Labeled.tsx | 3 +- app/components/Layout.tsx | 5 ++- app/components/Modal.tsx | 5 ++- app/scenes/Settings/components/SettingRow.tsx | 25 +++++++++----- server/emails/components/Body.tsx | 32 ++++++++--------- server/emails/components/Button.tsx | 34 +++++++++---------- server/emails/components/EmailLayout.tsx | 10 +++--- server/emails/components/Heading.tsx | 7 ++-- 17 files changed, 80 insertions(+), 86 deletions(-) diff --git a/app/components/Analytics.ts b/app/components/Analytics.ts index 1bf1e5d94..044c6718f 100644 --- a/app/components/Analytics.ts +++ b/app/components/Analytics.ts @@ -2,11 +2,7 @@ import * as React from "react"; import env from "~/env"; -type Props = { - children?: React.ReactNode; -}; - -export default class Analytics extends React.Component { +export default class Analytics extends React.Component { componentDidMount() { if (!env.GOOGLE_ANALYTICS_ID) { return; diff --git a/app/components/AuthenticatedLayout.tsx b/app/components/AuthenticatedLayout.tsx index 11ad15b11..50d9c1c96 100644 --- a/app/components/AuthenticatedLayout.tsx +++ b/app/components/AuthenticatedLayout.tsx @@ -34,10 +34,7 @@ const CommandBar = React.lazy( ) ); -type Props = WithTranslation & - RootStore & { - children?: React.ReactNode; - }; +type Props = WithTranslation & RootStore; @observer class AuthenticatedLayout extends React.Component { diff --git a/app/components/Breadcrumb.tsx b/app/components/Breadcrumb.tsx index 7ad14c482..b0c3d205e 100644 --- a/app/components/Breadcrumb.tsx +++ b/app/components/Breadcrumb.tsx @@ -9,11 +9,15 @@ import { MenuInternalLink } from "~/types"; type Props = { items: MenuInternalLink[]; max?: number; - children?: React.ReactNode; highlightFirstItem?: boolean; }; -function Breadcrumb({ items, highlightFirstItem, children, max = 2 }: Props) { +function Breadcrumb({ + items, + highlightFirstItem, + children, + max = 2, +}: React.PropsWithChildren) { const totalItems = items.length; const topLevelItems: MenuInternalLink[] = [...items]; let overflowItems; diff --git a/app/components/ButtonLink.tsx b/app/components/ButtonLink.tsx index 4c14c1664..4d3463928 100644 --- a/app/components/ButtonLink.tsx +++ b/app/components/ButtonLink.tsx @@ -3,10 +3,9 @@ import styled from "styled-components"; type Props = { onClick?: React.MouseEventHandler; - children: React.ReactNode; }; -const ButtonLink = React.forwardRef( +const ButtonLink: React.FC = React.forwardRef( (props: Props, ref: React.Ref) => { return