Skip to content

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.

feat(venus): use AFFiNE header stanard header

tzhangchia02582cc9033
diff --git a/apps/venus/src/app/AboutUs.tsx b/apps/venus/src/app/AboutUs.tsx
index 19dfbd4a8a..b20420a556 100644
--- a/apps/venus/src/app/AboutUs.tsx
+++ b/apps/venus/src/app/AboutUs.tsx
@@ -1,18 +1,13 @@
import { useTranslation } from 'react-i18next';
import { useNavigate } from 'react-router-dom';
-import { Box, Button, Grid, Typography } from '@mui/joy';
-import Option from '@mui/joy/Option';
-import Select from '@mui/joy/Select';
+import { Box, Grid, Typography } from '@mui/joy';
// eslint-disable-next-line no-restricted-imports
import { useMediaQuery } from '@mui/material';
-
import 'github-markdown-css';
import AboutText from './about.mdx';
-import { AFFiNEFooter, AFFiNEImage } from './Common';
-import { options } from './i18n';
+import { AFFiNEFooter, AFFiNEHeader, AFFiNEImage } from './Common';
import KeepUpdate from './keeupdate.png';
-
export const AboutUs = () => {
const matches = useMediaQuery('(max-width: 1024px)');
const navigate = useNavigate();
@@ -23,58 +18,7 @@ export const AboutUs = () => {
};
return (
<>
- <Grid
- container
- spacing={2}
- sx={{
- maxWidth: '1280px',
- margin: 'auto',
- }}
- >
- <Grid xs={6}>
- <Button
- size="lg"
- variant="plain"
- onClick={() => navigate('/')}
- sx={{
- padding: matches ? '0' : '0 0.5em',
- ':hover': { backgroundColor: 'unset' },
- fontSize: '24px',
- '@media (max-width: 1024px)': {
- fontSize: '16px',
- },
- }}
- >
- AFFiNE
- </Button>
- </Grid>
- <Grid xs={6} sx={{ display: 'flex', justifyContent: 'right' }}>
- <Button
- onClick={() => {
- window.open('https://blog.affine.pro');
- }}
- variant="plain"
- sx={{
- padding: matches ? '0' : '0 0.5em',
- ':hover': { backgroundColor: 'unset' },
- fontSize: '24px',
- '@media (max-width: 1024px)': {
- fontSize: '16px',
- },
- }}
- size="lg"
- >
- Blog
- </Button>
- <Select defaultValue="en" onChange={changeLanguage}>
- {options.map(option => (
- <Option key={option.value} value={option.value}>
- {option.text}
- </Option>
- ))}
- </Select>
- </Grid>
- </Grid>
+ <AFFiNEHeader />
<Grid xs={12} sx={{ display: 'flex', marginTop: '4vh!important' }}>
<Box
sx={{
diff --git a/apps/venus/src/app/App.tsx b/apps/venus/src/app/App.tsx
index 8f791b7ec3..df1e8be681 100644
--- a/apps/venus/src/app/App.tsx
+++ b/apps/venus/src/app/App.tsx
@@ -6,16 +6,13 @@ import { useTranslation } from 'react-i18next';
import { useNavigate } from 'react-router-dom';
import { Box, Button, Grid, Typography } from '@mui/joy';
-import Option from '@mui/joy/Option';
-import Select from '@mui/joy/Select';
import { styled } from '@mui/joy/styles';
import { LogoIcon } from '@toeverything/components/icons';
// eslint-disable-next-line no-restricted-imports
import { useMediaQuery } from '@mui/material';
import CollaborationImage from './collaboration.png';
-import { AFFiNEFooter, AFFiNEImage } from './Common';
-import { options } from './i18n';
+import { AFFiNEFooter, AFFiNEHeader, AFFiNEImage } from './Common';
import { GitHub } from './Icons';
import PageImage from './page.png';
import ShapeImage from './shape.png';
@@ -220,71 +217,7 @@ export function App() {
};
return (
<>
- <Grid
- container
- spacing={2}
- sx={{
- maxWidth: '1280px',
- margin: 'auto',
- }}
- >
- <Grid xs={6}>
- <Button
- size="lg"
- variant="plain"
- sx={{
- padding: matches ? '0' : '0 0.5em',
- ':hover': { backgroundColor: 'unset' },
- fontSize: '24px',
- '@media (max-width: 1024px)': {
- fontSize: '16px',
- },
- }}
- >
- AFFiNE
- </Button>
- </Grid>
- <Grid xs={6} sx={{ display: 'flex', justifyContent: 'right' }}>
- <GitHub flat />
- <Button
- onClick={() => window.open('https://blog.affine.pro')}
- variant="plain"
- sx={{
- padding: matches ? '0' : '0 0.5em',
- ':hover': { backgroundColor: 'unset' },
- fontSize: '24px',
- '@media (max-width: 1024px)': {
- fontSize: '16px',
- },
- }}
- size="lg"
- >
- Blog
- </Button>
- <Button
- onClick={() => navigate('/aboutus')}
- variant="plain"
- sx={{
- padding: matches ? '0' : '0 0.5em',
- ':hover': { backgroundColor: 'unset' },
- fontSize: '24px',
- '@media (max-width: 1024px)': {
- fontSize: '16px',
- },
- }}
- size="lg"
- >
- About Us
- </Button>
- <Select defaultValue="en" onChange={changeLanguage}>
- {options.map(option => (
- <Option key={option.value} value={option.value}>
- {option.text}
- </Option>
- ))}
- </Select>
- </Grid>
- </Grid>
+ <AFFiNEHeader />
<Grid xs={12} sx={{ display: 'flex', marginTop: '12vh!important' }}>
<Box
sx={{
diff --git a/apps/venus/src/app/Common.tsx b/apps/venus/src/app/Common.tsx
index 8c1102620a..7adb206a56 100644
--- a/apps/venus/src/app/Common.tsx
+++ b/apps/venus/src/app/Common.tsx
@@ -1,12 +1,20 @@
/* eslint-disable @typescript-eslint/naming-convention */
-import GitHubIcon from '@mui/icons-material/GitHub';
-import RedditIcon from '@mui/icons-material/Reddit';
-import TelegramIcon from '@mui/icons-material/Telegram';
+import { useTranslation } from 'react-i18next';
+import { useNavigate } from 'react-router-dom';
+
import { Box, Button, Grid, Typography } from '@mui/joy';
+import Option from '@mui/joy/Option';
+import Select from '@mui/joy/Select';
import { styled } from '@mui/joy/styles';
// eslint-disable-next-line no-restricted-imports
-import { useTranslation } from 'react-i18next';
+import { useMediaQuery } from '@mui/material';
+
+import GitHubIcon from '@mui/icons-material/GitHub';
+import RedditIcon from '@mui/icons-material/Reddit';
+import TelegramIcon from '@mui/icons-material/Telegram';
+import { options } from './i18n';
import { DiscordIcon, GitHub } from './Icons';
+// eslint-disable-next-line no-restricted-imports
import LogoImage from './logo.png';
export const AFFiNEImage = styled('img')({
@@ -333,3 +341,81 @@ export const AFFiNEFooter = ({
</>
);
};
+
+export const AFFiNEHeader = () => {
+ const matches = useMediaQuery('(max-width: 1024px)');
+ const navigate = useNavigate();
+ const { i18n } = useTranslation();
+
+ const changeLanguage = (event: any) => {
+ i18n.changeLanguage(event);
+ };
+ return (
+ <Grid
+ container
+ spacing={2}
+ sx={{
+ maxWidth: '1280px',
+ margin: 'auto',
+ }}
+ >
+ <Grid xs={6}>
+ <Button
+ size="lg"
+ variant="plain"
+ sx={{
+ padding: matches ? '0' : '0 0.5em',
+ ':hover': { backgroundColor: 'unset' },
+ fontSize: '24px',
+ '@media (max-width: 1024px)': {
+ fontSize: '16px',
+ },
+ }}
+ onClick={() => navigate('/')}
+ >
+ AFFiNE
+ </Button>
+ </Grid>
+ <Grid xs={6} sx={{ display: 'flex', justifyContent: 'right' }}>
+ <GitHub flat />
+ <Button
+ onClick={() => window.open('https://blog.affine.pro')}
+ variant="plain"
+ sx={{
+ padding: matches ? '0' : '0 0.5em',
+ ':hover': { backgroundColor: 'unset' },
+ fontSize: '24px',
+ '@media (max-width: 1024px)': {
+ fontSize: '16px',
+ },
+ }}
+ size="lg"
+ >
+ Blog
+ </Button>
+ <Button
+ onClick={() => navigate('/aboutus')}
+ variant="plain"
+ sx={{
+ padding: matches ? '0' : '0 0.5em',
+ ':hover': { backgroundColor: 'unset' },
+ fontSize: '24px',
+ '@media (max-width: 1024px)': {
+ fontSize: '16px',
+ },
+ }}
+ size="lg"
+ >
+ About Us
+ </Button>
+ <Select defaultValue="en" onChange={changeLanguage}>
+ {options.map(option => (
+ <Option key={option.value} value={option.value}>
+ {option.text}
+ </Option>
+ ))}
+ </Select>
+ </Grid>
+ </Grid>
+ );
+};