From 37a135d49e5ce146a38707162e08e6bea2fe62f7 Mon Sep 17 00:00:00 2001 From: Himself65 Date: Sat, 18 Mar 2023 01:03:32 -0400 Subject: [PATCH] fix: warning on bypass visible value in switch button (#1607) --- .../components/affine/sidebar-switch/style.ts | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/apps/web/src/components/affine/sidebar-switch/style.ts b/apps/web/src/components/affine/sidebar-switch/style.ts index b0f26b2314..a582f1f68e 100644 --- a/apps/web/src/components/affine/sidebar-switch/style.ts +++ b/apps/web/src/components/affine/sidebar-switch/style.ts @@ -1,10 +1,12 @@ import { IconButton, styled } from '@affine/component'; -export const StyledSidebarSwitch = styled(IconButton)<{ visible: boolean }>( - ({ visible }) => { - return { - opacity: visible ? 1 : 0, - transition: 'all 0.2s ease-in-out', - }; - } -); +export const StyledSidebarSwitch = styled(IconButton, { + shouldForwardProp(propName: PropertyKey) { + return propName !== 'visible'; + }, +})<{ visible: boolean }>(({ visible }) => { + return { + opacity: visible ? 1 : 0, + transition: 'all 0.2s ease-in-out', + }; +});