There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.
TypeScript appcrdteditorelectronknowledge-basemarkdownmironotesnotionnotion-alternativerustrust-langrust-languagetabletableviewwhiteboardwikiworkspace
chore: simplify panel
lawvs196fe993b30f
diff --git a/libs/components/editor-blocks/src/blocks/group/components/Panel.tsx b/libs/components/editor-blocks/src/blocks/group/components/Panel.tsxindex b9557ba7a8..e8faba84a1 100644--- a/libs/components/editor-blocks/src/blocks/group/components/Panel.tsx+++ b/libs/components/editor-blocks/src/blocks/group/components/Panel.tsx@@ -1,33 +1,25 @@import { styled } from '@toeverything/components/ui';-import type { ReactNode, MouseEvent, CSSProperties } from 'react';+import type { ComponentPropsWithRef, MouseEvent } from 'react';+import { forwardRef } from 'react';-const StyledPanel = styled('div')<{ extraStyle?: CSSProperties }>(- ({ extraStyle }) => ({- position: 'absolute',- top: 50,- background: '#FFFFFF',- boxShadow: '0px 1px 10px rgba(152, 172, 189, 0.6)',- borderRadius: 10,- padding: '12px 24px',- ...extraStyle,- })-);+const StyledPanel = styled('div')(() => ({+ position: 'absolute',+ top: 50,+ background: '#FFFFFF',+ boxShadow: '0px 1px 10px rgba(152, 172, 189, 0.6)',+ borderRadius: 10,+ padding: '12px 24px',+}));-const Panel = ({- children,- extraStyle,-}: {- children: ReactNode;- extraStyle?: CSSProperties;-}) => {- const stopPropagation = (e: MouseEvent<HTMLDivElement>) =>- e.stopPropagation();+const Panel = forwardRef<HTMLDivElement, ComponentPropsWithRef<'div'>>(+ ({ onClick, ...rest }, ref) => {+ const stopPropagation = (e: MouseEvent<HTMLDivElement>) => {+ onClick?.(e);+ e.stopPropagation();+ };- return (- <StyledPanel style={extraStyle} onClick={stopPropagation}>- {children}- </StyledPanel>- );-};+ return <StyledPanel ref={ref} onClick={stopPropagation} {...rest} />;+ }+);export { Panel };diff --git a/libs/components/editor-blocks/src/blocks/group/components/group-by/GroupBy.tsx b/libs/components/editor-blocks/src/blocks/group/components/group-by/GroupBy.tsxindex 9ac3bff713..475157b082 100644--- a/libs/components/editor-blocks/src/blocks/group/components/group-by/GroupBy.tsx+++ b/libs/components/editor-blocks/src/blocks/group/components/group-by/GroupBy.tsx@@ -62,7 +62,7 @@ const GroupBy = ({ closePanel }: { closePanel: () => void }) => {};return (- <Panel extraStyle={panelStyle}>+ <Panel style={panelStyle}><Item disabled><div>COLUMN</div></Item>diff --git a/libs/components/editor-blocks/src/blocks/group/components/sorter/Sorter.tsx b/libs/components/editor-blocks/src/blocks/group/components/sorter/Sorter.tsxindex 4fba8c9520..0ee2b3f994 100644--- a/libs/components/editor-blocks/src/blocks/group/components/sorter/Sorter.tsx+++ b/libs/components/editor-blocks/src/blocks/group/components/sorter/Sorter.tsx@@ -24,7 +24,7 @@ const Sorter = ({};return (- <Panel extraStyle={extraStyle}>+ <Panel style={extraStyle}><GroupBySelector /><div><Title>