Merge pull request #91 from toeverything/fix/lighter-box-shadow

fix: lighter box shadow
This commit is contained in:
Qi 2022-08-04 18:15:16 +08:00 committed by GitHub
commit 4b81cdbf27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 81 additions and 80 deletions

View File

@ -193,7 +193,7 @@ const LigoLeftContainer = styled('div')({
position: 'relative', position: 'relative',
}); });
const WorkspaceSidebar = styled('div')(({ hidden }) => ({ const WorkspaceSidebar = styled('div')(({ theme }) => ({
position: 'absolute', position: 'absolute',
bottom: '48px', bottom: '48px',
top: '12px', top: '12px',
@ -203,7 +203,7 @@ const WorkspaceSidebar = styled('div')(({ hidden }) => ({
width: 300, width: 300,
minWidth: 300, minWidth: 300,
borderRadius: '0px 10px 10px 0px', borderRadius: '0px 10px 10px 0px',
boxShadow: '0px 1px 10px rgba(152, 172, 189, 0.6)', boxShadow: theme.affine.shadows.shadow1,
backgroundColor: '#FFFFFF', backgroundColor: '#FFFFFF',
transitionProperty: 'left', transitionProperty: 'left',
transitionDuration: '0.35s', transitionDuration: '0.35s',

View File

@ -121,11 +121,11 @@ const isLinkActive = (editor: ReactEditor) => {
const LinkStyledTooltip = styled(({ className, ...props }: MuiTooltipProps) => ( const LinkStyledTooltip = styled(({ className, ...props }: MuiTooltipProps) => (
<Tooltip {...props} classes={{ popper: className }} /> <Tooltip {...props} classes={{ popper: className }} />
))(() => ({ ))(({ theme }) => ({
[`& .${muiTooltipClasses.tooltip}`]: { [`& .${muiTooltipClasses.tooltip}`]: {
backgroundColor: '#fff', backgroundColor: '#fff',
color: '#4C6275', color: '#4C6275',
boxShadow: '0px 1px 10px rgba(152, 172, 189, 0.6)', boxShadow: theme.affine.shadows.shadow1,
fontSize: '14px', fontSize: '14px',
}, },
[`& .MuiTooltip-tooltipPlacementBottom`]: { [`& .MuiTooltip-tooltipPlacementBottom`]: {
@ -412,8 +412,7 @@ export const LinkModal = memo((props: LinkModalProps) => {
visible && ( visible && (
<> <>
<LinkBehavior onMousedown={handle_mouse_down} rects={rects} /> <LinkBehavior onMousedown={handle_mouse_down} rects={rects} />
<div <LinkModalContainer
className={styles('linkModalContainer')}
style={{ style={{
top: top + height + GAP_BETWEEN_CONTENT_AND_MODAL, top: top + height + GAP_BETWEEN_CONTENT_AND_MODAL,
left, left,
@ -431,7 +430,7 @@ export const LinkModal = memo((props: LinkModalProps) => {
autoComplete="off" autoComplete="off"
ref={inputEl} ref={inputEl}
/> />
</div> </LinkModalContainer>
</> </>
), ),
body body
@ -491,19 +490,20 @@ const LinkBehavior = (props: {
); );
}; };
const LinkModalContainer = styled('div')(({ theme }) => ({
position: 'fixed',
width: '354px',
height: '40px',
padding: '12px',
display: 'flex',
borderRadius: '4px',
boxShadow: theme.affine.shadows.shadow1,
backgroundColor: '#fff',
alignItems: 'center',
zIndex: '1',
}));
const styles = style9.create({ const styles = style9.create({
linkModalContainer: {
position: 'fixed',
width: '354px',
height: '40px',
padding: '12px',
display: 'flex',
borderRadius: '4px',
boxShadow: '0px 1px 10px rgba(152, 172, 189, 0.6)',
backgroundColor: '#fff',
alignItems: 'center',
zIndex: '1',
},
linkModalContainerIcon: { linkModalContainerIcon: {
width: '16px', width: '16px',
margin: '0 16px 0 4px', margin: '0 16px 0 4px',

View File

@ -69,7 +69,7 @@ const GroupContainer = styled('div')<{ isSelect?: boolean }>(
} }
: { : {
'&:hover': { '&:hover': {
boxShadow: '0px 1px 10px rgb(152 172 189 / 60%)', boxShadow: theme.affine.shadows.shadow1,
}, },
}), }),
}) })

View File

@ -2,11 +2,11 @@ import { styled } from '@toeverything/components/ui';
import type { ComponentPropsWithRef, MouseEvent } from 'react'; import type { ComponentPropsWithRef, MouseEvent } from 'react';
import { forwardRef } from 'react'; import { forwardRef } from 'react';
const StyledPanel = styled('div')(() => ({ const StyledPanel = styled('div')(({ theme }) => ({
position: 'absolute', position: 'absolute',
top: 50, top: 50,
background: '#FFFFFF', background: '#FFFFFF',
boxShadow: '0px 1px 10px rgba(152, 172, 189, 0.6)', boxShadow: theme.affine.shadows.shadow1,
borderRadius: 10, borderRadius: 10,
padding: '12px 24px', padding: '12px 24px',
})); }));

View File

@ -64,7 +64,7 @@ const StyledContainerForAddCommentContainer = styled('div')(({ theme }) => {
zIndex: 1, zIndex: 1,
display: 'flex', display: 'flex',
borderRadius: theme.affine.shape.borderRadius, borderRadius: theme.affine.shape.borderRadius,
boxShadow: theme.affine.shadows.shadowSxDownLg, boxShadow: theme.affine.shadows.shadow1,
backgroundColor: theme.affine.palette.white, backgroundColor: theme.affine.palette.white,
}; };
}); });

View File

@ -31,7 +31,7 @@ const RootContainer = styled('div')(({ theme }) => {
width: 352, width: 352,
maxHeight: 525, maxHeight: 525,
borderRadius: '10px', borderRadius: '10px',
boxShadow: '0px 1px 10px rgba(152, 172, 189, 0.6)', boxShadow: theme.affine.shadows.shadow1,
backgroundColor: '#fff', backgroundColor: '#fff',
padding: '8px 4px', padding: '8px 4px',
}; };

View File

@ -75,13 +75,13 @@ export const InlineMenuContainer = ({ editor }: InlineMenuContainerProps) => {
) : null; ) : null;
}; };
const ToolbarContainer = styled('div')({ const ToolbarContainer = styled('div')(({ theme }) => ({
position: 'absolute', position: 'absolute',
zIndex: 1, zIndex: 1,
display: 'flex', display: 'flex',
alignItems: 'center', alignItems: 'center',
padding: '0 12px', padding: '0 12px',
borderRadius: '10px', borderRadius: '10px',
boxShadow: '0px 1px 10px rgba(152, 172, 189, 0.6)', boxShadow: theme.affine.shadows.shadow1,
backgroundColor: '#fff', backgroundColor: '#fff',
}); }));

View File

@ -8,6 +8,7 @@ import {
commonListContainer, commonListContainer,
} from '@toeverything/components/common'; } from '@toeverything/components/common';
import { domToRect } from '@toeverything/utils'; import { domToRect } from '@toeverything/utils';
import { styled } from '@toeverything/components/ui';
import { QueryResult } from '../../search'; import { QueryResult } from '../../search';
@ -152,13 +153,12 @@ export const ReferenceMenuContainer = ({
}, [hooks, handle_key_down]); }, [hooks, handle_key_down]);
return isShow ? ( return isShow ? (
<div <RootContainer
ref={menu_ref} ref={menu_ref}
className={styles('rootContainer')}
onKeyDownCapture={handle_key_down} onKeyDownCapture={handle_key_down}
style={style} style={style}
> >
<div className={styles('contentContainer')}> <ContentContainer>
<CommonList <CommonList
items={ items={
searchBlocks?.map( searchBlocks?.map(
@ -169,24 +169,23 @@ export const ReferenceMenuContainer = ({
currentItem={current_item} currentItem={current_item}
setCurrentItem={set_current_item} setCurrentItem={set_current_item}
/> />
</div> </ContentContainer>
</div> </RootContainer>
) : null; ) : null;
}; };
const styles = style9.create({ const RootContainer = styled('div')(({ theme }) => ({
rootContainer: { position: 'fixed',
position: 'fixed', zIndex: 1,
zIndex: 1, maxHeight: '525px',
maxHeight: 525, borderRadius: '10px',
borderRadius: '10px', boxShadow: theme.affine.shadows.shadow1,
boxShadow: '0px 1px 10px rgba(152, 172, 189, 0.6)', backgroundColor: '#fff',
backgroundColor: '#fff', padding: '8px 4px',
padding: '8px 4px', }));
},
contentContainer: { const ContentContainer = styled('div')(({ theme }) => ({
display: 'flex', display: 'flex',
overflow: 'hidden', overflow: 'hidden',
maxHeight: 493, maxHeight: '493px',
}, }));
});

View File

@ -7,6 +7,7 @@ import {
TransitionsModal, TransitionsModal,
MuiBox as Box, MuiBox as Box,
MuiBox, MuiBox,
styled,
} from '@toeverything/components/ui'; } from '@toeverything/components/ui';
import { Virgo, BlockEditor } from '@toeverything/framework/virgo'; import { Virgo, BlockEditor } from '@toeverything/framework/virgo';
import { throttle } from '@toeverything/utils'; import { throttle } from '@toeverything/utils';
@ -21,26 +22,6 @@ const styles = style9.create({
display: 'flex', display: 'flex',
flexDirection: 'column', flexDirection: 'column',
}, },
search: {
margin: '0.5em',
backgroundColor: 'white',
boxShadow: '0px 1px 10px rgb(152 172 189 / 60%)',
padding: '16px 32px',
borderRadius: '10px',
},
result: {
margin: '0.5em',
backgroundColor: 'white',
boxShadow: '0px 1px 10px rgb(152 172 189 / 60%)',
padding: '16px 32px',
borderRadius: '10px',
transitionProperty: 'max-height',
transitionDuration: '300ms',
transitionTimingFunction: 'cubic-bezier(0.4, 0, 0.2, 1)',
transitionDelay: '0ms',
overflowX: 'hidden',
overflowY: 'hidden',
},
resultItem: { resultItem: {
width: '100%', width: '100%',
}, },
@ -96,15 +77,14 @@ export const Search = (props: SearchProps) => {
}} }}
> >
<Box className={styles('wrapper')}> <Box className={styles('wrapper')}>
<input <SearchInput
className={styles('search')}
autoFocus autoFocus
value={search} value={search}
onChange={e => set_search(e.target.value)} onChange={e => set_search(e.target.value)}
/> />
<MuiBox <ResultContainer
sx={{ maxHeight: `${result.length * 28 + 32 + 20}px` }} sx={{ maxHeight: `${result.length * 28 + 32 + 20}px` }}
className={styles('result', { className={styles({
resultHide: !result.length, resultHide: !result.length,
})} })}
> >
@ -119,8 +99,30 @@ export const Search = (props: SearchProps) => {
}} }}
/> />
))} ))}
</MuiBox> </ResultContainer>
</Box> </Box>
</TransitionsModal> </TransitionsModal>
); );
}; };
const SearchInput = styled('input')(({ theme }) => ({
margin: '0.5em',
backgroundColor: 'white',
boxShadow: theme.affine.shadows.shadow1,
padding: '16px 32px',
borderRadius: '10px',
}));
const ResultContainer = styled(MuiBox)(({ theme }) => ({
margin: '0.5em',
backgroundColor: 'white',
boxShadow: theme.affine.shadows.shadow1,
padding: '16px 32px',
borderRadius: '10px',
transitionProperty: 'max-height',
transitionDuration: '300ms',
transitionTimingFunction: 'cubic-bezier(0.4, 0, 0.2, 1)',
transitionDelay: '0ms',
overflowX: 'hidden',
overflowY: 'hidden',
}));

