Files
AFFiNE-Mirror/libs/components/layout/src/header/EditorBoardSwitcher/StatusIcon.tsx
2022-08-04 17:47:09 +08:00

36 lines
1.0 KiB
TypeScript

import { styled } from '@toeverything/components/ui';
import { DocViewIcon, BoardViewIcon } from '@toeverything/components/icons';
import { DocMode } from './type';
interface StatusIconProps {
mode: DocMode;
}
export const StatusIcon = ({ mode }: StatusIconProps) => {
return (
<IconWrapper mode={mode}>
{mode === DocMode.doc ? <DocViewIcon /> : <BoardViewIcon />}
</IconWrapper>
);
};
const IconWrapper = styled('div')<Pick<StatusIconProps, 'mode'>>(
({ theme, mode }) => {
return {
width: '20px',
height: '20px',
borderRadius: '5px',
boxShadow: theme.affine.shadows.shadow1,
color: theme.affine.palette.primary,
cursor: 'pointer',
backgroundColor: theme.affine.palette.white,
transform: `translateX(${mode === DocMode.doc ? 0 : 20}px)`,
transition: 'transform 300ms ease',
'& > svg': {
fontSize: '20px',
},
};
}
);