Browse Source

Merge pull request #217 from sutcalag/main

add community btn
Tumao 3 years ago
parent
commit
0bd99b97cd

+ 3 - 0
client/src/assets/icons/people.svg

@@ -0,0 +1,3 @@
+<svg width="24" height="16" viewBox="0 0 24 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M16 11C17.66 11 18.99 9.66 18.99 8C18.99 6.34 17.66 5 16 5C14.34 5 13 6.34 13 8C13 9.66 14.34 11 16 11ZM8 11C9.66 11 10.99 9.66 10.99 8C10.99 6.34 9.66 5 8 5C6.34 5 5 6.34 5 8C5 9.66 6.34 11 8 11ZM8 13C5.67 13 1 14.17 1 16.5V19H15V16.5C15 14.17 10.33 13 8 13ZM16 13C15.71 13 15.38 13.02 15.03 13.05C16.19 13.89 17 15.02 17 16.5V19H23V16.5C23 14.17 18.33 13 16 13Z" fill="#06AFF2"/>
+</svg>

+ 6 - 0
client/src/assets/icons/slack.svg

@@ -0,0 +1,6 @@
+<svg width="21" height="21" viewBox="0 0 21 21" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M7.82519 0.0136337C6.72305 0.0136337 5.82252 0.914161 5.82252 2.0163C5.82252 3.11844 6.72305 4.01896 7.82519 4.01896H9.82786V2.0163C9.82786 0.914161 8.94077 0.0136337 7.82519 0.0136337ZM7.82519 5.3496H2.50267C1.40053 5.3496 0.5 6.25013 0.5 7.35226C0.5 8.4544 1.40053 9.35493 2.50267 9.35493H7.83863C8.94077 9.35493 9.8413 8.4544 9.8413 7.35226C9.82786 6.25013 8.94077 5.3496 7.82519 5.3496Z" fill="#36C5F0"/>
+<path d="M20.5 7.35207C20.5 6.24994 19.5995 5.34941 18.4973 5.34941C17.3952 5.34941 16.4947 6.24994 16.4947 7.35207V9.35474H18.4973C19.5995 9.36818 20.5 8.46765 20.5 7.35207ZM15.164 7.35207V2.00267C15.164 0.900527 14.2635 0 13.1614 0C12.0592 0 11.1587 0.900527 11.1587 2.00267V7.35207C11.1587 8.45421 12.0592 9.35474 13.1614 9.35474C14.2769 9.36818 15.164 8.46765 15.164 7.35207Z" fill="#2EB67D"/>
+<path d="M13.1614 20.0536C14.2635 20.0536 15.164 19.1531 15.164 18.051C15.164 16.9488 14.2635 16.0483 13.1614 16.0483H11.1587V18.051C11.1587 19.1531 12.0592 20.0536 13.1614 20.0536ZM13.1614 14.7042H18.4973C19.5995 14.7042 20.5 13.8037 20.5 12.7016C20.5 11.5994 19.5995 10.6989 18.4973 10.6989H13.1614C12.0592 10.6989 11.1587 11.5994 11.1587 12.7016C11.1587 13.8037 12.0592 14.7042 13.1614 14.7042Z" fill="#ECB22E"/>
+<path d="M0.5 12.7016C0.5 13.8037 1.40053 14.7042 2.50267 14.7042C3.60481 14.7042 4.50533 13.8037 4.50533 12.7016V10.6989H2.50267C1.38709 10.6989 0.5 11.5994 0.5 12.7016ZM5.83597 12.7016V18.051C5.83597 19.1531 6.73649 20.0536 7.83863 20.0536C8.94077 20.0536 9.8413 19.1531 9.8413 18.051V12.7016C9.8413 11.5994 8.94077 10.6989 7.83863 10.6989C6.72305 10.6989 5.83597 11.5994 5.83597 12.7016Z" fill="#E01E5A"/>
+</svg>

BIN
client/src/assets/imgs/wechat_qrcode.png


+ 194 - 0
client/src/components/menu/CommunityBtn.tsx

