mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-11-24 00:32:44 +03:00
fix: menu style (#4287)
This commit is contained in:
parent
46fd732ee6
commit
b7b14c2241
@ -39,7 +39,7 @@
|
|||||||
"@mui/material": "^5.14.7",
|
"@mui/material": "^5.14.7",
|
||||||
"@radix-ui/react-select": "^1.2.2",
|
"@radix-ui/react-select": "^1.2.2",
|
||||||
"@react-hookz/web": "^23.1.0",
|
"@react-hookz/web": "^23.1.0",
|
||||||
"@toeverything/components": "^0.0.31",
|
"@toeverything/components": "^0.0.34",
|
||||||
"async-call-rpc": "^6.3.1",
|
"async-call-rpc": "^6.3.1",
|
||||||
"cmdk": "^0.2.0",
|
"cmdk": "^0.2.0",
|
||||||
"css-spring": "^4.1.0",
|
"css-spring": "^4.1.0",
|
||||||
|
@ -56,6 +56,12 @@ export const LanguageMenu = () => {
|
|||||||
portalOptions={{
|
portalOptions={{
|
||||||
container: ref.current,
|
container: ref.current,
|
||||||
}}
|
}}
|
||||||
|
contentOptions={{
|
||||||
|
style: {
|
||||||
|
background: 'var(--affine-white)',
|
||||||
|
},
|
||||||
|
align: 'end',
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<MenuTrigger
|
<MenuTrigger
|
||||||
ref={ref}
|
ref={ref}
|
||||||
|
@ -83,6 +83,7 @@ export const PageMenu = ({ rename, pageId }: PageMenuProps) => {
|
|||||||
}, [pageId, removeToTrash, t]);
|
}, [pageId, removeToTrash, t]);
|
||||||
const menuItemStyle = {
|
const menuItemStyle = {
|
||||||
padding: '4px 12px',
|
padding: '4px 12px',
|
||||||
|
transition: 'all 0.3s',
|
||||||
};
|
};
|
||||||
const { openPage } = useNavigateHelper();
|
const { openPage } = useNavigateHelper();
|
||||||
const { createPage } = useBlockSuiteWorkspaceHelper(blockSuiteWorkspace);
|
const { createPage } = useBlockSuiteWorkspaceHelper(blockSuiteWorkspace);
|
||||||
@ -214,11 +215,9 @@ export const PageMenu = ({ rename, pageId }: PageMenuProps) => {
|
|||||||
portalOptions={{
|
portalOptions={{
|
||||||
container: ref.current,
|
container: ref.current,
|
||||||
}}
|
}}
|
||||||
// menuStyles={{
|
contentOptions={{
|
||||||
// borderRadius: '8px',
|
align: 'center',
|
||||||
// padding: '8px',
|
}}
|
||||||
// background: 'var(--affine-background-overlay-panel-color)',
|
|
||||||
// }}
|
|
||||||
>
|
>
|
||||||
<HeaderDropDownButton />
|
<HeaderDropDownButton />
|
||||||
</Menu>
|
</Menu>
|
||||||
|
@ -8,8 +8,8 @@ import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
|||||||
import type { RootWorkspaceMetadata } from '@affine/workspace/atom';
|
import type { RootWorkspaceMetadata } from '@affine/workspace/atom';
|
||||||
import {
|
import {
|
||||||
AccountIcon,
|
AccountIcon,
|
||||||
CloudWorkspaceIcon,
|
|
||||||
ImportIcon,
|
ImportIcon,
|
||||||
|
Logo1Icon,
|
||||||
MoreHorizontalIcon,
|
MoreHorizontalIcon,
|
||||||
PlusIcon,
|
PlusIcon,
|
||||||
SignOutIcon,
|
SignOutIcon,
|
||||||
@ -214,7 +214,7 @@ export const WorkspaceListModal = ({
|
|||||||
>
|
>
|
||||||
<StyledCreateWorkspaceCardPillContent>
|
<StyledCreateWorkspaceCardPillContent>
|
||||||
<StyledCreateWorkspaceCardPillIcon>
|
<StyledCreateWorkspaceCardPillIcon>
|
||||||
<CloudWorkspaceIcon />
|
<Logo1Icon />
|
||||||
</StyledCreateWorkspaceCardPillIcon>
|
</StyledCreateWorkspaceCardPillIcon>
|
||||||
<StyledSignInCardPillTextCotainer>
|
<StyledSignInCardPillTextCotainer>
|
||||||
<StyledSignInCardPillTextPrimary>
|
<StyledSignInCardPillTextPrimary>
|
||||||
@ -227,14 +227,24 @@ export const WorkspaceListModal = ({
|
|||||||
</StyledCreateWorkspaceCardPillContent>
|
</StyledCreateWorkspaceCardPillContent>
|
||||||
</StyledItem>
|
</StyledItem>
|
||||||
</StyledSignInCardPill>
|
</StyledSignInCardPill>
|
||||||
<Divider style={{ margin: '12px 0px' }} />
|
<Divider
|
||||||
|
style={{
|
||||||
|
margin: '12px 0px',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
</StyledModalHeaderContent>
|
</StyledModalHeaderContent>
|
||||||
) : (
|
) : (
|
||||||
<StyledModalHeaderContent>
|
<StyledModalHeaderContent>
|
||||||
<StyledModalHeader>
|
<StyledModalHeader>
|
||||||
<StyledModalTitle>{session?.user.email}</StyledModalTitle>
|
<StyledModalTitle>{session?.user.email}</StyledModalTitle>
|
||||||
<StyledOperationWrapper>
|
<StyledOperationWrapper>
|
||||||
<Menu items={<AccountMenu />}>
|
<Menu
|
||||||
|
items={<AccountMenu />}
|
||||||
|
contentOptions={{
|
||||||
|
side: 'right',
|
||||||
|
sideOffset: 30,
|
||||||
|
}}
|
||||||
|
>
|
||||||
<IconButton
|
<IconButton
|
||||||
data-testid="more-button"
|
data-testid="more-button"
|
||||||
icon={<MoreHorizontalIcon />}
|
icon={<MoreHorizontalIcon />}
|
||||||
@ -261,7 +271,11 @@ export const WorkspaceListModal = ({
|
|||||||
currentWorkspaceId={currentWorkspaceId}
|
currentWorkspaceId={currentWorkspaceId}
|
||||||
onMoveWorkspace={onMoveWorkspace}
|
onMoveWorkspace={onMoveWorkspace}
|
||||||
/>
|
/>
|
||||||
<Divider style={{ margin: '12px 0px', minHeight: '1px' }} />
|
<Divider
|
||||||
|
style={{
|
||||||
|
margin: '12px 0px',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
</>
|
</>
|
||||||
) : null}
|
) : null}
|
||||||
<StyledModalHeader>
|
<StyledModalHeader>
|
||||||
@ -290,8 +304,10 @@ export const WorkspaceListModal = ({
|
|||||||
{runtimeConfig.enableSQLiteProvider && environment.isDesktop ? (
|
{runtimeConfig.enableSQLiteProvider && environment.isDesktop ? (
|
||||||
<StyledImportWorkspaceCardPill>
|
<StyledImportWorkspaceCardPill>
|
||||||
<StyledItem onClick={onAddWorkspace} data-testid="add-workspace">
|
<StyledItem onClick={onAddWorkspace} data-testid="add-workspace">
|
||||||
<StyledCreateWorkspaceCardPillContent>
|
<StyledCreateWorkspaceCardPillContent
|
||||||
<StyledCreateWorkspaceCardPillIcon>
|
style={{ gap: '14px', paddingLeft: '2px' }}
|
||||||
|
>
|
||||||
|
<StyledCreateWorkspaceCardPillIcon style={{ fontSize: '24px' }}>
|
||||||
<ImportIcon />
|
<ImportIcon />
|
||||||
</StyledCreateWorkspaceCardPillIcon>
|
</StyledCreateWorkspaceCardPillIcon>
|
||||||
<div>
|
<div>
|
||||||
|
@ -116,7 +116,7 @@ export const StyledCreateWorkspaceCardPillContent = styled('div')(() => {
|
|||||||
|
|
||||||
export const StyledCreateWorkspaceCardPillIcon = styled('div')(() => {
|
export const StyledCreateWorkspaceCardPillIcon = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
fontSize: '20px',
|
fontSize: '28px',
|
||||||
width: '1em',
|
width: '1em',
|
||||||
height: '1em',
|
height: '1em',
|
||||||
};
|
};
|
||||||
@ -142,6 +142,7 @@ export const StyledSignInCardPillTextPrimary = styled('div')(() => {
|
|||||||
fontWeight: 600,
|
fontWeight: 600,
|
||||||
lineHeight: '24px',
|
lineHeight: '24px',
|
||||||
maxWidth: '200px',
|
maxWidth: '200px',
|
||||||
|
textAlign: 'left',
|
||||||
...textEllipsis(1),
|
...textEllipsis(1),
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
@ -4,7 +4,7 @@ import { displayFlex, styled, textEllipsis } from '../../../styles';
|
|||||||
|
|
||||||
export const StyledWorkspaceInfo = styled('div')(() => {
|
export const StyledWorkspaceInfo = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
marginLeft: '15px',
|
marginLeft: '12px',
|
||||||
width: '202px',
|
width: '202px',
|
||||||
p: {
|
p: {
|
||||||
height: '20px',
|
height: '20px',
|
||||||
@ -43,7 +43,7 @@ export const StyledCard = styled('div')<{
|
|||||||
width: '280px',
|
width: '280px',
|
||||||
height: '58px',
|
height: '58px',
|
||||||
cursor: 'pointer',
|
cursor: 'pointer',
|
||||||
padding: '16px',
|
padding: '12px',
|
||||||
borderRadius: '12px',
|
borderRadius: '12px',
|
||||||
border: `1px solid ${borderColor}`,
|
border: `1px solid ${borderColor}`,
|
||||||
...displayFlex('flex-start', 'flex-start'),
|
...displayFlex('flex-start', 'flex-start'),
|
||||||
|
@ -1,14 +1,12 @@
|
|||||||
import { style } from '@vanilla-extract/css';
|
import { style } from '@vanilla-extract/css';
|
||||||
|
|
||||||
export const menuItemStyle = style({
|
export const menuItemStyle = style({
|
||||||
display: 'flex',
|
fontSize: 'var(--affine-font-xs)',
|
||||||
alignItems: 'center',
|
|
||||||
justifyContent: 'flex-start',
|
|
||||||
padding: '0px 24px 0px 8px',
|
|
||||||
});
|
});
|
||||||
export const variableSelectTitleStyle = style({
|
export const variableSelectTitleStyle = style({
|
||||||
marginLeft: '12px',
|
margin: '7px 16px',
|
||||||
marginTop: '10px',
|
fontWeight: 500,
|
||||||
|
lineHeight: '20px',
|
||||||
fontSize: 'var(--affine-font-xs)',
|
fontSize: 'var(--affine-font-xs)',
|
||||||
color: 'var(--affine-text-secondary-color)',
|
color: 'var(--affine-text-secondary-color)',
|
||||||
});
|
});
|
||||||
@ -21,7 +19,7 @@ export const variableSelectDividerStyle = style({
|
|||||||
background: 'var(--affine-border-color)',
|
background: 'var(--affine-border-color)',
|
||||||
});
|
});
|
||||||
export const menuItemTextStyle = style({
|
export const menuItemTextStyle = style({
|
||||||
fontSize: 'var(--affine-font-sm)',
|
fontSize: 'var(--affine-font-xs)',
|
||||||
});
|
});
|
||||||
export const filterItemStyle = style({
|
export const filterItemStyle = style({
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
|
@ -5,7 +5,11 @@ import type {
|
|||||||
VariableMap,
|
VariableMap,
|
||||||
} from '@affine/env/filter';
|
} from '@affine/env/filter';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||||
import { MenuIcon, MenuItem } from '@toeverything/components/menu';
|
import {
|
||||||
|
MenuIcon,
|
||||||
|
MenuItem,
|
||||||
|
MenuSeparator,
|
||||||
|
} from '@toeverything/components/menu';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import type { ReactNode } from 'react';
|
import type { ReactNode } from 'react';
|
||||||
|
|
||||||
@ -87,7 +91,7 @@ export const VariableSelect = ({
|
|||||||
<div className={styles.variableSelectTitleStyle}>
|
<div className={styles.variableSelectTitleStyle}>
|
||||||
{t['com.affine.filter']()}
|
{t['com.affine.filter']()}
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.variableSelectDividerStyle}></div>
|
<MenuSeparator />
|
||||||
{vars
|
{vars
|
||||||
// .filter(v => !selected.find(filter => filter.left.name === v.name))
|
// .filter(v => !selected.find(filter => filter.left.name === v.name))
|
||||||
.map(v => (
|
.map(v => (
|
||||||
|
@ -88,7 +88,12 @@ export const OperationCell = ({
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<FlexWrapper alignItems="center" justifyContent="center">
|
<FlexWrapper alignItems="center" justifyContent="center">
|
||||||
<Menu items={OperationMenu}>
|
<Menu
|
||||||
|
items={OperationMenu}
|
||||||
|
contentOptions={{
|
||||||
|
align: 'end',
|
||||||
|
}}
|
||||||
|
>
|
||||||
<IconButton type="plain" data-testid="page-list-operation-button">
|
<IconButton type="plain" data-testid="page-list-operation-button">
|
||||||
<MoreVerticalIcon />
|
<MoreVerticalIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
|
@ -10,13 +10,15 @@ import {
|
|||||||
} from '@blocksuite/icons';
|
} from '@blocksuite/icons';
|
||||||
import { MenuIcon, MenuItem, MenuSub } from '@toeverything/components/menu';
|
import { MenuIcon, MenuItem, MenuSub } from '@toeverything/components/menu';
|
||||||
import { useSetAtom } from 'jotai';
|
import { useSetAtom } from 'jotai';
|
||||||
import { useCallback } from 'react';
|
import { useCallback, useRef } from 'react';
|
||||||
|
|
||||||
import { getContentParser } from './get-content-parser';
|
import { getContentParser } from './get-content-parser';
|
||||||
|
import { transitionStyle } from './index.css';
|
||||||
import type { CommonMenuItemProps } from './types';
|
import type { CommonMenuItemProps } from './types';
|
||||||
|
|
||||||
export const ExportToPdfMenuItem = ({
|
export const ExportToPdfMenuItem = ({
|
||||||
onSelect,
|
onSelect,
|
||||||
|
className,
|
||||||
}: CommonMenuItemProps<{ type: 'pdf' }>) => {
|
}: CommonMenuItemProps<{ type: 'pdf' }>) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useAFFiNEI18N();
|
||||||
const { currentEditor } = globalThis;
|
const { currentEditor } = globalThis;
|
||||||
@ -74,8 +76,10 @@ export const ExportToPdfMenuItem = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<MenuItem
|
<MenuItem
|
||||||
|
className={className}
|
||||||
data-testid="export-to-pdf"
|
data-testid="export-to-pdf"
|
||||||
onSelect={onClickDownloadPDF}
|
onSelect={onClickDownloadPDF}
|
||||||
|
block
|
||||||
preFix={
|
preFix={
|
||||||
<MenuIcon>
|
<MenuIcon>
|
||||||
<ExportToPdfIcon />
|
<ExportToPdfIcon />
|
||||||
@ -89,6 +93,7 @@ export const ExportToPdfMenuItem = ({
|
|||||||
|
|
||||||
export const ExportToHtmlMenuItem = ({
|
export const ExportToHtmlMenuItem = ({
|
||||||
onSelect,
|
onSelect,
|
||||||
|
className,
|
||||||
}: CommonMenuItemProps<{ type: 'html' }>) => {
|
}: CommonMenuItemProps<{ type: 'html' }>) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useAFFiNEI18N();
|
||||||
const { currentEditor } = globalThis;
|
const { currentEditor } = globalThis;
|
||||||
@ -121,8 +126,10 @@ export const ExportToHtmlMenuItem = ({
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
|
className={className}
|
||||||
data-testid="export-to-html"
|
data-testid="export-to-html"
|
||||||
onSelect={onClickExportHtml}
|
onSelect={onClickExportHtml}
|
||||||
|
block
|
||||||
preFix={
|
preFix={
|
||||||
<MenuIcon>
|
<MenuIcon>
|
||||||
<ExportToHtmlIcon />
|
<ExportToHtmlIcon />
|
||||||
@ -137,6 +144,7 @@ export const ExportToHtmlMenuItem = ({
|
|||||||
|
|
||||||
export const ExportToPngMenuItem = ({
|
export const ExportToPngMenuItem = ({
|
||||||
onSelect,
|
onSelect,
|
||||||
|
className,
|
||||||
}: CommonMenuItemProps<{ type: 'png' }>) => {
|
}: CommonMenuItemProps<{ type: 'png' }>) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useAFFiNEI18N();
|
||||||
const { currentEditor } = globalThis;
|
const { currentEditor } = globalThis;
|
||||||
@ -171,8 +179,10 @@ export const ExportToPngMenuItem = ({
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
|
className={className}
|
||||||
data-testid="export-to-png"
|
data-testid="export-to-png"
|
||||||
onSelect={onClickDownloadPNG}
|
onSelect={onClickDownloadPNG}
|
||||||
|
block
|
||||||
preFix={
|
preFix={
|
||||||
<MenuIcon>
|
<MenuIcon>
|
||||||
<ExportToPngIcon />
|
<ExportToPngIcon />
|
||||||
@ -187,6 +197,7 @@ export const ExportToPngMenuItem = ({
|
|||||||
|
|
||||||
export const ExportToMarkdownMenuItem = ({
|
export const ExportToMarkdownMenuItem = ({
|
||||||
onSelect,
|
onSelect,
|
||||||
|
className,
|
||||||
}: CommonMenuItemProps<{ type: 'markdown' }>) => {
|
}: CommonMenuItemProps<{ type: 'markdown' }>) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useAFFiNEI18N();
|
||||||
const { currentEditor } = globalThis;
|
const { currentEditor } = globalThis;
|
||||||
@ -219,8 +230,10 @@ export const ExportToMarkdownMenuItem = ({
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
|
className={className}
|
||||||
data-testid="export-to-markdown"
|
data-testid="export-to-markdown"
|
||||||
onSelect={onClickExportMarkdown}
|
onSelect={onClickExportMarkdown}
|
||||||
|
block
|
||||||
preFix={
|
preFix={
|
||||||
<MenuIcon>
|
<MenuIcon>
|
||||||
<ExportToMarkdownIcon />
|
<ExportToMarkdownIcon />
|
||||||
@ -235,18 +248,29 @@ export const ExportToMarkdownMenuItem = ({
|
|||||||
|
|
||||||
// fixme: refactor this file, export function may should be passed by 'props', this file is just a ui component
|
// fixme: refactor this file, export function may should be passed by 'props', this file is just a ui component
|
||||||
export const Export = () => {
|
export const Export = () => {
|
||||||
|
const ref = useRef(null);
|
||||||
const t = useAFFiNEI18N();
|
const t = useAFFiNEI18N();
|
||||||
return (
|
return (
|
||||||
|
<div ref={ref}>
|
||||||
<MenuSub
|
<MenuSub
|
||||||
items={
|
items={
|
||||||
<>
|
<>
|
||||||
<ExportToPdfMenuItem></ExportToPdfMenuItem>
|
<ExportToPdfMenuItem
|
||||||
<ExportToHtmlMenuItem></ExportToHtmlMenuItem>
|
className={transitionStyle}
|
||||||
<ExportToPngMenuItem></ExportToPngMenuItem>
|
></ExportToPdfMenuItem>
|
||||||
<ExportToMarkdownMenuItem></ExportToMarkdownMenuItem>
|
<ExportToHtmlMenuItem
|
||||||
|
className={transitionStyle}
|
||||||
|
></ExportToHtmlMenuItem>
|
||||||
|
<ExportToPngMenuItem
|
||||||
|
className={transitionStyle}
|
||||||
|
></ExportToPngMenuItem>
|
||||||
|
<ExportToMarkdownMenuItem
|
||||||
|
className={transitionStyle}
|
||||||
|
></ExportToMarkdownMenuItem>
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
triggerOptions={{
|
triggerOptions={{
|
||||||
|
className: transitionStyle,
|
||||||
preFix: (
|
preFix: (
|
||||||
<MenuIcon>
|
<MenuIcon>
|
||||||
<ExportIcon />
|
<ExportIcon />
|
||||||
@ -254,8 +278,12 @@ export const Export = () => {
|
|||||||
),
|
),
|
||||||
['data-testid' as string]: 'export-menu',
|
['data-testid' as string]: 'export-menu',
|
||||||
}}
|
}}
|
||||||
|
portalOptions={{
|
||||||
|
container: ref.current,
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{t.Export()}
|
{t.Export()}
|
||||||
</MenuSub>
|
</MenuSub>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -11,3 +11,7 @@ export const moveToTrashStyle = style({
|
|||||||
globalStyle(`${moveToTrashStyle}:hover svg`, {
|
globalStyle(`${moveToTrashStyle}:hover svg`, {
|
||||||
color: 'var(--affine-error-color)',
|
color: 'var(--affine-error-color)',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const transitionStyle = style({
|
||||||
|
transition: 'all 0.3s',
|
||||||
|
});
|
||||||
|
@ -221,3 +221,7 @@ export const deleteIcon = style({
|
|||||||
backgroundColor: 'var(--affine-background-error-color)',
|
backgroundColor: 'var(--affine-background-error-color)',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
export const filterMenuTrigger = style({
|
||||||
|
padding: '6px 8px',
|
||||||
|
background: 'var(--affine-hover-color)',
|
||||||
|
});
|
||||||
|
@ -206,6 +206,7 @@ export const CollectionList = ({
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Button
|
<Button
|
||||||
|
className={styles.filterMenuTrigger}
|
||||||
type="default"
|
type="default"
|
||||||
icon={<FilteredIcon />}
|
icon={<FilteredIcon />}
|
||||||
data-testid="create-first-filter"
|
data-testid="create-first-filter"
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
import { style } from '@vanilla-extract/css';
|
import { style } from '@vanilla-extract/css';
|
||||||
|
|
||||||
export const menuItemStyle = style({
|
export const menuItemStyle = style({
|
||||||
padding: '4px 18px',
|
padding: '4px',
|
||||||
paddingBottom: '16px',
|
transition: 'all 0.3s',
|
||||||
width: '100%',
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export const descriptionStyle = style({
|
export const descriptionStyle = style({
|
||||||
@ -12,6 +11,7 @@ export const descriptionStyle = style({
|
|||||||
fontSize: 'var(--affine-font-xs)',
|
fontSize: 'var(--affine-font-xs)',
|
||||||
lineHeight: '20px',
|
lineHeight: '20px',
|
||||||
color: 'var(--affine-text-secondary-color)',
|
color: 'var(--affine-text-secondary-color)',
|
||||||
|
textAlign: 'left',
|
||||||
});
|
});
|
||||||
|
|
||||||
export const buttonStyle = style({
|
export const buttonStyle = style({
|
||||||
|
@ -7,7 +7,6 @@ import {
|
|||||||
ExportToPngMenuItem,
|
ExportToPngMenuItem,
|
||||||
} from '../page-list/operation-menu-items/export';
|
} from '../page-list/operation-menu-items/export';
|
||||||
import * as styles from './index.css';
|
import * as styles from './index.css';
|
||||||
// import type { ShareMenuProps } from './share-menu';
|
|
||||||
|
|
||||||
export const ShareExport = () => {
|
export const ShareExport = () => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useAFFiNEI18N();
|
||||||
@ -17,10 +16,10 @@ export const ShareExport = () => {
|
|||||||
{t['com.affine.share-menu.ShareViaExport']()}
|
{t['com.affine.share-menu.ShareViaExport']()}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<ExportToPdfMenuItem />
|
<ExportToPdfMenuItem className={styles.menuItemStyle} />
|
||||||
<ExportToHtmlMenuItem />
|
<ExportToHtmlMenuItem className={styles.menuItemStyle} />
|
||||||
<ExportToPngMenuItem />
|
<ExportToPngMenuItem className={styles.menuItemStyle} />
|
||||||
<ExportToMarkdownMenuItem />
|
<ExportToMarkdownMenuItem className={styles.menuItemStyle} />
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.columnContainerStyle}>
|
<div className={styles.columnContainerStyle}>
|
||||||
<div className={styles.descriptionStyle}>
|
<div className={styles.descriptionStyle}>
|
||||||
|
@ -9,7 +9,6 @@ import type { Page } from '@blocksuite/store';
|
|||||||
import { Button } from '@toeverything/components/button';
|
import { Button } from '@toeverything/components/button';
|
||||||
import { Divider } from '@toeverything/components/divider';
|
import { Divider } from '@toeverything/components/divider';
|
||||||
import { Menu } from '@toeverything/components/menu';
|
import { Menu } from '@toeverything/components/menu';
|
||||||
import { useRef } from 'react';
|
|
||||||
|
|
||||||
import * as styles from './index.css';
|
import * as styles from './index.css';
|
||||||
import { ShareExport } from './share-export';
|
import { ShareExport } from './share-export';
|
||||||
@ -33,7 +32,6 @@ export interface ShareMenuProps<
|
|||||||
|
|
||||||
export const ShareMenu = (props: ShareMenuProps) => {
|
export const ShareMenu = (props: ShareMenuProps) => {
|
||||||
const { useIsSharedPage } = props;
|
const { useIsSharedPage } = props;
|
||||||
const ref = useRef(null);
|
|
||||||
const isSharedPage = useIsSharedPage(
|
const isSharedPage = useIsSharedPage(
|
||||||
props.workspace.id,
|
props.workspace.id,
|
||||||
props.currentPage.id
|
props.currentPage.id
|
||||||
@ -43,7 +41,7 @@ export const ShareMenu = (props: ShareMenuProps) => {
|
|||||||
<div className={styles.containerStyle}>
|
<div className={styles.containerStyle}>
|
||||||
<SharePage {...props} />
|
<SharePage {...props} />
|
||||||
<div className={styles.columnContainerStyle}>
|
<div className={styles.columnContainerStyle}>
|
||||||
<Divider dividerColor="var(--affine-border-color)" size="thinner" />
|
<Divider size="thinner" />
|
||||||
</div>
|
</div>
|
||||||
<ShareExport />
|
<ShareExport />
|
||||||
</div>
|
</div>
|
||||||
@ -51,11 +49,19 @@ export const ShareMenu = (props: ShareMenuProps) => {
|
|||||||
return (
|
return (
|
||||||
<Menu
|
<Menu
|
||||||
items={content}
|
items={content}
|
||||||
portalOptions={{
|
contentOptions={{
|
||||||
container: ref.current,
|
style: {
|
||||||
|
width: '410px',
|
||||||
|
height: 'auto',
|
||||||
|
padding: '12px',
|
||||||
|
transform: 'translateX(-10px)',
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
rootOptions={{
|
||||||
|
modal: false,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Button data-testid="share-menu-button" type="plain" ref={ref}>
|
<Button data-testid="share-menu-button" type="plain">
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
color: isSharedPage
|
color: isSharedPage
|
||||||
|
@ -129,7 +129,7 @@ export const AffineSharePage = (props: ShareMenuProps) => {
|
|||||||
<Button
|
<Button
|
||||||
onClick={onClickCopyLink}
|
onClick={onClickCopyLink}
|
||||||
data-testid="share-menu-copy-link-button"
|
data-testid="share-menu-copy-link-button"
|
||||||
style={{ padding: '4px 12px' }}
|
style={{ padding: '4px 12px', whiteSpace: 'nowrap' }}
|
||||||
>
|
>
|
||||||
{t.Copy()}
|
{t.Copy()}
|
||||||
</Button>
|
</Button>
|
||||||
@ -138,7 +138,7 @@ export const AffineSharePage = (props: ShareMenuProps) => {
|
|||||||
onClick={onClickCreateLink}
|
onClick={onClickCreateLink}
|
||||||
type="primary"
|
type="primary"
|
||||||
data-testid="share-menu-create-link-button"
|
data-testid="share-menu-create-link-button"
|
||||||
style={{ padding: '4px 12px' }}
|
style={{ padding: '4px 12px', whiteSpace: 'nowrap' }}
|
||||||
>
|
>
|
||||||
{t.Create()}
|
{t.Create()}
|
||||||
</Button>
|
</Button>
|
||||||
@ -203,16 +203,17 @@ export const AffineSharePage = (props: ShareMenuProps) => {
|
|||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
<div
|
<MenuItem
|
||||||
className={styles.rowContainerStyle}
|
endFix={<ArrowRightSmallIcon />}
|
||||||
|
block
|
||||||
|
type="danger"
|
||||||
|
className={styles.menuItemStyle}
|
||||||
onClick={() => setShowDisable(true)}
|
onClick={() => setShowDisable(true)}
|
||||||
style={{ cursor: 'pointer' }}
|
|
||||||
>
|
>
|
||||||
<div className={styles.disableSharePage}>
|
<div className={styles.disableSharePage}>
|
||||||
{t['Disable Public Link']()}
|
{t['Disable Public Link']()}
|
||||||
</div>
|
</div>
|
||||||
<ArrowRightSmallIcon />
|
</MenuItem>
|
||||||
</div>
|
|
||||||
<PublicLinkDisableModal
|
<PublicLinkDisableModal
|
||||||
open={showDisable}
|
open={showDisable}
|
||||||
onConfirmDisable={onDisablePublic}
|
onConfirmDisable={onDisablePublic}
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@affine/component": "workspace:*",
|
"@affine/component": "workspace:*",
|
||||||
"@affine/sdk": "workspace:*",
|
"@affine/sdk": "workspace:*",
|
||||||
"@toeverything/components": "^0.0.31",
|
"@toeverything/components": "^0.0.34",
|
||||||
"idb": "^7.1.1",
|
"idb": "^7.1.1",
|
||||||
"langchain": "^0.0.138",
|
"langchain": "^0.0.138",
|
||||||
"marked": "^7.0.5",
|
"marked": "^7.0.5",
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
"@affine/component": "workspace:*",
|
"@affine/component": "workspace:*",
|
||||||
"@affine/sdk": "workspace:*",
|
"@affine/sdk": "workspace:*",
|
||||||
"@blocksuite/icons": "^2.1.32",
|
"@blocksuite/icons": "^2.1.32",
|
||||||
"@toeverything/components": "^0.0.31"
|
"@toeverything/components": "^0.0.34"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@affine/plugin-cli": "workspace:*"
|
"@affine/plugin-cli": "workspace:*"
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
"@affine/component": "workspace:*",
|
"@affine/component": "workspace:*",
|
||||||
"@affine/sdk": "workspace:*",
|
"@affine/sdk": "workspace:*",
|
||||||
"@blocksuite/icons": "^2.1.31",
|
"@blocksuite/icons": "^2.1.31",
|
||||||
"@toeverything/components": "^0.0.31",
|
"@toeverything/components": "^0.0.34",
|
||||||
"@toeverything/theme": "^0.7.15",
|
"@toeverything/theme": "^0.7.15",
|
||||||
"clsx": "^2.0.0",
|
"clsx": "^2.0.0",
|
||||||
"foxact": "^0.2.20",
|
"foxact": "^0.2.20",
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
"@affine/component": "workspace:*",
|
"@affine/component": "workspace:*",
|
||||||
"@affine/sdk": "workspace:*",
|
"@affine/sdk": "workspace:*",
|
||||||
"@blocksuite/icons": "^2.1.32",
|
"@blocksuite/icons": "^2.1.32",
|
||||||
"@toeverything/components": "^0.0.31"
|
"@toeverything/components": "^0.0.34"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@affine/plugin-cli": "workspace:*",
|
"@affine/plugin-cli": "workspace:*",
|
||||||
|
18
yarn.lock
18
yarn.lock
@ -229,7 +229,7 @@ __metadata:
|
|||||||
"@affine/component": "workspace:*"
|
"@affine/component": "workspace:*"
|
||||||
"@affine/plugin-cli": "workspace:*"
|
"@affine/plugin-cli": "workspace:*"
|
||||||
"@affine/sdk": "workspace:*"
|
"@affine/sdk": "workspace:*"
|
||||||
"@toeverything/components": ^0.0.31
|
"@toeverything/components": ^0.0.34
|
||||||
"@types/marked": ^5.0.1
|
"@types/marked": ^5.0.1
|
||||||
idb: ^7.1.1
|
idb: ^7.1.1
|
||||||
jotai: ^2.4.1
|
jotai: ^2.4.1
|
||||||
@ -280,7 +280,7 @@ __metadata:
|
|||||||
"@sentry/webpack-plugin": ^2.7.0
|
"@sentry/webpack-plugin": ^2.7.0
|
||||||
"@svgr/webpack": ^8.1.0
|
"@svgr/webpack": ^8.1.0
|
||||||
"@swc/core": ^1.3.81
|
"@swc/core": ^1.3.81
|
||||||
"@toeverything/components": ^0.0.31
|
"@toeverything/components": ^0.0.34
|
||||||
"@types/lodash-es": ^4.17.9
|
"@types/lodash-es": ^4.17.9
|
||||||
"@types/webpack-env": ^1.18.1
|
"@types/webpack-env": ^1.18.1
|
||||||
async-call-rpc: ^6.3.1
|
async-call-rpc: ^6.3.1
|
||||||
@ -456,7 +456,7 @@ __metadata:
|
|||||||
"@affine/plugin-cli": "workspace:*"
|
"@affine/plugin-cli": "workspace:*"
|
||||||
"@affine/sdk": "workspace:*"
|
"@affine/sdk": "workspace:*"
|
||||||
"@blocksuite/icons": ^2.1.32
|
"@blocksuite/icons": ^2.1.32
|
||||||
"@toeverything/components": ^0.0.31
|
"@toeverything/components": ^0.0.34
|
||||||
languageName: unknown
|
languageName: unknown
|
||||||
linkType: soft
|
linkType: soft
|
||||||
|
|
||||||
@ -482,7 +482,7 @@ __metadata:
|
|||||||
"@affine/plugin-cli": "workspace:*"
|
"@affine/plugin-cli": "workspace:*"
|
||||||
"@affine/sdk": "workspace:*"
|
"@affine/sdk": "workspace:*"
|
||||||
"@blocksuite/icons": ^2.1.31
|
"@blocksuite/icons": ^2.1.31
|
||||||
"@toeverything/components": ^0.0.31
|
"@toeverything/components": ^0.0.34
|
||||||
"@toeverything/theme": ^0.7.15
|
"@toeverything/theme": ^0.7.15
|
||||||
clsx: ^2.0.0
|
clsx: ^2.0.0
|
||||||
foxact: ^0.2.20
|
foxact: ^0.2.20
|
||||||
@ -578,7 +578,7 @@ __metadata:
|
|||||||
"@affine/plugin-cli": "workspace:*"
|
"@affine/plugin-cli": "workspace:*"
|
||||||
"@affine/sdk": "workspace:*"
|
"@affine/sdk": "workspace:*"
|
||||||
"@blocksuite/icons": ^2.1.32
|
"@blocksuite/icons": ^2.1.32
|
||||||
"@toeverything/components": ^0.0.31
|
"@toeverything/components": ^0.0.34
|
||||||
jotai: ^2.4.1
|
jotai: ^2.4.1
|
||||||
react: 18.2.0
|
react: 18.2.0
|
||||||
react-dom: 18.2.0
|
react-dom: 18.2.0
|
||||||
@ -12463,9 +12463,9 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@toeverything/components@npm:^0.0.31":
|
"@toeverything/components@npm:^0.0.34":
|
||||||
version: 0.0.31
|
version: 0.0.34
|
||||||
resolution: "@toeverything/components@npm:0.0.31"
|
resolution: "@toeverything/components@npm:0.0.34"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@blocksuite/icons": ^2.1.33
|
"@blocksuite/icons": ^2.1.33
|
||||||
"@radix-ui/react-dropdown-menu": ^2.0.5
|
"@radix-ui/react-dropdown-menu": ^2.0.5
|
||||||
@ -12475,7 +12475,7 @@ __metadata:
|
|||||||
clsx: ^2
|
clsx: ^2
|
||||||
react: ^18
|
react: ^18
|
||||||
react-dom: ^18
|
react-dom: ^18
|
||||||
checksum: a47263e25c9b6f987cc97d75cbf515a41ca7cce26f67c7c2017ad0e1331d5e4e59c50b1b511970fd28210e3437dfb19a83016678c3c633f0110065b6156ce289
|
checksum: 240fadd8101d92eb2da6700372a2cb87516479999943628c7d422d3cfeb3f330a15096eed470d650d207bd1a132e4115e1277b13d59a6f4994827e231e9cf5f3
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user