mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00:00
feat: center title (#1504)
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { Content, QuickSearchTips } from '@affine/component';
|
import { QuickSearchTips } from '@affine/component';
|
||||||
import { getEnvironment } from '@affine/env';
|
import { getEnvironment } from '@affine/env';
|
||||||
import { ArrowDownSmallIcon } from '@blocksuite/icons';
|
import { ArrowDownSmallIcon } from '@blocksuite/icons';
|
||||||
import { assertExists } from '@blocksuite/store';
|
import { assertExists } from '@blocksuite/store';
|
||||||
@@ -19,6 +19,7 @@ import {
|
|||||||
StyledSearchArrowWrapper,
|
StyledSearchArrowWrapper,
|
||||||
StyledSwitchWrapper,
|
StyledSwitchWrapper,
|
||||||
StyledTitle,
|
StyledTitle,
|
||||||
|
StyledTitleContainer,
|
||||||
StyledTitleWrapper,
|
StyledTitleWrapper,
|
||||||
} from './styles';
|
} from './styles';
|
||||||
|
|
||||||
@@ -94,7 +95,7 @@ export const BlockSuiteEditorHeader: React.FC<BlockSuiteEditorHeaderProps> = ({
|
|||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
{!isPublic && (
|
{!isPublic && (
|
||||||
<StyledTitle data-tauri-drag-region>
|
<StyledTitleContainer data-tauri-drag-region>
|
||||||
<StyledTitleWrapper>
|
<StyledTitleWrapper>
|
||||||
<StyledSwitchWrapper>
|
<StyledSwitchWrapper>
|
||||||
<EditorModeSwitch
|
<EditorModeSwitch
|
||||||
@@ -105,7 +106,7 @@ export const BlockSuiteEditorHeader: React.FC<BlockSuiteEditorHeaderProps> = ({
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</StyledSwitchWrapper>
|
</StyledSwitchWrapper>
|
||||||
<Content ellipsis={true}>{title || 'Untitled'}</Content>
|
<StyledTitle>{title || 'Untitled'}</StyledTitle>
|
||||||
<QuickSearchTips
|
<QuickSearchTips
|
||||||
data-testid="quick-search-tips"
|
data-testid="quick-search-tips"
|
||||||
content={tipsContent()}
|
content={tipsContent()}
|
||||||
@@ -122,7 +123,7 @@ export const BlockSuiteEditorHeader: React.FC<BlockSuiteEditorHeaderProps> = ({
|
|||||||
</StyledSearchArrowWrapper>
|
</StyledSearchArrowWrapper>
|
||||||
</QuickSearchTips>
|
</QuickSearchTips>
|
||||||
</StyledTitleWrapper>
|
</StyledTitleWrapper>
|
||||||
</StyledTitle>
|
</StyledTitleContainer>
|
||||||
)}
|
)}
|
||||||
</Header>
|
</Header>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,4 +1,9 @@
|
|||||||
import { displayFlex, styled } from '@affine/component';
|
import {
|
||||||
|
absoluteCenter,
|
||||||
|
displayFlex,
|
||||||
|
styled,
|
||||||
|
textEllipsis,
|
||||||
|
} from '@affine/component';
|
||||||
|
|
||||||
export const StyledHeaderContainer = styled('div')<{ hasWarning: boolean }>(
|
export const StyledHeaderContainer = styled('div')<{ hasWarning: boolean }>(
|
||||||
({ hasWarning }) => {
|
({ hasWarning }) => {
|
||||||
@@ -17,20 +22,28 @@ export const StyledHeader = styled('div')<{ hasWarning: boolean }>(
|
|||||||
background: theme.colors.pageBackground,
|
background: theme.colors.pageBackground,
|
||||||
transition: 'background-color 0.5s',
|
transition: 'background-color 0.5s',
|
||||||
zIndex: 99,
|
zIndex: 99,
|
||||||
|
position: 'relative',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
export const StyledTitle = styled('div')(({ theme }) => ({
|
export const StyledTitleContainer = styled('div')(({ theme }) => ({
|
||||||
width: '720px',
|
width: '720px',
|
||||||
height: '100%',
|
height: '100%',
|
||||||
|
|
||||||
margin: 'auto',
|
margin: 'auto',
|
||||||
|
...absoluteCenter({ horizontal: true, position: { top: 0 } }),
|
||||||
...displayFlex('center', 'center'),
|
...displayFlex('center', 'center'),
|
||||||
fontSize: theme.font.base,
|
fontSize: theme.font.base,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
export const StyledTitle = styled('div')(() => {
|
||||||
|
return {
|
||||||
|
maxWidth: '620px',
|
||||||
|
...textEllipsis(1),
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
export const StyledTitleWrapper = styled('div')({
|
export const StyledTitleWrapper = styled('div')({
|
||||||
maxWidth: '720px',
|
maxWidth: '720px',
|
||||||
height: '100%',
|
height: '100%',
|
||||||
@@ -128,7 +141,7 @@ export const StyledQuickSearchTipButton = styled('div')(({ theme }) => {
|
|||||||
cursor: 'pointer',
|
cursor: 'pointer',
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
export const StyledQuickSearchTipContent = styled('div')(({ theme }) => {
|
export const StyledQuickSearchTipContent = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
...displayFlex('center', 'flex-end'),
|
...displayFlex('center', 'flex-end'),
|
||||||
flexDirection: 'column',
|
flexDirection: 'column',
|
||||||
|
|||||||
Reference in New Issue
Block a user