@@ -0,0 +1,194 @@
+import { FC, FunctionComponent, useMemo } from 'react';
+import React from 'react';
+import { useTranslation } from 'react-i18next';
+import Button from '@material-ui/core/Button';
+import SvgIcon from '@material-ui/core/SvgIcon';
+import { makeStyles, Theme, Link } from '@material-ui/core';
+import ChevronRightIcon from '@material-ui/icons/ChevronRight';
+import GitHubIcon from '@material-ui/icons/GitHub';
+import { ReactComponent as peopleIcon } from '../../assets/icons/people.svg';
+import { ReactComponent as slackIcon } from '../../assets/icons/slack.svg';
+import qrcodePath from '../../assets/imgs/wechat_qrcode.png';
+
+const SLACK_LINK = 'https://slack.milvus.io';
+const GITHUB_LINK = 'https://github.com/milvus-io/milvus/discussions';
+
+const getStyles = makeStyles((theme: Theme) => ({
+  root: {
+    bottom: theme.spacing(2),
+    position: 'absolute',
+    right: theme.spacing(3),
+    width: theme.spacing(5),
+    zIndex: 1,
+  },
+  menuBtn: {
+    border: '1px solid #E9E9ED',
+    borderRadius: '50%',
+    bottom: 0,
+    boxShadow: '3px 3px 10px rgba(0, 0, 0, 0.05)',
+    height: theme.spacing(5),
+    minWidth: 'auto',
+    padding: 0,
+    position: 'absolute',
+    width: theme.spacing(5),
+  },
+  chevronIcon: {
+    transform: 'rotateZ(90deg)',
+    fill: theme.palette.primary.main,
+  },
+  container: {
+    bottom: theme.spacing(7),
+    position: 'absolute',
+    width: '360px',
+    overflow: 'hidden',
+    fontFamily: 'Roboto',
+  },
+  head: {
+    backgroundColor: theme.palette.primary.main,
+    padding: '16px 24px',
+    color: '#fff',
+    borderTopLeftRadius: theme.spacing(1),
+    borderTopRightRadius: theme.spacing(1),
+  },
+  title: {
+    fontWeight: 700,
+    fontSize: theme.spacing(2),
+    lineHeight: theme.spacing(3),
+    letterSpacing: '-0.01em',
+    fontFamily: 'Roboto'
+  },
+  titleDesc: {
+    color: '#f0f4f9',
+    fontSize: theme.spacing(1.5),
+    lineHeight: theme.spacing(2),
+  },
+  body: {
+    backgroundColor: '#fff',
+    border: '1px solid #e9e9e9',
+    borderTop: 0,
+    borderBottomRightRadius: theme.spacing(1),
+    borderBottomLeftRadius: theme.spacing(1),
+    padding: theme.spacing(3),
+  },
+  block: {
+    border: '1px solid #f9f9f9',
+    borderRadius: theme.spacing(1),
+    boxShadow: '3px 3px 10px rgba(0, 0, 0, 0.05)',
+    marginBottom: theme.spacing(3),
+    padding: theme.spacing(2),
+  },
+  contentTitle: {
+    fontWeight: 500,
+    fontSize: theme.spacing(1.75),
+    lineHeight: theme.spacing(2.5),
+
+  },
+  contentDesc: {
+    fontSize: theme.spacing(1.5),
+    lineHeight: theme.spacing(2.5),
+    color: '#82838e',
+    marginBottom: theme.spacing(1),
+
+  },
+  contentLink: {
+    display: 'block',
+    fontSize: theme.spacing(1.5),
+    lineHeight: theme.spacing(2.5),
+    letterSpacing: '-0.01em',
+    color: theme.palette.primary.main,
+  },
+  qrImg: {
+    display: 'block',
+    margin: '0 auto',
+    width: theme.spacing(10),
+  },
+  textCenter: {
+    textAlign: 'center',
+  },
+  icon: {
+    marginTop: theme.spacing(2),
+    width: theme.spacing(2.5),
+    height: theme.spacing(2.5),
+  }
+}));
+
+const CommunityBtn = (props: any) => {
+  const [open, setOpen] = React.useState<boolean>(false);
+  const classes = getStyles();
+  const { t } = useTranslation();
+  const communityTrans: { [key in string]: string } = t('community');
+
+  return (
+    <div className={classes.root}>
+      {open && (
+        <div className={classes.container}>
+          <div className={classes.head}>
+            <div className={classes.title}>
+              {communityTrans.hi}
+            </div>
+            <div className={classes.titleDesc}>
+              {communityTrans.growing}
+            </div>
+          </div>
+          <div className={classes.body}>
+            <div className={classes.block}>
+              <div className={`${classes.contentTitle} ${classes.textCenter}`}>
+                {communityTrans.question}
+              </div>
+              <div className={`${classes.contentDesc} ${classes.textCenter}`}>
+                {communityTrans.qr}
+              </div>
+              <img className={classes.qrImg} src={qrcodePath} alt="qrcode" />
+            </div>
+            <div className={classes.block}>
+              <div className={`${classes.contentTitle} ${classes.textCenter}`}>
+                {communityTrans.more}
+              </div>
+
+              <SvgIcon viewBox="0 0 24 24" component={slackIcon} className={classes.icon} />
+              <div className={classes.contentDesc}>
+                {communityTrans.join}
+              </div>
+              <Link
+                classes={{ root: classes.contentLink }}
+                href={SLACK_LINK}
+                underline='always'
+                target="_blank"
+                rel="noopener"
+              >
+                {SLACK_LINK}
+              </Link>
+
+              <SvgIcon viewBox="0 0 24 24" component={GitHubIcon} className={classes.icon} />
+              <div className={classes.contentDesc}>
+                {communityTrans.get}
+              </div>
+              <Link
+                classes={{ root: classes.contentLink }}
+                href={GITHUB_LINK}
+                underline='always'
+                target="_blank"
+                rel="noopener"
+              >
+                {GITHUB_LINK}
+              </Link>
+            </div>
+          </div>
+        </div>
+      )}
+      <Button
+        className={classes.menuBtn}
+        aria-haspopup="true"
+        onClick={() => { setOpen(!open) }}
+      >
+        {open ?
+          <ChevronRightIcon className={classes.chevronIcon} />
+          :
+          <SvgIcon viewBox="0 0 24 24" component={peopleIcon} />
+        }
+      </Button>
+    </div>
+  );
+};
+
+export default CommunityBtn;

