fix: react warning

This commit is contained in:
QiShaoXuan
2022-12-12 21:47:15 +08:00
parent a511632d1c
commit 456a1c204b
6 changed files with 38 additions and 14 deletions
@@ -148,7 +148,6 @@ export const Header = ({ children }: PropsWithChildren<{}>) => {
const router = useRouter();
const currentPageMeta = pageList.find(p => p.id === router.query.pageId);
const isTrash = !!currentPageMeta?.trash;
console.log('isTrash', isTrash);
return (
<StyledHeaderContainer hasWarning={showWarning}>
<BrowserWarning
@@ -52,7 +52,7 @@ export const PageHeader = () => {
<StyledSearchArrowWrapper>
<IconButton
onClick={() => {
triggerQuickSearchModal(true);
triggerQuickSearchModal();
}}
>
<MiddleIconArrowDownSmallIcon />
+21 -2
View File
@@ -3,7 +3,20 @@ import { CSSProperties } from 'react';
import { ButtonProps } from '@/ui/button/interface';
import { getSize, getButtonColors } from './utils';
export const StyledIconButton = styled.button<{
export const StyledIconButton = styled('button', {
shouldForwardProp: prop => {
return ![
'borderRadius',
'top',
'right',
'width',
'height',
'hoverBackground',
'hoverColor',
'hoverStyle',
].includes(prop);
},
})<{
width: number;
height: number;
borderRadius: number;
@@ -55,7 +68,13 @@ export const StyledIconButton = styled.button<{
};
}
);
export const StyledButton = styled.button<
export const StyledButton = styled('button', {
shouldForwardProp: prop => {
return !['hoverBackground', 'hoverColor', 'hoverStyle', 'type'].includes(
prop
);
},
})<
Pick<
ButtonProps,
| 'size'
+13 -1
View File
@@ -12,7 +12,19 @@ export type WrapperProps = {
};
// Sometimes we just want to wrap a component with a div to set flex or other styles, but we don't want to create a new component for it.
export const Wrapper = styled.div<WrapperProps>(
export const Wrapper = styled('button', {
shouldForwardProp: prop => {
return ![
'display',
'justifyContent',
'alignItems',
'flexWrap',
'flexDirection',
'flexShrink',
'flexGrow',
].includes(prop);
},
})<WrapperProps>(
({
display = 'flex',
justifyContent = 'flex-start',
+3 -8
View File
@@ -24,9 +24,8 @@ export const StyledArrow = styled(MiddleArrowRightIcon)(({ theme }) => {
});
export const StyledMenuItem = styled.button<{
popperVisible?: boolean;
isDir?: boolean;
}>(({ theme, popperVisible, isDir = false }) => {
}>(({ theme, isDir = false }) => {
return {
width: '100%',
borderRadius: '5px',
@@ -36,12 +35,8 @@ export const StyledMenuItem = styled.button<{
...displayFlex('flex-start', 'center'),
cursor: isDir ? 'pointer' : '',
position: 'relative',
color: popperVisible
? theme.colors.primaryColor
: theme.colors.popoverColor,
backgroundColor: popperVisible
? theme.colors.hoverBackground
: 'transparent',
color: theme.colors.popoverColor,
backgroundColor: 'transparent',
':hover': {
color: theme.colors.primaryColor,
-1
View File
@@ -117,7 +117,6 @@ export const Popper = ({
onPointerEnter: onPointerEnterHandler,
onPointerLeave: onPointerLeaveHandler,
className: anchorClassName,
popperVisible: visible,
})}
{content && (
<BasicStyledPopper