mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-16 00:12:22 +03:00
feat(core): adjust sidebar style, add github & learn more (#7864)
close AF-1202
This commit is contained in:
parent
cfe0677b84
commit
a49b92e4c8
@ -2,7 +2,6 @@ import { cssVar } from '@toeverything/theme';
|
|||||||
import { style } from '@vanilla-extract/css';
|
import { style } from '@vanilla-extract/css';
|
||||||
export const floatingMaxWidth = 768;
|
export const floatingMaxWidth = 768;
|
||||||
export const navWrapperStyle = style({
|
export const navWrapperStyle = style({
|
||||||
paddingBottom: '8px',
|
|
||||||
'@media': {
|
'@media': {
|
||||||
print: {
|
print: {
|
||||||
display: 'none',
|
display: 'none',
|
||||||
@ -16,6 +15,9 @@ export const navWrapperStyle = style({
|
|||||||
'&[data-is-floating="true"]': {
|
'&[data-is-floating="true"]': {
|
||||||
backgroundColor: cssVar('backgroundPrimaryColor'),
|
backgroundColor: cssVar('backgroundPrimaryColor'),
|
||||||
},
|
},
|
||||||
|
'&[data-client-border="true"]': {
|
||||||
|
paddingBottom: 8,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
export const navHeaderButton = style({
|
export const navHeaderButton = style({
|
||||||
|
@ -102,6 +102,7 @@ export function AppSidebar({
|
|||||||
data-has-border={hasRightBorder}
|
data-has-border={hasRightBorder}
|
||||||
data-testid="app-sidebar-wrapper"
|
data-testid="app-sidebar-wrapper"
|
||||||
data-is-macos-electron={isMacosDesktop}
|
data-is-macos-electron={isMacosDesktop}
|
||||||
|
data-client-border={clientBorder}
|
||||||
>
|
>
|
||||||
<nav className={navStyle} data-testid="app-sidebar">
|
<nav className={navStyle} data-testid="app-sidebar">
|
||||||
{!environment.isDesktop && <SidebarHeader />}
|
{!environment.isDesktop && <SidebarHeader />}
|
||||||
|
@ -0,0 +1,44 @@
|
|||||||
|
import { DualLinkIcon } from '@blocksuite/icons/rc';
|
||||||
|
import { cssVarV2 } from '@toeverything/theme/v2';
|
||||||
|
import type { ReactElement } from 'react';
|
||||||
|
import type { To } from 'react-router-dom';
|
||||||
|
|
||||||
|
import { MenuLinkItem } from '.';
|
||||||
|
|
||||||
|
const RawLink = ({
|
||||||
|
children,
|
||||||
|
to,
|
||||||
|
className,
|
||||||
|
}: {
|
||||||
|
children?: React.ReactNode;
|
||||||
|
to: To;
|
||||||
|
className?: string;
|
||||||
|
}) => {
|
||||||
|
const href = typeof to === 'string' ? to : to.pathname;
|
||||||
|
return (
|
||||||
|
<a className={className} href={href} target="_blank" rel="noreferrer">
|
||||||
|
{children}
|
||||||
|
</a>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const ExternalMenuLinkItem = ({
|
||||||
|
href,
|
||||||
|
icon,
|
||||||
|
label,
|
||||||
|
}: {
|
||||||
|
href: string;
|
||||||
|
icon: ReactElement;
|
||||||
|
label: string;
|
||||||
|
}) => {
|
||||||
|
return (
|
||||||
|
<MenuLinkItem to={href} linkComponent={RawLink} icon={icon}>
|
||||||
|
{label}
|
||||||
|
<DualLinkIcon
|
||||||
|
width={12}
|
||||||
|
height={12}
|
||||||
|
style={{ marginLeft: 4, color: cssVarV2('icon/tertiary') }}
|
||||||
|
/>
|
||||||
|
</MenuLinkItem>
|
||||||
|
);
|
||||||
|
};
|
@ -13,7 +13,6 @@ export const root = style({
|
|||||||
userSelect: 'none',
|
userSelect: 'none',
|
||||||
cursor: 'pointer',
|
cursor: 'pointer',
|
||||||
padding: '0 12px',
|
padding: '0 12px',
|
||||||
margin: '20px 0',
|
|
||||||
position: 'relative',
|
position: 'relative',
|
||||||
whiteSpace: 'nowrap',
|
whiteSpace: 'nowrap',
|
||||||
});
|
});
|
||||||
|
@ -4,6 +4,9 @@ export const baseContainer = style({
|
|||||||
padding: '4px 16px',
|
padding: '4px 16px',
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
flexFlow: 'column nowrap',
|
flexFlow: 'column nowrap',
|
||||||
|
':empty': {
|
||||||
|
display: 'none',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
export const scrollableContainerRoot = style({
|
export const scrollableContainerRoot = style({
|
||||||
flex: '1 1 auto',
|
flex: '1 1 auto',
|
||||||
@ -30,6 +33,8 @@ export const scrollTopBorder = style({
|
|||||||
export const scrollableViewport = style({
|
export const scrollableViewport = style({
|
||||||
height: '100%',
|
height: '100%',
|
||||||
marginTop: '4px',
|
marginTop: '4px',
|
||||||
|
// safe area to avoid bottom clipping
|
||||||
|
paddingBottom: 8,
|
||||||
});
|
});
|
||||||
globalStyle(`${scrollableViewport} > div`, {
|
globalStyle(`${scrollableViewport} > div`, {
|
||||||
maxWidth: '100%',
|
maxWidth: '100%',
|
||||||
|
@ -13,6 +13,7 @@ export const quickSearchAndNewPage = style({
|
|||||||
display: 'flex',
|
display: 'flex',
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
gap: 8,
|
gap: 8,
|
||||||
|
padding: '8px 0',
|
||||||
});
|
});
|
||||||
export const quickSearch = style({
|
export const quickSearch = style({
|
||||||
width: 0,
|
width: 0,
|
||||||
|
@ -12,7 +12,12 @@ import { CMDKQuickSearchService } from '@affine/core/modules/quicksearch/service
|
|||||||
import { isNewTabTrigger } from '@affine/core/utils';
|
import { isNewTabTrigger } from '@affine/core/utils';
|
||||||
import { events } from '@affine/electron-api';
|
import { events } from '@affine/electron-api';
|
||||||
import { useI18n } from '@affine/i18n';
|
import { useI18n } from '@affine/i18n';
|
||||||
import { AllDocsIcon, SettingsIcon } from '@blocksuite/icons/rc';
|
import {
|
||||||
|
AllDocsIcon,
|
||||||
|
GithubIcon,
|
||||||
|
JournalIcon,
|
||||||
|
SettingsIcon,
|
||||||
|
} from '@blocksuite/icons/rc';
|
||||||
import type { Doc } from '@blocksuite/store';
|
import type { Doc } from '@blocksuite/store';
|
||||||
import type { Workspace } from '@toeverything/infra';
|
import type { Workspace } from '@toeverything/infra';
|
||||||
import { useLiveData, useService, WorkspaceService } from '@toeverything/infra';
|
import { useLiveData, useService, WorkspaceService } from '@toeverything/infra';
|
||||||
@ -33,6 +38,7 @@ import {
|
|||||||
SidebarContainer,
|
SidebarContainer,
|
||||||
SidebarScrollableContainer,
|
SidebarScrollableContainer,
|
||||||
} from '../app-sidebar';
|
} from '../app-sidebar';
|
||||||
|
import { ExternalMenuLinkItem } from '../app-sidebar/menu-item/external-menu-link-item';
|
||||||
import { usePageHelper } from '../blocksuite/block-suite-page-list/utils';
|
import { usePageHelper } from '../blocksuite/block-suite-page-list/utils';
|
||||||
import { WorkspaceSelector } from '../workspace-selector';
|
import { WorkspaceSelector } from '../workspace-selector';
|
||||||
import ImportPage from './import-page';
|
import ImportPage from './import-page';
|
||||||
@ -158,6 +164,16 @@ export const RootAppSidebar = (): ReactElement => {
|
|||||||
<div style={{ padding: '0 8px' }}>
|
<div style={{ padding: '0 8px' }}>
|
||||||
<TrashButton />
|
<TrashButton />
|
||||||
<ImportPage docCollection={docCollection} />
|
<ImportPage docCollection={docCollection} />
|
||||||
|
<ExternalMenuLinkItem
|
||||||
|
href="https://affine.pro/blog?tag=Release+Note"
|
||||||
|
icon={<JournalIcon />}
|
||||||
|
label={t['com.affine.app-sidebar.learn-more']()}
|
||||||
|
/>
|
||||||
|
<ExternalMenuLinkItem
|
||||||
|
href="https://github.com/toeverything/affine"
|
||||||
|
icon={<GithubIcon />}
|
||||||
|
label={t['com.affine.app-sidebar.star-us']()}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</SidebarScrollableContainer>
|
</SidebarScrollableContainer>
|
||||||
<SidebarContainer>
|
<SidebarContainer>
|
||||||
|
@ -1456,5 +1456,7 @@
|
|||||||
"unnamed": "unnamed",
|
"unnamed": "unnamed",
|
||||||
"upgradeBrowser": "Please upgrade to the latest version of Chrome for the best experience.",
|
"upgradeBrowser": "Please upgrade to the latest version of Chrome for the best experience.",
|
||||||
"will be moved to Trash": "{{title}} will be moved to trash",
|
"will be moved to Trash": "{{title}} will be moved to trash",
|
||||||
"will delete member": "will delete member"
|
"will delete member": "will delete member",
|
||||||
|
"com.affine.app-sidebar.star-us": "Star us",
|
||||||
|
"com.affine.app-sidebar.learn-more": "Learn more"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user