feat: login style

This commit is contained in:
DiamondThree
2023-01-18 02:12:51 +08:00
parent de9248b784
commit e8a5d9b784

View File

@@ -1,11 +1,20 @@
import { styled } from '@/styles'; import { styled } from '@/styles';
import { Modal, ModalWrapper, ModalCloseButton } from '@/ui/modal'; import { Modal, ModalWrapper, ModalCloseButton } from '@/ui/modal';
import { Button } from '@/ui/button'; import { IconButton } from '@/ui/button';
import { useState } from 'react'; import { useState } from 'react';
import { CreateWorkspaceModal } from '../create-workspace'; import { CreateWorkspaceModal } from '../create-workspace';
import { CloudUnsyncedIcon, UsersIcon, AddIcon } from '@blocksuite/icons'; import {
CloudUnsyncedIcon,
UsersIcon,
AddIcon,
LogOutIcon,
CloudInsyncIcon,
} from '@blocksuite/icons';
import { toast } from '@/ui/toast'; import { toast } from '@/ui/toast';
import { WorkspaceUnitAvatar } from '@/components/workspace-avatar'; import {
WorkspaceAvatar,
WorkspaceUnitAvatar,
} from '@/components/workspace-avatar';
import { useAppState } from '@/providers/app-state-provider'; import { useAppState } from '@/providers/app-state-provider';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import { useConfirm } from '@/providers/ConfirmProvider'; import { useConfirm } from '@/providers/ConfirmProvider';
@@ -82,7 +91,7 @@ export const WorkspaceModal = ({ open, onClose }: WorkspaceModalProps) => {
) )
) : ( ) : (
<p> <p>
<CloudUnsyncedIcon fontSize={16} /> <UsersIcon fontSize={16} color={'#FF646B'} />
Joined Workspace Joined Workspace
</p> </p>
)} )}
@@ -125,7 +134,7 @@ export const WorkspaceModal = ({ open, onClose }: WorkspaceModalProps) => {
</Content> </Content>
<Footer> <Footer>
{!user ? ( {!user ? (
<Button <StyleSignIn
onClick={async () => { onClick={async () => {
setLoaded(false); setLoaded(false);
await login(); await login();
@@ -133,14 +142,30 @@ export const WorkspaceModal = ({ open, onClose }: WorkspaceModalProps) => {
setLoaded(true); setLoaded(true);
}} }}
> >
{t('Sign in')} <span>
</Button> <CloudInsyncIcon fontSize={16} />
</span>
Sign in to sync with AFFINE Cloud
</StyleSignIn>
) : ( ) : (
<Button <div style={{ display: 'flex' }}>
type="danger" <div>
<WorkspaceAvatar
size={40}
name={user.name}
avatar={user.avatar}
></WorkspaceAvatar>
</div>
<StyleUserInfo style={{}}>
<p>{user.name}</p>
<p>{user.email}</p>
</StyleUserInfo>
<div>
<IconButton
onClick={() => { onClick={() => {
confirm({ confirm({
title: 'Sign out?', title: 'Sign out?',
content: `All data has been stored in the cloud. `, content: `All data has been stored in the cloud. `,
confirmText: 'Sign out', confirmText: 'Sign out',
cancelText: 'Cancel', cancelText: 'Cancel',
@@ -155,8 +180,10 @@ export const WorkspaceModal = ({ open, onClose }: WorkspaceModalProps) => {
}); });
}} }}
> >
{t('Sign out')} <LogOutIcon></LogOutIcon>
</Button> </IconButton>
</div>
</div>
)} )}
{!loaded && ( {!loaded && (
<Wrapper justifyContent="center"> <Wrapper justifyContent="center">
@@ -196,15 +223,8 @@ const ContentTitle = styled('span')({
paddingBottom: '16px', paddingBottom: '16px',
}); });
const Footer = styled('div')({
height: '70px',
paddingLeft: '24px',
marginTop: '32px',
textAlign: 'center',
});
const WorkspaceList = styled('div')({ const WorkspaceList = styled('div')({
maxHeight: '514px', height: '500px',
overflow: 'auto', overflow: 'auto',
display: 'grid', display: 'grid',
gridRowGap: '24px', gridRowGap: '24px',
@@ -270,5 +290,48 @@ const StyleWorkspaceAdd = styled.div(() => {
background: '#f4f5fa', background: '#f4f5fa',
border: '1.5px dashed #f4f5fa', border: '1.5px dashed #f4f5fa',
lineHeight: '58px', lineHeight: '58px',
marginTop: '2px',
};
});
const Footer = styled('div')({
paddingTop: '16px',
});
const StyleUserInfo = styled.div(({ theme }) => {
return {
textAlign: 'left',
marginLeft: '16px',
marginTop: '16px',
flex: 1,
p: {
lineHeight: '24px',
color: theme.colors.iconColor,
},
'p:nth-child(1)': {
color: theme.colors.textColor,
fontWeight: 600,
},
};
});
const StyleSignIn = styled.div(({ theme }) => {
return {
cursor: 'pointer',
fontSize: '16px',
fontWeight: 700,
span: {
display: 'inline-block',
width: '40px',
height: '40px',
borderRadius: '40px',
backgroundColor: theme.colors.innerHoverBackground,
textAlign: 'center',
lineHeight: '44px',
marginRight: '16px',
svg: {
fill: theme.colors.primaryColor,
},
},
}; };
}); });