mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-25 06:18:45 +08:00
chore: merge blocksuite source code (#9213)
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import { unsafeCSSVarV2 } from '@blocksuite/affine-shared/theme';
|
||||
import { IS_MOBILE } from '@blocksuite/global/env';
|
||||
import { html, type TemplateResult } from 'lit';
|
||||
|
||||
import type { MenuConfig } from './menu.js';
|
||||
import type { MenuItemRender } from './types.js';
|
||||
|
||||
export const menuGroupItems = {
|
||||
group: (config: { name?: string; items: MenuConfig[] }) => (menu, index) => {
|
||||
const items = menu.renderItems(config.items);
|
||||
if (!items.length) {
|
||||
return;
|
||||
}
|
||||
if (IS_MOBILE) {
|
||||
return html` <div
|
||||
style="
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background-color: ${unsafeCSSVarV2('layer/background/primary')};
|
||||
padding: 4px;
|
||||
border-radius: 12px;
|
||||
"
|
||||
>
|
||||
${items}
|
||||
</div>`;
|
||||
}
|
||||
const result: TemplateResult = html` ${index === 0
|
||||
? ''
|
||||
: html` <div
|
||||
style="height: 0.5px;background-color: var(--affine-divider-color);margin: 4px 0"
|
||||
></div>`}
|
||||
<div style="display: flex;flex-direction: column;gap:4px">${items}</div>`;
|
||||
return result;
|
||||
},
|
||||
} satisfies Record<string, MenuItemRender<never>>;
|
||||
Reference in New Issue
Block a user