feat: update pendant add button

This commit is contained in:
QiShaoXuan
2022-08-12 16:10:05 +08:00
parent ac84c16a4a
commit 7e3df042ec
2 changed files with 25 additions and 3 deletions
@@ -4,7 +4,10 @@ import {
Popover,
type PopoverProps,
PopperHandler,
Tag,
} from '@toeverything/components/ui';
import { TagsIcon } from '@toeverything/components/icons';
import { CreatePendantPanel } from './pendant-operation-panel';
import { IconButton } from './StyledComponent';
import { AsyncBlock } from '../editor';
@@ -13,11 +16,13 @@ type Props = {
block: AsyncBlock;
onSure?: () => void;
iconStyle?: CSSProperties;
useAddIcon?: boolean;
} & Omit<PopoverProps, 'content'>;
export const AddPendantPopover = ({
block,
onSure,
iconStyle,
useAddIcon = true,
...popoverProps
}: Props) => {
const popoverHandlerRef = useRef<PopperHandler>();
@@ -38,9 +43,25 @@ export const AddPendantPopover = ({
style={{ padding: 0 }}
{...popoverProps}
>
<IconButton style={{ marginRight: 12, ...iconStyle }}>
<Add sx={{ fontSize: 14 }} />
</IconButton>
{useAddIcon ? (
<IconButton style={{ marginRight: 12, ...iconStyle }}>
<Add sx={{ fontSize: 14 }} />
</IconButton>
) : (
<Tag
style={{
background: '#F5F7F8',
color: '#98ACBD',
marginRight: 12,
marginBottom: 8,
}}
startElement={
<TagsIcon style={{ fontSize: 14, marginRight: 4 }} />
}
>
Tag App
</Tag>
)}
</Popover>
);
};
@@ -33,6 +33,7 @@ export const PendantPopover = (
}}
offset={[0, -30]}
trigger="click"
useAddIcon={false}
/>
}
onClose={() => {