+ 2 - 2
client/src/components/menu/NavMenu.tsx

@@ -12,6 +12,7 @@ import icons from '../icons/Icons';
 import { useTranslation } from 'react-i18next';
 import Typography from '@material-ui/core/Typography';
 import ChevronRightIcon from '@material-ui/icons/ChevronRight';
+import CommunityBtn from './CommunityBtn';
 
 const timeout = 150;
 const duration = `${timeout}ms`;
@@ -28,7 +29,6 @@ const useStyles = makeStyles((theme: Theme) =>
       transition: theme.transitions.create('width', {
         duration,
       }),
-      overflow: 'hidden',
     },
     rootCollapse: {
       width: '86px',
@@ -74,7 +74,6 @@ const useStyles = makeStyles((theme: Theme) =>
     },
 
     logoWrapper: {
-      width: '100%',
       display: 'flex',
       alignItems: 'center',
       height: '86px',
@@ -235,6 +234,7 @@ const NavMenu: FC<NavMenuType> = props => {
           <ChevronRightIcon />
         </Button>
         <NestList data={data} />
+        <CommunityBtn />
       </div>
     </List>
   );

+ 9 - 0
client/src/i18n/cn/common.ts

@@ -28,6 +28,15 @@ const commonTrans = {
   view: 'View Code',
   js: 'NODE.JS',
   py: 'PYTHON',
+  community: {
+    hi: 'Hi, there!',
+    growing: 'Our growing community is here!',
+    question: 'Have question about Milvus?',
+    qr: 'Scan WeChat QR code to get access',
+    more: 'More Channels to Explore',
+    join: 'Join our growing social community today',
+    get: 'Get insight, tips and share ideas'
+  },
 };
 
 export default commonTrans;

+ 9 - 0
client/src/i18n/en/common.ts

@@ -28,6 +28,15 @@ const commonTrans = {
   view: 'View Code',
   js: 'NODE.JS',
   py: 'PYTHON',
+  community: {
+    hi: 'Hi, there!',
+    growing: 'Our growing community is here!',
+    question: 'Have question about Milvus?',
+    qr: 'Scan WeChat QR code to get access',
+    more: 'More Channels to Explore',
+    join: 'Join our growing social community today',
+    get: 'Get insight, tips and share ideas'
+  },
 };
 
 export default commonTrans;