feat: modify styles
This commit is contained in:
@@ -19,59 +19,59 @@ import { useEditor } from '@/components/editor-provider';
|
|||||||
|
|
||||||
const toolbarList1 = [
|
const toolbarList1 = [
|
||||||
{
|
{
|
||||||
|
flavor: 'select',
|
||||||
icon: <SelectIcon />,
|
icon: <SelectIcon />,
|
||||||
toolTip: 'Select',
|
toolTip: 'Select',
|
||||||
onClick: () => {},
|
|
||||||
disable: false,
|
disable: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
flavor: 'text',
|
||||||
icon: <TextIcon />,
|
icon: <TextIcon />,
|
||||||
toolTip: 'Text(coming soon)',
|
toolTip: 'Text(coming soon)',
|
||||||
onClick: () => {},
|
|
||||||
disable: true,
|
disable: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
flavor: 'shape',
|
||||||
icon: <ShapeIcon />,
|
icon: <ShapeIcon />,
|
||||||
toolTip: 'Shape(coming soon)',
|
toolTip: 'Shape(coming soon)',
|
||||||
onClick: () => {},
|
|
||||||
disable: true,
|
disable: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
flavor: 'sticky',
|
||||||
icon: <StickerIcon />,
|
icon: <StickerIcon />,
|
||||||
toolTip: 'Sticker(coming soon)',
|
toolTip: 'Sticky(coming soon)',
|
||||||
onClick: () => {},
|
|
||||||
disable: true,
|
disable: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
flavor: 'pen',
|
||||||
icon: <PenIcon />,
|
icon: <PenIcon />,
|
||||||
toolTip: 'Pen(coming soon)',
|
toolTip: 'Pen(coming soon)',
|
||||||
onClick: () => {},
|
|
||||||
disable: true,
|
disable: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
|
flavor: 'connector',
|
||||||
icon: <ConnectorIcon />,
|
icon: <ConnectorIcon />,
|
||||||
toolTip: 'Connector(coming soon)',
|
toolTip: 'Connector(coming soon)',
|
||||||
onClick: () => {},
|
|
||||||
disable: true,
|
disable: true,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
const toolbarList2 = [
|
const toolbarList2 = [
|
||||||
{
|
{
|
||||||
|
flavor: 'undo',
|
||||||
icon: <UndoIcon />,
|
icon: <UndoIcon />,
|
||||||
toolTip: 'Undo(coming soon)',
|
toolTip: 'Undo',
|
||||||
onClick: () => {},
|
disable: false,
|
||||||
disable: true,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
flavor: 'redo',
|
||||||
icon: <RedoIcon />,
|
icon: <RedoIcon />,
|
||||||
toolTip: 'Redo(coming soon)',
|
toolTip: 'Redo',
|
||||||
onClick: () => {},
|
disable: false,
|
||||||
disable: true,
|
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
export const EdgelessToolbar = () => {
|
export const EdgelessToolbar = () => {
|
||||||
const { mode } = useEditor();
|
const { mode, editor } = useEditor();
|
||||||
return (
|
return (
|
||||||
<Slide
|
<Slide
|
||||||
direction="right"
|
direction="right"
|
||||||
@@ -81,10 +81,15 @@ export const EdgelessToolbar = () => {
|
|||||||
>
|
>
|
||||||
<StyledEdgelessToolbar>
|
<StyledEdgelessToolbar>
|
||||||
<StyledToolbarWrapper>
|
<StyledToolbarWrapper>
|
||||||
{toolbarList1.map(({ icon, toolTip, onClick, disable }, index) => {
|
{toolbarList1.map(({ icon, toolTip, flavor, disable }, index) => {
|
||||||
return (
|
return (
|
||||||
<Tooltip key={index} content={toolTip} placement="right-start">
|
<Tooltip key={index} content={toolTip} placement="right-start">
|
||||||
<StyledToolbarItem disable={disable} onClick={onClick}>
|
<StyledToolbarItem
|
||||||
|
disable={disable}
|
||||||
|
onClick={() => {
|
||||||
|
console.log('flavor', flavor);
|
||||||
|
}}
|
||||||
|
>
|
||||||
{icon}
|
{icon}
|
||||||
</StyledToolbarItem>
|
</StyledToolbarItem>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
@@ -92,10 +97,22 @@ export const EdgelessToolbar = () => {
|
|||||||
})}
|
})}
|
||||||
</StyledToolbarWrapper>
|
</StyledToolbarWrapper>
|
||||||
<StyledToolbarWrapper>
|
<StyledToolbarWrapper>
|
||||||
{toolbarList2.map(({ icon, toolTip, onClick, disable }, index) => {
|
{toolbarList2.map(({ icon, toolTip, flavor, disable }, index) => {
|
||||||
return (
|
return (
|
||||||
<Tooltip key={index} content={toolTip} placement="right-start">
|
<Tooltip key={index} content={toolTip} placement="right-start">
|
||||||
<StyledToolbarItem disable={disable} onClick={onClick}>
|
<StyledToolbarItem
|
||||||
|
disable={disable}
|
||||||
|
onClick={() => {
|
||||||
|
switch (flavor) {
|
||||||
|
case 'undo':
|
||||||
|
editor?.store?.undo();
|
||||||
|
break;
|
||||||
|
case 'redo':
|
||||||
|
editor?.store?.redo();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
{icon}
|
{icon}
|
||||||
</StyledToolbarItem>
|
</StyledToolbarItem>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { displayFlex, keyframes, styled } from '@/styles';
|
|||||||
import spring, { toString } from 'css-spring';
|
import spring, { toString } from 'css-spring';
|
||||||
import type { ItemStatus } from './type';
|
import type { ItemStatus } from './type';
|
||||||
|
|
||||||
const ANIMATE_DURATION = 400;
|
const ANIMATE_DURATION = 500;
|
||||||
|
|
||||||
export const StyledAnimateRadioContainer = styled('div')<{ shrink: boolean }>(
|
export const StyledAnimateRadioContainer = styled('div')<{ shrink: boolean }>(
|
||||||
({ shrink, theme }) => {
|
({ shrink, theme }) => {
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ type EditorContextValue = {
|
|||||||
setEditor: (editor: EditorContainer) => void;
|
setEditor: (editor: EditorContainer) => void;
|
||||||
setMode: (mode: EditorContainer['mode']) => void;
|
setMode: (mode: EditorContainer['mode']) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
type EditorContextProps = PropsWithChildren<{}>;
|
type EditorContextProps = PropsWithChildren<{}>;
|
||||||
|
|
||||||
export const EditorContext = createContext<EditorContextValue>({
|
export const EditorContext = createContext<EditorContextValue>({
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { styled } from '@/styles';
|
import { styled } from '@/styles';
|
||||||
|
|
||||||
|
// Inspired by https://codepen.io/graphilla/pen/rNvBMYY
|
||||||
const loadingItemSize = '40px';
|
const loadingItemSize = '40px';
|
||||||
export const StyledLoading = styled.div`
|
export const StyledLoading = styled.div`
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ export const lightTheme: AffineTheme = {
|
|||||||
codeBackground: '#f2f5f9',
|
codeBackground: '#f2f5f9',
|
||||||
|
|
||||||
textColor: '#3A4C5C',
|
textColor: '#3A4C5C',
|
||||||
|
edgelessTextColor: '#3A4C5C',
|
||||||
iconColor: '#9096A5',
|
iconColor: '#9096A5',
|
||||||
linkColor: '#6880FF',
|
linkColor: '#6880FF',
|
||||||
linkColor2: '#6880FF',
|
linkColor2: '#6880FF',
|
||||||
@@ -59,6 +60,7 @@ export const darkTheme: AffineTheme = {
|
|||||||
codeBackground: '#505662',
|
codeBackground: '#505662',
|
||||||
|
|
||||||
textColor: '#fff',
|
textColor: '#fff',
|
||||||
|
edgelessTextColor: '#3A4C5C',
|
||||||
iconColor: '#9096A5',
|
iconColor: '#9096A5',
|
||||||
linkColor: '#7D91FF',
|
linkColor: '#7D91FF',
|
||||||
linkColor2: '#6880FF',
|
linkColor2: '#6880FF',
|
||||||
@@ -91,6 +93,7 @@ export const globalThemeVariables: (
|
|||||||
'--affine-code-background': theme.colors.codeBackground,
|
'--affine-code-background': theme.colors.codeBackground,
|
||||||
|
|
||||||
'--affine-text-color': theme.colors.textColor,
|
'--affine-text-color': theme.colors.textColor,
|
||||||
|
'--affine-edgeless-text-color': theme.colors.edgelessTextColor,
|
||||||
'--affine-link-color': theme.colors.linkColor,
|
'--affine-link-color': theme.colors.linkColor,
|
||||||
// In dark mode, normal text`s (not bold) color
|
// In dark mode, normal text`s (not bold) color
|
||||||
'--affine-link-color2': theme.colors.linkColor2,
|
'--affine-link-color2': theme.colors.linkColor2,
|
||||||
|
|||||||
@@ -20,7 +20,10 @@ export interface AffineTheme {
|
|||||||
hoverBackground: string;
|
hoverBackground: string;
|
||||||
codeBackground: string;
|
codeBackground: string;
|
||||||
|
|
||||||
|
// Use for the page`s text
|
||||||
textColor: string;
|
textColor: string;
|
||||||
|
// Use for the editor`s text, because in edgeless mode text is different form other
|
||||||
|
edgelessTextColor: string;
|
||||||
linkColor: string;
|
linkColor: string;
|
||||||
// In dark mode, normal text`s (not bold) color
|
// In dark mode, normal text`s (not bold) color
|
||||||
linkColor2: string;
|
linkColor2: string;
|
||||||
@@ -64,6 +67,7 @@ export interface AffineThemeCSSVariables {
|
|||||||
'--affine-code-background': AffineTheme['colors']['codeBackground'];
|
'--affine-code-background': AffineTheme['colors']['codeBackground'];
|
||||||
|
|
||||||
'--affine-text-color': AffineTheme['colors']['textColor'];
|
'--affine-text-color': AffineTheme['colors']['textColor'];
|
||||||
|
'--affine-edgeless-text-color': AffineTheme['colors']['edgelessTextColor'];
|
||||||
'--affine-link-color': AffineTheme['colors']['linkColor'];
|
'--affine-link-color': AffineTheme['colors']['linkColor'];
|
||||||
// In dark mode, normal text`s (not bold) color
|
// In dark mode, normal text`s (not bold) color
|
||||||
'--affine-link-color2': AffineTheme['colors']['linkColor2'];
|
'--affine-link-color2': AffineTheme['colors']['linkColor2'];
|
||||||
|
|||||||
Reference in New Issue
Block a user