mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-11-27 16:21:58 +03:00
feat: replace button from @toeverything/components (#3608)
This commit is contained in:
parent
7826ecfa58
commit
6efe29f7ef
@ -33,7 +33,7 @@
|
|||||||
"@emotion/styled": "^11.11.0",
|
"@emotion/styled": "^11.11.0",
|
||||||
"@mui/material": "^5.14.2",
|
"@mui/material": "^5.14.2",
|
||||||
"@react-hookz/web": "^23.1.0",
|
"@react-hookz/web": "^23.1.0",
|
||||||
"@toeverything/components": "^0.0.6",
|
"@toeverything/components": "^0.0.8",
|
||||||
"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",
|
||||||
|
@ -133,6 +133,7 @@ const rootImportsMapSetupPromise = setupImportsMap(_rootImportsMap, {
|
|||||||
'@blocksuite/blocks/std': import('@blocksuite/blocks/std'),
|
'@blocksuite/blocks/std': import('@blocksuite/blocks/std'),
|
||||||
'@blocksuite/global/utils': import('@blocksuite/global/utils'),
|
'@blocksuite/global/utils': import('@blocksuite/global/utils'),
|
||||||
'@toeverything/infra/atom': import('@toeverything/infra/atom'),
|
'@toeverything/infra/atom': import('@toeverything/infra/atom'),
|
||||||
|
'@toeverything/components/button': import('@toeverything/components/button'),
|
||||||
});
|
});
|
||||||
|
|
||||||
// pluginName -> module -> importName -> updater[]
|
// pluginName -> module -> importName -> updater[]
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import {
|
import {
|
||||||
Button,
|
|
||||||
Input,
|
Input,
|
||||||
Modal,
|
Modal,
|
||||||
ModalCloseButton,
|
ModalCloseButton,
|
||||||
@ -10,6 +9,7 @@ import {
|
|||||||
import { DebugLogger } from '@affine/debug';
|
import { DebugLogger } from '@affine/debug';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||||
import { HelpIcon } from '@blocksuite/icons';
|
import { HelpIcon } from '@blocksuite/icons';
|
||||||
|
import { Button } from '@toeverything/components/button';
|
||||||
import { useSetAtom } from 'jotai';
|
import { useSetAtom } from 'jotai';
|
||||||
import type { KeyboardEvent } from 'react';
|
import type { KeyboardEvent } from 'react';
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
import { IconButton, Modal, ModalWrapper } from '@affine/component';
|
import { Modal, ModalWrapper, Wrapper } from '@affine/component';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||||
import { CloseIcon } from '@blocksuite/icons';
|
import { CloseIcon } from '@blocksuite/icons';
|
||||||
|
import { Button, IconButton } from '@toeverything/components/button';
|
||||||
import type React from 'react';
|
import type React from 'react';
|
||||||
|
|
||||||
import { Content, ContentTitle, Header, StyleButton, StyleTips } from './style';
|
import { Content, ContentTitle, Header, StyleTips } from './style';
|
||||||
|
|
||||||
interface EnableAffineCloudModalProps {
|
interface EnableAffineCloudModalProps {
|
||||||
open: boolean;
|
open: boolean;
|
||||||
@ -30,19 +31,22 @@ export const EnableAffineCloudModal: React.FC<EnableAffineCloudModalProps> = ({
|
|||||||
<ContentTitle>{t['Enable AFFiNE Cloud']()}?</ContentTitle>
|
<ContentTitle>{t['Enable AFFiNE Cloud']()}?</ContentTitle>
|
||||||
<StyleTips>{t['Enable AFFiNE Cloud Description']()}</StyleTips>
|
<StyleTips>{t['Enable AFFiNE Cloud Description']()}</StyleTips>
|
||||||
{/* <StyleTips>{t('Retain cached cloud data')}</StyleTips> */}
|
{/* <StyleTips>{t('Retain cached cloud data')}</StyleTips> */}
|
||||||
<div>
|
<Wrapper width={284} margin="auto">
|
||||||
<StyleButton
|
<Button
|
||||||
data-testid="confirm-enable-affine-cloud-button"
|
data-testid="confirm-enable-affine-cloud-button"
|
||||||
shape="round"
|
|
||||||
type="primary"
|
type="primary"
|
||||||
|
block
|
||||||
onClick={onConfirm}
|
onClick={onConfirm}
|
||||||
|
style={{
|
||||||
|
marginBottom: '16px',
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{t['Sign in and Enable']()}
|
{t['Sign in and Enable']()}
|
||||||
</StyleButton>
|
</Button>
|
||||||
<StyleButton shape="round" onClick={onClose}>
|
<Button onClick={onClose} block>
|
||||||
{t['Not now']()}
|
{t['Not now']()}
|
||||||
</StyleButton>
|
</Button>
|
||||||
</div>
|
</Wrapper>
|
||||||
</Content>
|
</Content>
|
||||||
</ModalWrapper>
|
</ModalWrapper>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Button, styled } from '@affine/component';
|
import { styled } from '@affine/component';
|
||||||
|
|
||||||
export const Header = styled('div')({
|
export const Header = styled('div')({
|
||||||
height: '44px',
|
height: '44px',
|
||||||
@ -29,12 +29,3 @@ export const StyleTips = styled('div')(() => {
|
|||||||
marginTop: '12px',
|
marginTop: '12px',
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
export const StyleButton = styled(Button)(() => {
|
|
||||||
return {
|
|
||||||
width: '284px',
|
|
||||||
display: 'block',
|
|
||||||
margin: 'auto',
|
|
||||||
marginTop: '16px',
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
@ -1,15 +1,9 @@
|
|||||||
import {
|
import { Menu, MenuItem, MenuTrigger, styled } from '@affine/component';
|
||||||
type ButtonProps,
|
|
||||||
Menu,
|
|
||||||
MenuItem,
|
|
||||||
MenuTrigger,
|
|
||||||
styled,
|
|
||||||
} from '@affine/component';
|
|
||||||
import { LOCALES } from '@affine/i18n';
|
import { LOCALES } from '@affine/i18n';
|
||||||
import { useI18N } from '@affine/i18n';
|
import { useI18N } from '@affine/i18n';
|
||||||
|
import type { ButtonProps } from '@toeverything/components/button';
|
||||||
import type { FC, ReactElement } from 'react';
|
import type { FC, ReactElement } from 'react';
|
||||||
import { useCallback } from 'react';
|
import { useCallback } from 'react';
|
||||||
|
|
||||||
export const StyledListItem = styled(MenuItem)(() => ({
|
export const StyledListItem = styled(MenuItem)(() => ({
|
||||||
width: '132px',
|
width: '132px',
|
||||||
height: '38px',
|
height: '38px',
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import { Button, Input, Modal, ModalCloseButton } from '@affine/component';
|
import { Input, Modal, ModalCloseButton } from '@affine/component';
|
||||||
import { WorkspaceFlavour } from '@affine/env/workspace';
|
import { WorkspaceFlavour } from '@affine/env/workspace';
|
||||||
import { Trans } from '@affine/i18n';
|
import { Trans } from '@affine/i18n';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||||
|
import { Button } from '@toeverything/components/button';
|
||||||
import { useBlockSuiteWorkspaceName } from '@toeverything/hooks/use-block-suite-workspace-name';
|
import { useBlockSuiteWorkspaceName } from '@toeverything/hooks/use-block-suite-workspace-name';
|
||||||
import { useCallback, useState } from 'react';
|
import { useCallback, useState } from 'react';
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { Modal } from '@affine/component';
|
import { Modal } from '@affine/component';
|
||||||
import { ModalCloseButton } from '@affine/component';
|
import { ModalCloseButton } from '@affine/component';
|
||||||
import { Button } from '@affine/component';
|
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||||
|
import { Button } from '@toeverything/components/button';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
StyledButtonContent,
|
StyledButtonContent,
|
||||||
@ -38,7 +38,6 @@ export const WorkspaceLeave = ({ open, onClose }: WorkspaceDeleteProps) => {
|
|||||||
<Button
|
<Button
|
||||||
onClick={handleLeave}
|
onClick={handleLeave}
|
||||||
type="error"
|
type="error"
|
||||||
shape="circle"
|
|
||||||
style={{ marginLeft: '24px' }}
|
style={{ marginLeft: '24px' }}
|
||||||
>
|
>
|
||||||
{t['Leave']()}
|
{t['Leave']()}
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import { Button, toast } from '@affine/component';
|
import { toast } from '@affine/component';
|
||||||
import { SettingRow } from '@affine/component/setting-components';
|
import { SettingRow } from '@affine/component/setting-components';
|
||||||
import { isDesktop } from '@affine/env/constant';
|
import { isDesktop } from '@affine/env/constant';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||||
|
import { Button } from '@toeverything/components/button';
|
||||||
import { type FC, useCallback } from 'react';
|
import { type FC, useCallback } from 'react';
|
||||||
|
|
||||||
import type { AffineOfficialWorkspace } from '../../../shared';
|
import type { AffineOfficialWorkspace } from '../../../shared';
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import { IconButton, Input, toast } from '@affine/component';
|
import { Input, toast } from '@affine/component';
|
||||||
import { WorkspaceAvatar } from '@affine/component/workspace-avatar';
|
import { WorkspaceAvatar } from '@affine/component/workspace-avatar';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||||
import { DoneIcon } from '@blocksuite/icons';
|
import { DoneIcon } from '@blocksuite/icons';
|
||||||
|
import { IconButton } from '@toeverything/components/button';
|
||||||
import { useBlockSuiteWorkspaceAvatarUrl } from '@toeverything/hooks/use-block-suite-workspace-avatar-url';
|
import { useBlockSuiteWorkspaceAvatarUrl } from '@toeverything/hooks/use-block-suite-workspace-avatar-url';
|
||||||
import { useBlockSuiteWorkspaceName } from '@toeverything/hooks/use-block-suite-workspace-name';
|
import { useBlockSuiteWorkspaceName } from '@toeverything/hooks/use-block-suite-workspace-name';
|
||||||
import { type FC, useCallback, useState } from 'react';
|
import { type FC, useCallback, useState } from 'react';
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Button, FlexWrapper, Switch, Tooltip } from '@affine/component';
|
import { FlexWrapper, Switch, Tooltip } from '@affine/component';
|
||||||
import { SettingRow } from '@affine/component/setting-components';
|
import { SettingRow } from '@affine/component/setting-components';
|
||||||
import { Unreachable } from '@affine/env/constant';
|
import { Unreachable } from '@affine/env/constant';
|
||||||
import type {
|
import type {
|
||||||
@ -7,6 +7,7 @@ import type {
|
|||||||
} from '@affine/env/workspace';
|
} from '@affine/env/workspace';
|
||||||
import { WorkspaceFlavour } from '@affine/env/workspace';
|
import { WorkspaceFlavour } from '@affine/env/workspace';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||||
|
import { Button } from '@toeverything/components/button';
|
||||||
import { useBlockSuiteWorkspaceName } from '@toeverything/hooks/use-block-suite-workspace-name';
|
import { useBlockSuiteWorkspaceName } from '@toeverything/hooks/use-block-suite-workspace-name';
|
||||||
import type { FC } from 'react';
|
import type { FC } from 'react';
|
||||||
import { useCallback, useEffect, useState } from 'react';
|
import { useCallback, useEffect, useState } from 'react';
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { Button, FlexWrapper, toast, Tooltip } from '@affine/component';
|
import { FlexWrapper, toast, Tooltip } from '@affine/component';
|
||||||
import { SettingRow } from '@affine/component/setting-components';
|
import { SettingRow } from '@affine/component/setting-components';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||||
|
import { Button } from '@toeverything/components/button';
|
||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
import { type FC, useCallback, useEffect, useState } from 'react';
|
import { type FC, useCallback, useEffect, useState } from 'react';
|
||||||
|
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import { Empty, IconButton, Modal, ModalWrapper } from '@affine/component';
|
import { Empty, Modal, ModalWrapper } from '@affine/component';
|
||||||
import { Trans } from '@affine/i18n';
|
import { Trans } from '@affine/i18n';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||||
import { CloseIcon } from '@blocksuite/icons';
|
import { CloseIcon } from '@blocksuite/icons';
|
||||||
|
import { IconButton } from '@toeverything/components/button';
|
||||||
import type React from 'react';
|
import type React from 'react';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@ -66,7 +67,7 @@ export const TmpDisableAffineCloudModal: React.FC<
|
|||||||
/>
|
/>
|
||||||
</StyleImage>
|
</StyleImage>
|
||||||
<StyleButtonContainer>
|
<StyleButtonContainer>
|
||||||
<StyleButton shape="round" type="primary" onClick={onClose}>
|
<StyleButton type="primary" onClick={onClose}>
|
||||||
{t['Got it']()}
|
{t['Got it']()}
|
||||||
</StyleButton>
|
</StyleButton>
|
||||||
</StyleButtonContainer>
|
</StyleButtonContainer>
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { Button, displayFlex, styled } from '@affine/component';
|
import { displayFlex, styled } from '@affine/component';
|
||||||
|
import { Button } from '@toeverything/components/button';
|
||||||
|
|
||||||
export const Header = styled('div')({
|
export const Header = styled('div')({
|
||||||
height: '44px',
|
height: '44px',
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { IconButton, Modal, ModalWrapper } from '@affine/component';
|
import { Modal, ModalWrapper } from '@affine/component';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||||
import { CloseIcon } from '@blocksuite/icons';
|
import { CloseIcon } from '@blocksuite/icons';
|
||||||
|
import { IconButton } from '@toeverything/components/button';
|
||||||
import type React from 'react';
|
import type React from 'react';
|
||||||
|
|
||||||
import { Content, ContentTitle, Header, StyleButton, StyleTips } from './style';
|
import { Content, ContentTitle, Header, StyleButton, StyleTips } from './style';
|
||||||
@ -35,7 +36,6 @@ export const TransformWorkspaceToAffineModal: React.FC<
|
|||||||
<div>
|
<div>
|
||||||
<StyleButton
|
<StyleButton
|
||||||
data-testid="confirm-enable-cloud-button"
|
data-testid="confirm-enable-cloud-button"
|
||||||
shape="round"
|
|
||||||
type="primary"
|
type="primary"
|
||||||
onClick={onConform}
|
onClick={onConform}
|
||||||
>
|
>
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { Button, styled } from '@affine/component';
|
import { styled } from '@affine/component';
|
||||||
|
import { Button } from '@toeverything/components/button';
|
||||||
|
|
||||||
export const Header = styled('div')({
|
export const Header = styled('div')({
|
||||||
height: '44px',
|
height: '44px',
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// fixme(himself65): refactor this file
|
// fixme(himself65): refactor this file
|
||||||
import { FlexWrapper, IconButton, Menu, MenuItem } from '@affine/component';
|
import { FlexWrapper, Menu, MenuItem } from '@affine/component';
|
||||||
import { Export, MoveToTrash } from '@affine/component/page-list';
|
import { Export, MoveToTrash } from '@affine/component/page-list';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||||
import { assertExists } from '@blocksuite/global/utils';
|
import { assertExists } from '@blocksuite/global/utils';
|
||||||
@ -10,6 +10,7 @@ import {
|
|||||||
MoreVerticalIcon,
|
MoreVerticalIcon,
|
||||||
PageIcon,
|
PageIcon,
|
||||||
} from '@blocksuite/icons';
|
} from '@blocksuite/icons';
|
||||||
|
import { IconButton } from '@toeverything/components/button';
|
||||||
import {
|
import {
|
||||||
useBlockSuitePageMeta,
|
useBlockSuitePageMeta,
|
||||||
usePageMetaHelper,
|
usePageMetaHelper,
|
||||||
@ -23,8 +24,8 @@ import { pageSettingFamily } from '../../../../atoms';
|
|||||||
import { useBlockSuiteMetaHelper } from '../../../../hooks/affine/use-block-suite-meta-helper';
|
import { useBlockSuiteMetaHelper } from '../../../../hooks/affine/use-block-suite-meta-helper';
|
||||||
import { useCurrentWorkspace } from '../../../../hooks/current/use-current-workspace';
|
import { useCurrentWorkspace } from '../../../../hooks/current/use-current-workspace';
|
||||||
import { toast } from '../../../../utils';
|
import { toast } from '../../../../utils';
|
||||||
import { MenuThemeModeSwitch } from '../header-right-items/theme-mode-switch';
|
|
||||||
import { LanguageMenu } from './language-menu';
|
import { LanguageMenu } from './language-menu';
|
||||||
|
import { MenuThemeModeSwitch } from './theme-mode-switch';
|
||||||
const CommonMenu = () => {
|
const CommonMenu = () => {
|
||||||
const content = (
|
const content = (
|
||||||
<div
|
<div
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import { Button, displayFlex, Menu, MenuItem, styled } from '@affine/component';
|
import { displayFlex, Menu, MenuItem, styled } from '@affine/component';
|
||||||
import { LOCALES } from '@affine/i18n';
|
import { LOCALES } from '@affine/i18n';
|
||||||
import { useI18N } from '@affine/i18n';
|
import { useI18N } from '@affine/i18n';
|
||||||
import { ArrowDownSmallIcon, LanguageIcon } from '@blocksuite/icons';
|
import { ArrowDownSmallIcon, LanguageIcon } from '@blocksuite/icons';
|
||||||
|
import { Button } from '@toeverything/components/button';
|
||||||
import type { FC, ReactElement } from 'react';
|
import type { FC, ReactElement } from 'react';
|
||||||
import { useCallback } from 'react';
|
import { useCallback } from 'react';
|
||||||
|
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import { Button, Confirm } from '@affine/component';
|
import { Confirm } from '@affine/component';
|
||||||
import { WorkspaceSubPath } from '@affine/env/workspace';
|
import { WorkspaceSubPath } from '@affine/env/workspace';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||||
import { assertExists } from '@blocksuite/global/utils';
|
import { assertExists } from '@blocksuite/global/utils';
|
||||||
|
import { Button } from '@toeverything/components/button';
|
||||||
import { useBlockSuitePageMeta } from '@toeverything/hooks/use-block-suite-page-meta';
|
import { useBlockSuitePageMeta } from '@toeverything/hooks/use-block-suite-page-meta';
|
||||||
import { currentPageIdAtom } from '@toeverything/infra/atom';
|
import { currentPageIdAtom } from '@toeverything/infra/atom';
|
||||||
import { useAtomValue } from 'jotai';
|
import { useAtomValue } from 'jotai';
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { Button } from '@affine/component';
|
|
||||||
import { assertExists } from '@blocksuite/global/utils';
|
import { assertExists } from '@blocksuite/global/utils';
|
||||||
|
import { Button } from '@toeverything/components/button';
|
||||||
import {
|
import {
|
||||||
useBlockSuitePageMeta,
|
useBlockSuitePageMeta,
|
||||||
usePageMetaHelper,
|
usePageMetaHelper,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { Button } from '@affine/component';
|
|
||||||
import { styled } from '@affine/component';
|
import { styled } from '@affine/component';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||||
|
import { Button } from '@toeverything/components/button';
|
||||||
import type { ChangeEvent } from 'react';
|
import type { ChangeEvent } from 'react';
|
||||||
import type React from 'react';
|
import type React from 'react';
|
||||||
import { useRef } from 'react';
|
import { useRef } from 'react';
|
||||||
|
@ -4,17 +4,7 @@ import {
|
|||||||
styled,
|
styled,
|
||||||
textEllipsis,
|
textEllipsis,
|
||||||
} from '@affine/component';
|
} from '@affine/component';
|
||||||
import { Button } from '@affine/component';
|
import { Button } from '@toeverything/components/button';
|
||||||
|
|
||||||
export const StyledSplitLine = styled('div')(() => {
|
|
||||||
return {
|
|
||||||
width: '1px',
|
|
||||||
height: '20px',
|
|
||||||
background: 'var(--affine-border-color)',
|
|
||||||
marginRight: '24px',
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
export const StyleWorkspaceInfo = styled('div')(() => {
|
export const StyleWorkspaceInfo = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
marginLeft: '15px',
|
marginLeft: '15px',
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
import type { IconButtonProps } from '@affine/component';
|
|
||||||
import { IconButton } from '@affine/component';
|
|
||||||
import { styled } from '@affine/component';
|
import { styled } from '@affine/component';
|
||||||
import { ArrowDownSmallIcon } from '@blocksuite/icons';
|
import { ArrowDownSmallIcon } from '@blocksuite/icons';
|
||||||
|
import {
|
||||||
|
IconButton,
|
||||||
|
type IconButtonProps,
|
||||||
|
} from '@toeverything/components/button';
|
||||||
|
|
||||||
const StyledIconButtonWithAnimate = styled(IconButton)(() => {
|
const StyledIconButtonWithAnimate = styled(IconButton)(() => {
|
||||||
return {
|
return {
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import { IconButton } from '@affine/component';
|
|
||||||
import {
|
import {
|
||||||
EditCollectionModel,
|
EditCollectionModel,
|
||||||
useCollectionManager,
|
useCollectionManager,
|
||||||
@ -8,6 +7,7 @@ import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
|||||||
import { PlusIcon } from '@blocksuite/icons';
|
import { PlusIcon } from '@blocksuite/icons';
|
||||||
import type { Workspace } from '@blocksuite/store';
|
import type { Workspace } from '@blocksuite/store';
|
||||||
import { uuidv4 } from '@blocksuite/store';
|
import { uuidv4 } from '@blocksuite/store';
|
||||||
|
import { IconButton } from '@toeverything/components/button';
|
||||||
import { useCallback, useState } from 'react';
|
import { useCallback, useState } from 'react';
|
||||||
|
|
||||||
import { useGetPageInfoById } from '../../../../hooks/use-get-page-info';
|
import { useGetPageInfoById } from '../../../../hooks/use-get-page-info';
|
||||||
|
@ -33,7 +33,6 @@ export const NotfoundPage = () => {
|
|||||||
|
|
||||||
<p>{t['404 - Page Not Found']()}</p>
|
<p>{t['404 - Page Not Found']()}</p>
|
||||||
<Button
|
<Button
|
||||||
shape="round"
|
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
const id = localStorage.getItem('last_workspace_id');
|
const id = localStorage.getItem('last_workspace_id');
|
||||||
if (id) {
|
if (id) {
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import { IconButton } from '@affine/component';
|
|
||||||
import {
|
import {
|
||||||
AppSidebar,
|
AppSidebar,
|
||||||
AppSidebarFallback,
|
AppSidebarFallback,
|
||||||
@ -19,6 +18,7 @@ import {
|
|||||||
SidebarIcon,
|
SidebarIcon,
|
||||||
} from '@blocksuite/icons';
|
} from '@blocksuite/icons';
|
||||||
import type { Meta, StoryFn } from '@storybook/react';
|
import type { Meta, StoryFn } from '@storybook/react';
|
||||||
|
import { IconButton } from '@toeverything/components/button';
|
||||||
import { useAtom } from 'jotai';
|
import { useAtom } from 'jotai';
|
||||||
import { type PropsWithChildren, useState } from 'react';
|
import { type PropsWithChildren, useState } from 'react';
|
||||||
import { MemoryRouter } from 'react-router-dom';
|
import { MemoryRouter } from 'react-router-dom';
|
||||||
|
@ -1,138 +0,0 @@
|
|||||||
/* deepscan-disable USELESS_ARROW_FUNC_BIND */
|
|
||||||
import type { ButtonProps } from '@affine/component';
|
|
||||||
import { Button } from '@affine/component';
|
|
||||||
import { DropdownButton } from '@affine/component';
|
|
||||||
import { RadioButton, RadioButtonGroup } from '@affine/component';
|
|
||||||
import { Menu } from '@affine/component';
|
|
||||||
import { toast } from '@affine/component';
|
|
||||||
import { InformationIcon } from '@blocksuite/icons';
|
|
||||||
import type { Meta, StoryFn } from '@storybook/react';
|
|
||||||
import { useState } from 'react';
|
|
||||||
export default {
|
|
||||||
title: 'AFFiNE/Button',
|
|
||||||
component: Button,
|
|
||||||
argTypes: {
|
|
||||||
hoverBackground: { control: 'color' },
|
|
||||||
hoverColor: { control: 'color' },
|
|
||||||
},
|
|
||||||
} as Meta<ButtonProps>;
|
|
||||||
|
|
||||||
const Template: StoryFn<ButtonProps> = args => <Button {...args} />;
|
|
||||||
|
|
||||||
export const Primary = Template.bind(undefined);
|
|
||||||
Primary.args = {
|
|
||||||
type: 'primary',
|
|
||||||
children: 'Content',
|
|
||||||
onClick: () => toast('Click button'),
|
|
||||||
icon: <InformationIcon />,
|
|
||||||
};
|
|
||||||
|
|
||||||
export const Default = Template.bind(undefined);
|
|
||||||
Default.args = {
|
|
||||||
type: 'default',
|
|
||||||
children: 'This is a default button',
|
|
||||||
onClick: () => toast('Click button'),
|
|
||||||
};
|
|
||||||
|
|
||||||
export const Light = Template.bind(undefined);
|
|
||||||
Light.args = {
|
|
||||||
type: 'error',
|
|
||||||
children: 'This is a light button',
|
|
||||||
onClick: () => toast('Click button'),
|
|
||||||
};
|
|
||||||
|
|
||||||
export const Warning = Template.bind(undefined);
|
|
||||||
Warning.args = {
|
|
||||||
type: 'warning',
|
|
||||||
children: 'This is a warning button',
|
|
||||||
onClick: () => toast('Click button'),
|
|
||||||
};
|
|
||||||
|
|
||||||
export const Danger = Template.bind(undefined);
|
|
||||||
Danger.args = {
|
|
||||||
type: 'success',
|
|
||||||
children: 'This is a danger button',
|
|
||||||
onClick: () => toast('Click button'),
|
|
||||||
};
|
|
||||||
|
|
||||||
export const Dropdown: StoryFn = ({ onClickDropDown, ...props }) => {
|
|
||||||
const [open, setOpen] = useState(false);
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<DropdownButton onClickDropDown={onClickDropDown} {...props}>
|
|
||||||
Dropdown Button
|
|
||||||
</DropdownButton>
|
|
||||||
|
|
||||||
<Menu
|
|
||||||
visible={open}
|
|
||||||
placement="bottom-end"
|
|
||||||
trigger={['click']}
|
|
||||||
width={235}
|
|
||||||
disablePortal={true}
|
|
||||||
onClickAway={() => {
|
|
||||||
setOpen(false);
|
|
||||||
}}
|
|
||||||
content={<>Dropdown Menu</>}
|
|
||||||
>
|
|
||||||
<DropdownButton
|
|
||||||
onClick={() => {
|
|
||||||
toast('Click button');
|
|
||||||
setOpen(false);
|
|
||||||
}}
|
|
||||||
onClickDropDown={() => setOpen(!open)}
|
|
||||||
>
|
|
||||||
Dropdown with Menu
|
|
||||||
</DropdownButton>
|
|
||||||
</Menu>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
Dropdown.args = {
|
|
||||||
onClick: () => toast('Click button'),
|
|
||||||
onClickDropDown: () => toast('Click dropdown'),
|
|
||||||
};
|
|
||||||
|
|
||||||
export const RadioGroup: StoryFn = ({ ...props }) => {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<RadioButtonGroup {...props}>
|
|
||||||
<RadioButton value="all">All</RadioButton>
|
|
||||||
<RadioButton value="page">Page</RadioButton>
|
|
||||||
<RadioButton value="edgeless">Edgeless</RadioButton>
|
|
||||||
</RadioButtonGroup>
|
|
||||||
<RadioButtonGroup {...props}>
|
|
||||||
<RadioButton value="all">Long long text and some more</RadioButton>
|
|
||||||
<RadioButton value="page">Lorem ipsum dolor sit amet</RadioButton>
|
|
||||||
<RadioButton value="edgeless">Long long text</RadioButton>
|
|
||||||
</RadioButtonGroup>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
RadioGroup.args = {
|
|
||||||
defaultValue: 'all',
|
|
||||||
onValueChange: (value: string) => toast(`Radio value: ${value}`),
|
|
||||||
};
|
|
||||||
|
|
||||||
export const Test: StoryFn<ButtonProps> = () => {
|
|
||||||
const [input, setInput] = useState('');
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
data-testid="test-input"
|
|
||||||
value={input}
|
|
||||||
onChange={e => setInput(e.target.value)}
|
|
||||||
/>
|
|
||||||
<Button
|
|
||||||
onClick={() => {
|
|
||||||
setInput('');
|
|
||||||
}}
|
|
||||||
data-testid="clear-button"
|
|
||||||
>
|
|
||||||
clear
|
|
||||||
</Button>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
Test.storyName = 'Click Test';
|
|
@ -1,25 +0,0 @@
|
|||||||
/* deepscan-disable USELESS_ARROW_FUNC_BIND */
|
|
||||||
import { IconButton, type IconButtonProps } from '@affine/component';
|
|
||||||
import { toast } from '@affine/component';
|
|
||||||
import { InformationIcon } from '@blocksuite/icons';
|
|
||||||
import type { Meta, StoryFn } from '@storybook/react';
|
|
||||||
export default {
|
|
||||||
title: 'AFFiNE/IconButton',
|
|
||||||
component: IconButton,
|
|
||||||
} as Meta<IconButtonProps>;
|
|
||||||
|
|
||||||
const IconButtonTemplate: StoryFn<IconButtonProps> = args => {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<h1>This is icon button</h1>
|
|
||||||
<IconButton {...args} />
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export const Icon = IconButtonTemplate.bind(undefined);
|
|
||||||
Icon.args = {
|
|
||||||
children: <InformationIcon />,
|
|
||||||
onClick: () => toast('Click button'),
|
|
||||||
withoutPadding: true,
|
|
||||||
};
|
|
@ -1,7 +1,7 @@
|
|||||||
import { ArrowLeftSmallIcon, ArrowRightSmallIcon } from '@blocksuite/icons';
|
import { ArrowLeftSmallIcon, ArrowRightSmallIcon } from '@blocksuite/icons';
|
||||||
|
import { IconButton } from '@toeverything/components/button';
|
||||||
import { useAtomValue } from 'jotai';
|
import { useAtomValue } from 'jotai';
|
||||||
|
|
||||||
import { IconButton } from '../../..';
|
|
||||||
import type { History } from '..';
|
import type { History } from '..';
|
||||||
import { navHeaderStyle } from '../index.css';
|
import { navHeaderStyle } from '../index.css';
|
||||||
import { appSidebarOpenAtom } from '../index.jotai';
|
import { appSidebarOpenAtom } from '../index.jotai';
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||||
import { SidebarIcon } from '@blocksuite/icons';
|
import { SidebarIcon } from '@blocksuite/icons';
|
||||||
|
import { IconButton } from '@toeverything/components/button';
|
||||||
import { useAtom } from 'jotai';
|
import { useAtom } from 'jotai';
|
||||||
|
|
||||||
import { IconButton, Tooltip } from '../../../';
|
import { Tooltip } from '../../../';
|
||||||
import { appSidebarOpenAtom } from '../index.jotai';
|
import { appSidebarOpenAtom } from '../index.jotai';
|
||||||
|
|
||||||
export const SidebarSwitch = () => {
|
export const SidebarSwitch = () => {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
|
import { IconButton } from '@toeverything/components/button';
|
||||||
|
|
||||||
import { displayFlex, styled, textEllipsis } from '../../../styles';
|
import { displayFlex, styled, textEllipsis } from '../../../styles';
|
||||||
import { IconButton } from '../../../ui/button/icon-button';
|
|
||||||
|
|
||||||
export const StyleWorkspaceInfo = styled('div')(() => {
|
export const StyleWorkspaceInfo = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
import { CloseIcon, InformationIcon } from '@blocksuite/icons';
|
import { CloseIcon, InformationIcon } from '@blocksuite/icons';
|
||||||
import * as Toast from '@radix-ui/react-toast';
|
import * as Toast from '@radix-ui/react-toast';
|
||||||
|
import { IconButton } from '@toeverything/components/button';
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
import { useAtom, useAtomValue, useSetAtom } from 'jotai';
|
import { useAtom, useAtomValue, useSetAtom } from 'jotai';
|
||||||
import type { ReactElement } from 'react';
|
import type { ReactElement } from 'react';
|
||||||
@ -16,7 +17,6 @@ import {
|
|||||||
useState,
|
useState,
|
||||||
} from 'react';
|
} from 'react';
|
||||||
|
|
||||||
import { IconButton } from '../../ui/button';
|
|
||||||
import * as styles from './index.css';
|
import * as styles from './index.css';
|
||||||
import type { Notification } from './index.jotai';
|
import type { Notification } from './index.jotai';
|
||||||
import {
|
import {
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||||
import { FavoritedIcon, FavoriteIcon } from '@blocksuite/icons';
|
import { FavoritedIcon, FavoriteIcon } from '@blocksuite/icons';
|
||||||
|
import {
|
||||||
|
IconButton,
|
||||||
|
type IconButtonProps,
|
||||||
|
} from '@toeverything/components/button';
|
||||||
import { forwardRef } from 'react';
|
import { forwardRef } from 'react';
|
||||||
|
|
||||||
import type { IconButtonProps } from '../../..';
|
import { Tooltip } from '../../..';
|
||||||
import { IconButton, Tooltip } from '../../..';
|
|
||||||
|
|
||||||
export const FavoriteTag = forwardRef<
|
export const FavoriteTag = forwardRef<
|
||||||
HTMLButtonElement,
|
HTMLButtonElement,
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
import type { Filter } from '@affine/env/filter';
|
import type { Filter } from '@affine/env/filter';
|
||||||
import type { PropertiesMeta } from '@affine/env/filter';
|
import type { PropertiesMeta } from '@affine/env/filter';
|
||||||
import { CloseIcon, PlusIcon } from '@blocksuite/icons';
|
import { CloseIcon, PlusIcon } from '@blocksuite/icons';
|
||||||
|
import { Button } from '@toeverything/components/button';
|
||||||
|
import { IconButton } from '@toeverything/components/button';
|
||||||
|
|
||||||
import { Button, IconButton, Menu } from '../../..';
|
import { Menu } from '../../..';
|
||||||
import { Condition } from './condition';
|
import { Condition } from './condition';
|
||||||
import * as styles from './index.css';
|
import * as styles from './index.css';
|
||||||
import { CreateFilterMenu } from './vars';
|
import { CreateFilterMenu } from './vars';
|
||||||
|
@ -8,16 +8,10 @@ import {
|
|||||||
OpenInNewIcon,
|
OpenInNewIcon,
|
||||||
ResetIcon,
|
ResetIcon,
|
||||||
} from '@blocksuite/icons';
|
} from '@blocksuite/icons';
|
||||||
|
import { IconButton } from '@toeverything/components/button';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
|
|
||||||
import {
|
import { Confirm, FlexWrapper, Menu, MenuItem, Tooltip } from '../../..';
|
||||||
Confirm,
|
|
||||||
FlexWrapper,
|
|
||||||
IconButton,
|
|
||||||
Menu,
|
|
||||||
MenuItem,
|
|
||||||
Tooltip,
|
|
||||||
} from '../../..';
|
|
||||||
import { DisablePublicSharing, MoveToTrash } from './operation-menu-items';
|
import { DisablePublicSharing, MoveToTrash } from './operation-menu-items';
|
||||||
|
|
||||||
export interface OperationCellProps {
|
export interface OperationCellProps {
|
||||||
|
@ -11,11 +11,11 @@ import {
|
|||||||
UnpinIcon,
|
UnpinIcon,
|
||||||
ViewLayersIcon,
|
ViewLayersIcon,
|
||||||
} from '@blocksuite/icons';
|
} from '@blocksuite/icons';
|
||||||
|
import { Button } from '@toeverything/components/button';
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
import type { ReactNode } from 'react';
|
import type { ReactNode } from 'react';
|
||||||
import { useCallback, useMemo, useState } from 'react';
|
import { useCallback, useMemo, useState } from 'react';
|
||||||
|
|
||||||
import { Button } from '../../../ui/button/button';
|
|
||||||
import { useCollectionManager } from '../use-collection-manager';
|
import { useCollectionManager } from '../use-collection-manager';
|
||||||
import * as styles from './collection-bar.css';
|
import * as styles from './collection-bar.css';
|
||||||
|
|
||||||
|
@ -11,12 +11,13 @@ import {
|
|||||||
PinIcon,
|
PinIcon,
|
||||||
ViewLayersIcon,
|
ViewLayersIcon,
|
||||||
} from '@blocksuite/icons';
|
} from '@blocksuite/icons';
|
||||||
|
import { Button } from '@toeverything/components/button';
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
import { useAtom } from 'jotai';
|
import { useAtom } from 'jotai';
|
||||||
import type { MouseEvent, ReactNode } from 'react';
|
import type { MouseEvent, ReactNode } from 'react';
|
||||||
import { useCallback, useMemo, useState } from 'react';
|
import { useCallback, useMemo, useState } from 'react';
|
||||||
|
|
||||||
import { Button, MenuItem, Tooltip } from '../../..';
|
import { MenuItem, Tooltip } from '../../..';
|
||||||
import Menu from '../../../ui/menu/menu';
|
import Menu from '../../../ui/menu/menu';
|
||||||
import { appSidebarOpenAtom } from '../../app-sidebar';
|
import { appSidebarOpenAtom } from '../../app-sidebar';
|
||||||
import { CreateFilterMenu } from '../filter/vars';
|
import { CreateFilterMenu } from '../filter/vars';
|
||||||
|
@ -9,10 +9,10 @@ import {
|
|||||||
SaveIcon,
|
SaveIcon,
|
||||||
} from '@blocksuite/icons';
|
} from '@blocksuite/icons';
|
||||||
import { uuidv4 } from '@blocksuite/store';
|
import { uuidv4 } from '@blocksuite/store';
|
||||||
|
import { Button } from '@toeverything/components/button';
|
||||||
import { useCallback, useMemo, useState } from 'react';
|
import { useCallback, useMemo, useState } from 'react';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Button,
|
|
||||||
Input,
|
Input,
|
||||||
Modal,
|
Modal,
|
||||||
ModalCloseButton,
|
ModalCloseButton,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||||
|
import { Button } from '@toeverything/components/button';
|
||||||
|
|
||||||
import { Modal, ModalCloseButton } from '../../..';
|
import { Modal, ModalCloseButton } from '../../..';
|
||||||
import { Button } from '../../../ui/button';
|
|
||||||
import {
|
import {
|
||||||
StyledButtonContent,
|
StyledButtonContent,
|
||||||
StyledModalHeader,
|
StyledModalHeader,
|
||||||
|
@ -4,11 +4,11 @@ import type {
|
|||||||
} from '@affine/env/workspace';
|
} from '@affine/env/workspace';
|
||||||
import { ExportIcon, PublishIcon, ShareIcon } from '@blocksuite/icons';
|
import { ExportIcon, PublishIcon, ShareIcon } from '@blocksuite/icons';
|
||||||
import type { Page } from '@blocksuite/store';
|
import type { Page } from '@blocksuite/store';
|
||||||
|
import { Button } from '@toeverything/components/button';
|
||||||
import { useBlockSuiteWorkspacePageIsPublic } from '@toeverything/hooks/use-block-suite-workspace-page-is-public';
|
import { useBlockSuiteWorkspacePageIsPublic } from '@toeverything/hooks/use-block-suite-workspace-page-is-public';
|
||||||
import { type ReactElement, useRef } from 'react';
|
import { type ReactElement, useRef } from 'react';
|
||||||
import { useCallback, useState } from 'react';
|
import { useCallback, useState } from 'react';
|
||||||
|
|
||||||
import { Button } from '../../ui/button';
|
|
||||||
import { Menu } from '../../ui/menu/menu';
|
import { Menu } from '../../ui/menu/menu';
|
||||||
import { Export } from './export';
|
import { Export } from './export';
|
||||||
import { containerStyle, indicatorContainerStyle, tabStyle } from './index.css';
|
import { containerStyle, indicatorContainerStyle, tabStyle } from './index.css';
|
||||||
|
@ -2,11 +2,12 @@ import type { LocalWorkspace } from '@affine/env/workspace';
|
|||||||
import { WorkspaceFlavour } from '@affine/env/workspace';
|
import { WorkspaceFlavour } from '@affine/env/workspace';
|
||||||
import { Trans } from '@affine/i18n';
|
import { Trans } from '@affine/i18n';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||||
|
import { Button } from '@toeverything/components/button';
|
||||||
import { useBlockSuiteWorkspacePageIsPublic } from '@toeverything/hooks/use-block-suite-workspace-page-is-public';
|
import { useBlockSuiteWorkspacePageIsPublic } from '@toeverything/hooks/use-block-suite-workspace-page-is-public';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { useCallback, useMemo } from 'react';
|
import { useCallback, useMemo } from 'react';
|
||||||
|
|
||||||
import { Button, toast } from '../..';
|
import { toast } from '../../ui/toast';
|
||||||
import { PublicLinkDisableModal } from './disable-public-link';
|
import { PublicLinkDisableModal } from './disable-public-link';
|
||||||
import {
|
import {
|
||||||
descriptionStyle,
|
descriptionStyle,
|
||||||
|
@ -4,8 +4,8 @@ import type {
|
|||||||
} from '@affine/env/workspace';
|
} from '@affine/env/workspace';
|
||||||
import { WorkspaceFlavour } from '@affine/env/workspace';
|
import { WorkspaceFlavour } from '@affine/env/workspace';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||||
|
import { Button } from '@toeverything/components/button';
|
||||||
|
|
||||||
import { Button } from '../../ui/button';
|
|
||||||
import { descriptionStyle, menuItemStyle } from './index.css';
|
import { descriptionStyle, menuItemStyle } from './index.css';
|
||||||
import type { ShareMenuProps } from './share-menu';
|
import type { ShareMenuProps } from './share-menu';
|
||||||
|
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
import { Button, displayFlex, styled } from '../..';
|
import { Button } from '@toeverything/components/button';
|
||||||
|
|
||||||
|
import { displayFlex, styled } from '../..';
|
||||||
|
|
||||||
export const TabItem = styled('li')<{ isActive?: boolean }>(({ isActive }) => {
|
export const TabItem = styled('li')<{ isActive?: boolean }>(({ isActive }) => {
|
||||||
{
|
{
|
||||||
@ -21,7 +23,7 @@ export const TabItem = styled('li')<{ isActive?: boolean }>(({ isActive }) => {
|
|||||||
background: 'var(--affine-hover-color)',
|
background: 'var(--affine-hover-color)',
|
||||||
opacity: 1,
|
opacity: 1,
|
||||||
color: isActive
|
color: isActive
|
||||||
? 'var(--affine-text-primary-color)'
|
? 'var(--affine-t/ext-primary-color)'
|
||||||
: 'var(--affine-text-secondary-color)',
|
: 'var(--affine-text-secondary-color)',
|
||||||
svg: {
|
svg: {
|
||||||
fill: isActive
|
fill: isActive
|
||||||
|
@ -1,134 +0,0 @@
|
|||||||
import clsx from 'clsx';
|
|
||||||
import {
|
|
||||||
forwardRef,
|
|
||||||
type HTMLAttributes,
|
|
||||||
type PropsWithChildren,
|
|
||||||
type ReactElement,
|
|
||||||
useMemo,
|
|
||||||
} from 'react';
|
|
||||||
|
|
||||||
import { Loading } from '../loading';
|
|
||||||
import { button, buttonIcon } from './style.css';
|
|
||||||
|
|
||||||
export type ButtonType =
|
|
||||||
| 'default'
|
|
||||||
| 'primary'
|
|
||||||
| 'plain'
|
|
||||||
| 'error'
|
|
||||||
| 'warning'
|
|
||||||
| 'success'
|
|
||||||
| 'processing';
|
|
||||||
|
|
||||||
export type ButtonSize = 'default' | 'large' | 'extraLarge';
|
|
||||||
|
|
||||||
export interface ButtonProps
|
|
||||||
extends Omit<HTMLAttributes<HTMLButtonElement>, 'type'> {
|
|
||||||
type?: ButtonType;
|
|
||||||
disabled?: boolean;
|
|
||||||
icon?: ReactElement;
|
|
||||||
iconPosition?: 'start' | 'end';
|
|
||||||
shape?: 'default' | 'round' | 'circle';
|
|
||||||
block?: boolean;
|
|
||||||
size?: ButtonSize;
|
|
||||||
loading?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
const defaultProps = {
|
|
||||||
type: 'default',
|
|
||||||
disabled: false,
|
|
||||||
shape: 'default',
|
|
||||||
size: 'default',
|
|
||||||
iconPosition: 'start',
|
|
||||||
loading: false,
|
|
||||||
};
|
|
||||||
|
|
||||||
const ButtonIcon = (props: PropsWithChildren<ButtonProps>) => {
|
|
||||||
const {
|
|
||||||
size,
|
|
||||||
icon,
|
|
||||||
iconPosition = 'start',
|
|
||||||
children,
|
|
||||||
type,
|
|
||||||
} = {
|
|
||||||
...defaultProps,
|
|
||||||
...props,
|
|
||||||
};
|
|
||||||
const onlyIcon = icon && !children;
|
|
||||||
return (
|
|
||||||
<div
|
|
||||||
className={clsx(buttonIcon, {
|
|
||||||
'color-white': type !== 'default' && type !== 'plain',
|
|
||||||
large: size === 'large',
|
|
||||||
extraLarge: size === 'extraLarge',
|
|
||||||
end: iconPosition === 'end' && !onlyIcon,
|
|
||||||
start: iconPosition === 'start' && !onlyIcon,
|
|
||||||
})}
|
|
||||||
>
|
|
||||||
{icon}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
|
|
||||||
(props, ref) => {
|
|
||||||
const {
|
|
||||||
children,
|
|
||||||
type,
|
|
||||||
disabled,
|
|
||||||
shape,
|
|
||||||
size,
|
|
||||||
icon: propsIcon,
|
|
||||||
iconPosition,
|
|
||||||
block,
|
|
||||||
loading,
|
|
||||||
className,
|
|
||||||
...otherProps
|
|
||||||
} = {
|
|
||||||
...defaultProps,
|
|
||||||
...props,
|
|
||||||
};
|
|
||||||
|
|
||||||
const icon = useMemo(() => {
|
|
||||||
if (loading) {
|
|
||||||
return <Loading />;
|
|
||||||
}
|
|
||||||
return propsIcon;
|
|
||||||
}, [propsIcon, loading]);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<button
|
|
||||||
ref={ref}
|
|
||||||
className={clsx(
|
|
||||||
button,
|
|
||||||
{
|
|
||||||
primary: type === 'primary',
|
|
||||||
plain: type === 'plain',
|
|
||||||
error: type === 'error',
|
|
||||||
warning: type === 'warning',
|
|
||||||
success: type === 'success',
|
|
||||||
processing: type === 'processing',
|
|
||||||
large: size === 'large',
|
|
||||||
extraLarge: size === 'extraLarge',
|
|
||||||
disabled,
|
|
||||||
circle: shape === 'circle',
|
|
||||||
round: shape === 'round',
|
|
||||||
block,
|
|
||||||
loading,
|
|
||||||
},
|
|
||||||
className
|
|
||||||
)}
|
|
||||||
disabled={disabled}
|
|
||||||
data-disabled={disabled}
|
|
||||||
{...otherProps}
|
|
||||||
>
|
|
||||||
{icon && iconPosition === 'start' ? (
|
|
||||||
<ButtonIcon {...props} icon={icon} />
|
|
||||||
) : null}
|
|
||||||
<span>{children}</span>
|
|
||||||
{icon && iconPosition === 'end' ? <ButtonIcon {...props} /> : null}
|
|
||||||
</button>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
Button.displayName = 'Button';
|
|
||||||
export default Button;
|
|
@ -1,83 +0,0 @@
|
|||||||
import clsx from 'clsx';
|
|
||||||
import type { HTMLAttributes, PropsWithChildren } from 'react';
|
|
||||||
import { forwardRef, type ReactElement } from 'react';
|
|
||||||
|
|
||||||
import { Loading } from '../loading';
|
|
||||||
import type { ButtonType } from './button';
|
|
||||||
import { iconButton } from './style.css';
|
|
||||||
|
|
||||||
export type IconButtonSize = 'default' | 'large' | 'small' | 'extraSmall';
|
|
||||||
export type IconButtonProps = PropsWithChildren &
|
|
||||||
Omit<HTMLAttributes<HTMLButtonElement>, 'type'> & {
|
|
||||||
type?: ButtonType;
|
|
||||||
disabled?: boolean;
|
|
||||||
size?: IconButtonSize;
|
|
||||||
loading?: boolean;
|
|
||||||
withoutPadding?: boolean;
|
|
||||||
active?: boolean;
|
|
||||||
icon?: ReactElement;
|
|
||||||
};
|
|
||||||
const defaultProps = {
|
|
||||||
type: 'plain',
|
|
||||||
disabled: false,
|
|
||||||
size: 'default',
|
|
||||||
loading: false,
|
|
||||||
withoutPadding: false,
|
|
||||||
active: false,
|
|
||||||
};
|
|
||||||
|
|
||||||
export const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(
|
|
||||||
(props, ref) => {
|
|
||||||
const {
|
|
||||||
type,
|
|
||||||
size,
|
|
||||||
withoutPadding,
|
|
||||||
children,
|
|
||||||
disabled,
|
|
||||||
loading,
|
|
||||||
active,
|
|
||||||
icon: propsIcon,
|
|
||||||
className,
|
|
||||||
...otherProps
|
|
||||||
} = {
|
|
||||||
...defaultProps,
|
|
||||||
...props,
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<button
|
|
||||||
ref={ref}
|
|
||||||
className={clsx(
|
|
||||||
iconButton,
|
|
||||||
{
|
|
||||||
'without-padding': withoutPadding,
|
|
||||||
|
|
||||||
primary: type === 'primary',
|
|
||||||
plain: type === 'plain',
|
|
||||||
error: type === 'error',
|
|
||||||
warning: type === 'warning',
|
|
||||||
success: type === 'success',
|
|
||||||
processing: type === 'processing',
|
|
||||||
|
|
||||||
large: size === 'large',
|
|
||||||
small: size === 'small',
|
|
||||||
'extra-small': size === 'extraSmall',
|
|
||||||
|
|
||||||
disabled,
|
|
||||||
loading,
|
|
||||||
active,
|
|
||||||
},
|
|
||||||
className
|
|
||||||
)}
|
|
||||||
disabled={disabled}
|
|
||||||
data-disabled={disabled}
|
|
||||||
{...otherProps}
|
|
||||||
>
|
|
||||||
{loading ? <Loading /> : children || propsIcon}
|
|
||||||
</button>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
IconButton.displayName = 'IconButton';
|
|
||||||
export default IconButton;
|
|
@ -1,4 +1,2 @@
|
|||||||
export * from './button';
|
|
||||||
export * from './dropdown';
|
export * from './dropdown';
|
||||||
export * from './icon-button';
|
|
||||||
export * from './radio';
|
export * from './radio';
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||||
|
import { Button } from '@toeverything/components/button';
|
||||||
|
|
||||||
import { Button } from '../button';
|
|
||||||
import type { ModalProps } from '../modal';
|
import type { ModalProps } from '../modal';
|
||||||
import { Modal, ModalCloseButton } from '../modal';
|
import { Modal, ModalCloseButton } from '../modal';
|
||||||
import {
|
import {
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
import { ArrowDownSmallIcon } from '@blocksuite/icons';
|
import { ArrowDownSmallIcon } from '@blocksuite/icons';
|
||||||
|
import { Button, type ButtonProps } from '@toeverything/components/button';
|
||||||
import { forwardRef } from 'react';
|
import { forwardRef } from 'react';
|
||||||
|
|
||||||
import { Button, type ButtonProps } from '../button';
|
|
||||||
|
|
||||||
export const MenuTrigger = forwardRef<HTMLButtonElement, ButtonProps>(
|
export const MenuTrigger = forwardRef<HTMLButtonElement, ButtonProps>(
|
||||||
({ children, ...props }, ref) => {
|
({ children, ...props }, ref) => {
|
||||||
return (
|
return (
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import type { CSSProperties } from 'react';
|
import type { CSSProperties } from 'react';
|
||||||
|
|
||||||
import { displayFlex, styled, textEllipsis } from '../../styles';
|
import { displayFlex, styled, textEllipsis } from '../../styles';
|
||||||
import { Button } from '../button';
|
|
||||||
import StyledPopperContainer from '../shared/container';
|
import StyledPopperContainer from '../shared/container';
|
||||||
|
|
||||||
export const StyledMenuWrapper = styled(StyledPopperContainer, {
|
export const StyledMenuWrapper = styled(StyledPopperContainer, {
|
||||||
@ -99,15 +98,3 @@ export const StyledMenuItem = styled('button')<{
|
|||||||
: {}),
|
: {}),
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
export const StyledButton = styled(Button)(() => {
|
|
||||||
return {
|
|
||||||
width: '100%',
|
|
||||||
// height: '32px',
|
|
||||||
borderRadius: '8px',
|
|
||||||
backgroundColor: 'transparent',
|
|
||||||
...displayFlex('space-between', 'center'),
|
|
||||||
border: `1px solid var(--affine-border-color)`,
|
|
||||||
padding: '0 10px',
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
import { CloseIcon } from '@blocksuite/icons';
|
import { CloseIcon } from '@blocksuite/icons';
|
||||||
|
import {
|
||||||
|
IconButton,
|
||||||
|
type IconButtonProps,
|
||||||
|
} from '@toeverything/components/button';
|
||||||
import type { HTMLAttributes } from 'react';
|
import type { HTMLAttributes } from 'react';
|
||||||
|
|
||||||
import type { IconButtonProps } from '../button/icon-button';
|
|
||||||
import { IconButton } from '../button/icon-button';
|
|
||||||
export type ModalCloseButtonProps = {
|
export type ModalCloseButtonProps = {
|
||||||
top?: number;
|
top?: number;
|
||||||
right?: number;
|
right?: number;
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@affine/component": "workspace:*",
|
"@affine/component": "workspace:*",
|
||||||
"@affine/sdk": "workspace:*",
|
"@affine/sdk": "workspace:*",
|
||||||
|
"@toeverything/components": "^0.0.8",
|
||||||
"idb": "^7.1.1",
|
"idb": "^7.1.1",
|
||||||
"langchain": "^0.0.118",
|
"langchain": "^0.0.118",
|
||||||
"marked": "^5.1.1",
|
"marked": "^5.1.1",
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { Button, FlexWrapper, Input } from '@affine/component';
|
import { FlexWrapper, Input } from '@affine/component';
|
||||||
|
import { Button } from '@toeverything/components/button';
|
||||||
import { useAtom } from 'jotai';
|
import { useAtom } from 'jotai';
|
||||||
import { type ReactElement, useCallback } from 'react';
|
import { type ReactElement, useCallback } from 'react';
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { IconButton } from '@affine/component';
|
|
||||||
import { SendIcon } from '@blocksuite/icons';
|
import { SendIcon } from '@blocksuite/icons';
|
||||||
|
import { IconButton } from '@toeverything/components/button';
|
||||||
import { useAtomValue, useSetAtom } from 'jotai';
|
import { useAtomValue, useSetAtom } from 'jotai';
|
||||||
import type { ReactElement } from 'react';
|
import type { ReactElement } from 'react';
|
||||||
import { Suspense, useCallback, useState } from 'react';
|
import { Suspense, useCallback, useState } from 'react';
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { IconButton, Tooltip } from '@affine/component';
|
import { Tooltip } from '@affine/component';
|
||||||
import { deleteLayoutAtom, pushLayoutAtom } from '@affine/sdk/entry';
|
import { deleteLayoutAtom, pushLayoutAtom } from '@affine/sdk/entry';
|
||||||
import { AiIcon } from '@blocksuite/icons';
|
import { AiIcon } from '@blocksuite/icons';
|
||||||
|
import { IconButton } from '@toeverything/components/button';
|
||||||
import { useSetAtom } from 'jotai';
|
import { useSetAtom } from 'jotai';
|
||||||
import type { ComponentType, PropsWithChildren, ReactElement } from 'react';
|
import type { ComponentType, PropsWithChildren, ReactElement } from 'react';
|
||||||
import { useCallback, useState } from 'react';
|
import { useCallback, useState } from 'react';
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { Button } from '@affine/component';
|
|
||||||
import { PlusIcon, ResetIcon } from '@blocksuite/icons';
|
import { PlusIcon, ResetIcon } from '@blocksuite/icons';
|
||||||
|
import { Button } from '@toeverything/components/button';
|
||||||
import { clsx } from 'clsx';
|
import { clsx } from 'clsx';
|
||||||
import type { MessageType } from 'langchain/schema';
|
import type { MessageType } from 'langchain/schema';
|
||||||
import { marked } from 'marked';
|
import { marked } from 'marked';
|
||||||
|
@ -17,7 +17,8 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@affine/component": "workspace:*",
|
"@affine/component": "workspace:*",
|
||||||
"@affine/sdk": "workspace:*",
|
"@affine/sdk": "workspace:*",
|
||||||
"@blocksuite/icons": "^2.1.29"
|
"@blocksuite/icons": "^2.1.29",
|
||||||
|
"@toeverything/components": "^0.0.8"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@affine/plugin-cli": "workspace:*"
|
"@affine/plugin-cli": "workspace:*"
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { IconButton, Tooltip } from '@affine/component';
|
import { Tooltip } from '@affine/component';
|
||||||
import { Logo1Icon } from '@blocksuite/icons';
|
import { Logo1Icon } from '@blocksuite/icons';
|
||||||
|
import { IconButton } from '@toeverything/components/button';
|
||||||
import { useCallback } from 'react';
|
import { useCallback } from 'react';
|
||||||
|
|
||||||
export const HeaderItem = () => {
|
export const HeaderItem = () => {
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
"@affine/component": "workspace:*",
|
"@affine/component": "workspace:*",
|
||||||
"@affine/sdk": "workspace:*",
|
"@affine/sdk": "workspace:*",
|
||||||
"@blocksuite/icons": "^2.1.29",
|
"@blocksuite/icons": "^2.1.29",
|
||||||
|
"@toeverything/components": "^0.0.8",
|
||||||
"@toeverything/theme": "^0.7.9",
|
"@toeverything/theme": "^0.7.9",
|
||||||
"clsx": "^2.0.0",
|
"clsx": "^2.0.0",
|
||||||
"foxact": "^0.2.17",
|
"foxact": "^0.2.17",
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Button, IconButton, Tooltip } from '@affine/component';
|
import { Tooltip } from '@affine/component';
|
||||||
import type { ImageBlockModel } from '@blocksuite/blocks';
|
import type { ImageBlockModel } from '@blocksuite/blocks';
|
||||||
import { assertExists } from '@blocksuite/global/utils';
|
import { assertExists } from '@blocksuite/global/utils';
|
||||||
import {
|
import {
|
||||||
@ -12,6 +12,7 @@ import {
|
|||||||
ViewBarIcon,
|
ViewBarIcon,
|
||||||
} from '@blocksuite/icons';
|
} from '@blocksuite/icons';
|
||||||
import type { Workspace } from '@blocksuite/store';
|
import type { Workspace } from '@blocksuite/store';
|
||||||
|
import { Button, IconButton } from '@toeverything/components/button';
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
import { useErrorBoundary } from 'foxact/use-error-boundary';
|
import { useErrorBoundary } from 'foxact/use-error-boundary';
|
||||||
import { useAtom } from 'jotai';
|
import { useAtom } from 'jotai';
|
||||||
|
13
yarn.lock
13
yarn.lock
@ -186,6 +186,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.8
|
||||||
"@types/marked": ^5.0.1
|
"@types/marked": ^5.0.1
|
||||||
idb: ^7.1.1
|
idb: ^7.1.1
|
||||||
jotai: ^2.2.2
|
jotai: ^2.2.2
|
||||||
@ -235,7 +236,7 @@ __metadata:
|
|||||||
"@sentry/webpack-plugin": ^2.5.0
|
"@sentry/webpack-plugin": ^2.5.0
|
||||||
"@svgr/webpack": ^8.0.1
|
"@svgr/webpack": ^8.0.1
|
||||||
"@swc/core": ^1.3.74
|
"@swc/core": ^1.3.74
|
||||||
"@toeverything/components": ^0.0.6
|
"@toeverything/components": ^0.0.8
|
||||||
"@types/webpack-env": ^1.18.1
|
"@types/webpack-env": ^1.18.1
|
||||||
async-call-rpc: ^6.3.1
|
async-call-rpc: ^6.3.1
|
||||||
cmdk: ^0.2.0
|
cmdk: ^0.2.0
|
||||||
@ -403,6 +404,7 @@ __metadata:
|
|||||||
"@affine/plugin-cli": "workspace:*"
|
"@affine/plugin-cli": "workspace:*"
|
||||||
"@affine/sdk": "workspace:*"
|
"@affine/sdk": "workspace:*"
|
||||||
"@blocksuite/icons": ^2.1.29
|
"@blocksuite/icons": ^2.1.29
|
||||||
|
"@toeverything/components": ^0.0.8
|
||||||
languageName: unknown
|
languageName: unknown
|
||||||
linkType: soft
|
linkType: soft
|
||||||
|
|
||||||
@ -428,6 +430,7 @@ __metadata:
|
|||||||
"@affine/plugin-cli": "workspace:*"
|
"@affine/plugin-cli": "workspace:*"
|
||||||
"@affine/sdk": "workspace:*"
|
"@affine/sdk": "workspace:*"
|
||||||
"@blocksuite/icons": ^2.1.29
|
"@blocksuite/icons": ^2.1.29
|
||||||
|
"@toeverything/components": ^0.0.8
|
||||||
"@toeverything/theme": ^0.7.9
|
"@toeverything/theme": ^0.7.9
|
||||||
clsx: ^2.0.0
|
clsx: ^2.0.0
|
||||||
foxact: ^0.2.17
|
foxact: ^0.2.17
|
||||||
@ -11246,9 +11249,9 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@toeverything/components@npm:^0.0.6":
|
"@toeverything/components@npm:^0.0.8":
|
||||||
version: 0.0.6
|
version: 0.0.8
|
||||||
resolution: "@toeverything/components@npm:0.0.6"
|
resolution: "@toeverything/components@npm:0.0.8"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@blocksuite/icons": ^2.1.26
|
"@blocksuite/icons": ^2.1.26
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
@ -11256,7 +11259,7 @@ __metadata:
|
|||||||
clsx: ^2
|
clsx: ^2
|
||||||
react: ^18
|
react: ^18
|
||||||
react-dom: ^18
|
react-dom: ^18
|
||||||
checksum: 838bcbecda4eea29c949aa241c99f5512b7d248163156979af93cc70aff396f5ea1087c5e0ea7bee09a964e2960cd9977b065a306bf61cc04894560af6bc166a
|
checksum: 9c955d3c46729397e92031cc6a5ba0f15eb8a67893862b4c6c017c87fff2ab8e9ee8505695b0da571f2af35ad6545f643fc34f657f1c9d1913648796971540d9
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user