mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-14 21:27:20 +00:00
59 lines
1.4 KiB
TypeScript
59 lines
1.4 KiB
TypeScript
import { MenuItem, styled } from '@affine/component';
|
|
import type { PublicLinkDisableProps } from '@affine/component/share-menu';
|
|
import { PublicLinkDisableModal } from '@affine/component/share-menu';
|
|
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
|
import { ShareIcon } from '@blocksuite/icons';
|
|
|
|
import type { CommonMenuItemProps } from './types';
|
|
|
|
const StyledMenuItem = styled(MenuItem)(({ theme }) => {
|
|
return {
|
|
div: {
|
|
color: theme.palette.error.main,
|
|
svg: {
|
|
color: theme.palette.error.main,
|
|
},
|
|
},
|
|
':hover': {
|
|
div: {
|
|
color: theme.palette.error.main,
|
|
svg: {
|
|
color: theme.palette.error.main,
|
|
},
|
|
},
|
|
},
|
|
};
|
|
});
|
|
export const DisablePublicSharing = ({
|
|
onSelect,
|
|
onItemClick,
|
|
testId,
|
|
}: CommonMenuItemProps) => {
|
|
const t = useAFFiNEI18N();
|
|
return (
|
|
<>
|
|
<StyledMenuItem
|
|
data-testid={testId}
|
|
onClick={() => {
|
|
onItemClick?.();
|
|
onSelect?.();
|
|
}}
|
|
style={{ color: 'red' }}
|
|
icon={<ShareIcon />}
|
|
>
|
|
{t['Disable Public Sharing']()}
|
|
</StyledMenuItem>
|
|
</>
|
|
);
|
|
};
|
|
|
|
const DisablePublicSharingModal = ({
|
|
page,
|
|
open,
|
|
onClose,
|
|
}: PublicLinkDisableProps) => {
|
|
return <PublicLinkDisableModal page={page} open={open} onClose={onClose} />;
|
|
};
|
|
|
|
DisablePublicSharing.DisablePublicSharingModal = DisablePublicSharingModal;
|