View File

@ -20,7 +20,7 @@ const IconWrapper = styled('div')<Pick<StatusIconProps, 'mode'>>(
width: '20px', width: '20px',
height: '20px', height: '20px',
borderRadius: '5px', borderRadius: '5px',
boxShadow: '0px 1px 10px rgba(152, 172, 189, 0.6)', boxShadow: theme.affine.shadows.shadow1,
color: theme.affine.palette.primary, color: theme.affine.palette.primary,
cursor: 'pointer', cursor: 'pointer',
backgroundColor: theme.affine.palette.white, backgroundColor: theme.affine.palette.white,

View File

@ -94,7 +94,7 @@ const StyledContainerForCommentItem = styled('div', {
transition: 'left 150ms ease-in-out', transition: 'left 150ms ease-in-out',
backgroundColor: theme.affine.palette.white, backgroundColor: theme.affine.palette.white,
'&:hover': { '&:hover': {
boxShadow: theme.affine.shadows.shadowSxDownLg, boxShadow: theme.affine.shadows.shadow1,
}, },
}; };
}); });

View File

@ -133,7 +133,7 @@ export function Cascader(props: CascaderProps) {
const MenuPaper = styled('div')(({ theme }) => ({ const MenuPaper = styled('div')(({ theme }) => ({
fontFamily: 'PingFang SC', fontFamily: 'PingFang SC',
background: '#FFF', background: '#FFF',
boxShadow: '0px 1px 10px rgba(152, 172, 189, 0.6)', boxShadow: theme.affine.shadows.shadow1,
borderRadius: '10px 0px 10px 10px', borderRadius: '10px 0px 10px 10px',
color: '#4C6275', color: '#4C6275',
fontWeight: '400', fontWeight: '400',

View File

@ -12,7 +12,7 @@ const border_radius_map: Record<PopoverContainerProps['direction'], string> = {
export const PopoverContainer = styled('div')< export const PopoverContainer = styled('div')<
Pick<PopoverContainerProps, 'direction'> Pick<PopoverContainerProps, 'direction'>
>(({ theme, direction, style }) => { >(({ theme, direction, style }) => {
const shadow = theme.affine.shadows.shadowSxDownLg; const shadow = theme.affine.shadows.shadow1;
const white = theme.affine.palette.white; const white = theme.affine.palette.white;
const borderRadius = const borderRadius =

View File

@ -117,7 +117,7 @@ const StyledListbox = styled('ul')(({ theme }) => ({
background: '#fff', background: '#fff',
borderRadius: '10px', borderRadius: '10px',
overflow: 'auto', overflow: 'auto',
boxShadow: theme.affine.shadows.shadowSxDownLg, boxShadow: theme.affine.shadows.shadow1,
})); }));
const StyledPopper = styled(PopperUnstyled)` const StyledPopper = styled(PopperUnstyled)`

View File

@ -70,7 +70,7 @@ interface Typography {
interface Shadows { interface Shadows {
none: 'none'; none: 'none';
shadowSxDownLg: string; shadow1: string;
} }
type StringWithNone = [ type StringWithNone = [
@ -225,7 +225,7 @@ export const Theme = {
}, },
shadows: { shadows: {
none: 'none', none: 'none',
shadowSxDownLg: '0px 1px 10px rgba(152, 172, 189, 0.6)', shadow1: '0px 1px 5px rgba(152, 172, 189, 0.2)',
}, },
border: ['none'], border: ['none'],
spacing: { spacing: {