There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.
TypeScript appcrdteditorelectronknowledge-basemarkdownmironotesnotionnotion-alternativerustrust-langrust-languagetabletableviewwhiteboardwikiworkspace
fix: text is not center in login button, fixed #789
QiShaoXuandd19c947a98c
diff --git a/packages/app/src/components/login-modal/GoogleIcon.tsx b/packages/app/src/components/login-modal/GoogleIcon.tsxnew file mode 100644index 0000000000..f0454955cb--- /dev/null+++ b/packages/app/src/components/login-modal/GoogleIcon.tsx@@ -0,0 +1,28 @@+export const GoogleIcon = () => {+ return (+ <svg+ width="25"+ height="24"+ viewBox="0 0 25 24"+ fill="none"+ xmlns="http://www.w3.org/2000/svg"+ >+ <path+ d="M22.3055 10.0415H21.5V10H12.5V14H18.1515C17.327 16.3285 15.1115 18 12.5 18C9.1865 18 6.5 15.3135 6.5 12C6.5 8.6865 9.1865 6 12.5 6C14.0295 6 15.421 6.577 16.4805 7.5195L19.309 4.691C17.523 3.0265 15.134 2 12.5 2C6.9775 2 2.5 6.4775 2.5 12C2.5 17.5225 6.9775 22 12.5 22C18.0225 22 22.5 17.5225 22.5 12C22.5 11.3295 22.431 10.675 22.3055 10.0415Z"+ fill="#FFC107"+ />+ <path+ d="M3.65234 7.3455L6.93784 9.755C7.82684 7.554 9.97984 6 12.4993 6C14.0288 6 15.4203 6.577 16.4798 7.5195L19.3083 4.691C17.5223 3.0265 15.1333 2 12.4993 2C8.65834 2 5.32734 4.1685 3.65234 7.3455Z"+ fill="#FF3D00"+ />+ <path+ d="M12.5002 22.0003C15.0832 22.0003 17.4302 21.0118 19.2047 19.4043L16.1097 16.7853C15.0719 17.5745 13.8039 18.0014 12.5002 18.0003C9.89916 18.0003 7.69066 16.3418 6.85866 14.0273L3.59766 16.5398C5.25266 19.7783 8.61366 22.0003 12.5002 22.0003Z"+ fill="#4CAF50"+ />+ <path+ d="M22.3055 10.0415H21.5V10H12.5V14H18.1515C17.7571 15.1082 17.0467 16.0766 16.108 16.7855L16.1095 16.7845L19.2045 19.4035C18.9855 19.6025 22.5 17 22.5 12C22.5 11.3295 22.431 10.675 22.3055 10.0415Z"+ fill="#1976D2"+ />+ </svg>+ );+};diff --git a/packages/app/src/components/login-modal/Icons.tsx b/packages/app/src/components/login-modal/Icons.tsxdeleted file mode 100644index 12356f60d3..0000000000--- a/packages/app/src/components/login-modal/Icons.tsx+++ /dev/null@@ -1,40 +0,0 @@-import { CloudUnsyncedIcon } from '@blocksuite/icons';-import { styled } from '@/styles';-import GoogleSvg from './google.svg';--export const GoogleIcon = () => {- return (- <GoogleIconWrapper>- <picture>- <img src={GoogleSvg.src} alt="Google" />- </picture>- </GoogleIconWrapper>- );-};--const GoogleIconWrapper = styled('div')(({ theme }) => ({- background: theme.colors.pageBackground,- display: 'flex',- alignItems: 'center',- justifyContent: 'center',-}));--export const StayLogOutIcon = () => {- return (- <StayLogOutWrapper>- <CloudUnsyncedIcon />- </StayLogOutWrapper>- );-};--const StayLogOutWrapper = styled('div')(({ theme }) => {- return {- width: '48px',- height: '48px',- display: 'flex',- alignItems: 'center',- justifyContent: 'center',- fontSize: '24px',- background: theme.colors.hoverBackground,- };-});diff --git a/packages/app/src/components/login-modal/LoginOptionButton.tsx b/packages/app/src/components/login-modal/LoginOptionButton.tsxdeleted file mode 100644index f104efc58b..0000000000--- a/packages/app/src/components/login-modal/LoginOptionButton.tsx+++ /dev/null@@ -1,99 +0,0 @@-import { styled } from '@/styles';-import { Button } from '@/ui/button';-import { GoogleIcon, StayLogOutIcon } from './Icons';-import { useTranslation } from '@affine/i18n';-export const GoogleLoginButton = () => {- const { t } = useTranslation();-- return (- <StyledGoogleButton>- <ButtonWrapper>- <IconWrapper>- <GoogleIcon />- </IconWrapper>- <TextWrapper>{t('Continue with Google')}</TextWrapper>- </ButtonWrapper>- </StyledGoogleButton>- );-};--export const StayLogOutButton = () => {- const { t } = useTranslation();- return (- <StyledStayLogOutButton>- <ButtonWrapper>- <IconWrapper>- <StayLogOutIcon />- </IconWrapper>- <TextWrapper>- <Title>{t('Stay logged out')}</Title>- <Description>{t('All changes are saved locally')}</Description>- </TextWrapper>- </ButtonWrapper>- </StyledStayLogOutButton>- );-};--const StyledGoogleButton = styled('div')(({ theme }) => {- return {- width: '284px',- height: '40px',- marginTop: '30px',- fontSize: '16px',- cursor: 'pointer',- borderRadius: '40px',- border: `1px solid ${theme.colors.iconColor}`,- overflow: 'hidden',- ':hover': {- border: `1px solid ${theme.colors.primaryColor}`,- },- };-});--const StyledStayLogOutButton = styled(Button)(() => {- return {- width: '361px',- height: '56px',- padding: '4px',- ':hover': {- borderColor: '#6880FF',- },- };-});--const ButtonWrapper = styled('div')({- display: 'flex',- flexDirection: 'row',- width: '100%',-});--const IconWrapper = styled('div')({- flex: '0 48px',- borderRadius: '5px',- overflow: 'hidden',- marginRight: '12px',- marginTop: '8px',-});--const TextWrapper = styled('div')({- flex: 1,- textAlign: 'left',- height: '40px',- lineHeight: '40px',-});--const Title = styled('h1')(() => {- return {- fontSize: '18px',- lineHeight: '26px',- fontWeight: 500,- };-});--const Description = styled('p')(() => {- return {- fontSize: '16px',- lineHeight: '22px',- fontWeight: 400,- };-});diff --git a/packages/app/src/components/login-modal/google.svg b/packages/app/src/components/login-modal/google.svgdeleted file mode 100644index 23af746fed..0000000000--- a/packages/app/src/components/login-modal/google.svg+++ /dev/null@@ -1,6 +0,0 @@-<svg width="25" height="24" viewBox="0 0 25 24" fill="none" xmlns="http://www.w3.org/2000/svg">-<path d="M22.3055 10.0415H21.5V10H12.5V14H18.1515C17.327 16.3285 15.1115 18 12.5 18C9.1865 18 6.5 15.3135 6.5 12C6.5 8.6865 9.1865 6 12.5 6C14.0295 6 15.421 6.577 16.4805 7.5195L19.309 4.691C17.523 3.0265 15.134 2 12.5 2C6.9775 2 2.5 6.4775 2.5 12C2.5 17.5225 6.9775 22 12.5 22C18.0225 22 22.5 17.5225 22.5 12C22.5 11.3295 22.431 10.675 22.3055 10.0415Z" fill="#FFC107"/>-<path d="M3.65234 7.3455L6.93784 9.755C7.82684 7.554 9.97984 6 12.4993 6C14.0288 6 15.4203 6.577 16.4798 7.5195L19.3083 4.691C17.5223 3.0265 15.1333 2 12.4993 2C8.65834 2 5.32734 4.1685 3.65234 7.3455Z" fill="#FF3D00"/>-<path d="M12.5002 22.0003C15.0832 22.0003 17.4302 21.0118 19.2047 19.4043L16.1097 16.7853C15.0719 17.5745 13.8039 18.0014 12.5002 18.0003C9.89916 18.0003 7.69066 16.3418 6.85866 14.0273L3.59766 16.5398C5.25266 19.7783 8.61366 22.0003 12.5002 22.0003Z" fill="#4CAF50"/>-<path d="M22.3055 10.0415H21.5V10H12.5V14H18.1515C17.7571 15.1082 17.0467 16.0766 16.108 16.7855L16.1095 16.7845L19.2045 19.4035C18.9855 19.6025 22.5 17 22.5 12C22.5 11.3295 22.431 10.675 22.3055 10.0415Z" fill="#1976D2"/>-</svg>diff --git a/packages/app/src/components/login-modal/index.tsx b/packages/app/src/components/login-modal/index.tsxindex 8c15c24417..880ebe6e38 100644--- a/packages/app/src/components/login-modal/index.tsx+++ b/packages/app/src/components/login-modal/index.tsx@@ -1,8 +1,9 @@-import { styled } from '@/styles';+import { positionAbsolute, styled } from '@/styles';import { Modal, ModalWrapper, ModalCloseButton } from '@/ui/modal';-import { GoogleLoginButton } from './LoginOptionButton';+import { Button } from '@/ui/button';import { useAppState } from '@/providers/app-state-provider';import { useTranslation } from '@affine/i18n';+import { GoogleIcon } from './GoogleIcon';interface LoginModalProps {open: boolean;onClose: () => void;@@ -13,34 +14,41 @@ export const LoginModal = ({ open, onClose }: LoginModalProps) => {const { t } = useTranslation();return (<Modal open={open} onClose={onClose} data-testid="login-modal">- <ModalWrapper width={560} height={292}>- <Header>- <ModalCloseButton- onClick={() => {- onClose();- }}- />- </Header>+ <ModalWrapper width={560} height={292} style={{ paddingTop: '44px' }}>+ <ModalCloseButton+ onClick={() => {+ onClose();+ }}+ /><Content><ContentTitle>{t('Sign in')}</ContentTitle><SignDes>{t('Set up an AFFiNE account to sync data')}</SignDes>- <span+ <StyledLoginButton+ shape="round"onClick={async () => {await login();onClose();}}>- <GoogleLoginButton />- </span>+ <GoogleIcon />+ {t('Continue with Google')}+ </StyledLoginButton></Content></ModalWrapper></Modal>);};-const Header = styled('div')({- position: 'relative',- height: '44px',+const StyledLoginButton = styled(Button)(() => {+ return {+ width: '284px',+ marginTop: '30px',+ position: 'relative',+ svg: {+ ...positionAbsolute({ left: '18px', top: '0', bottom: '0' }),+ margin: 'auto',+ },+ };});const Content = styled('div')({diff --git a/packages/app/src/ui/button/styles.ts b/packages/app/src/ui/button/styles.tsindex 8310f3cfaa..74f6092402 100644--- a/packages/app/src/ui/button/styles.ts+++ b/packages/app/src/ui/button/styles.ts@@ -145,6 +145,7 @@ export const StyledButton = styled('button', {shouldForwardProp: prop => {return !['hoverBackground',+ 'shape','hoverColor','hoverStyle','type',@@ -203,6 +204,9 @@ export const StyledButton = styled('button', {'.affine-button-icon': {color: theme.colors.iconColor,},+ '.affine-button-icon__fixed': {+ color: theme.colors.iconColor,+ },'>span': {marginLeft: '5px',width: '100%',