From b5739cad11e4d008c21746a80b722dd82810c9f5 Mon Sep 17 00:00:00 2001 From: pinpom Date: Mon, 25 Jan 2021 12:01:21 +0800 Subject: [PATCH 1/2] change route of home --- web/src/Routes.js | 2 +- web/src/components/Header.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/web/src/Routes.js b/web/src/Routes.js index b5320158..7b2cdc22 100644 --- a/web/src/Routes.js +++ b/web/src/Routes.js @@ -12,7 +12,7 @@ import TabularRegression from "./TabularRegression/TabularRegression"; export default function Routes() { return ( - + diff --git a/web/src/components/Header.js b/web/src/components/Header.js index df5b3f2e..30a1a16f 100644 --- a/web/src/components/Header.js +++ b/web/src/components/Header.js @@ -82,7 +82,7 @@ export default function Header() { From 9f3ef9f890882609a995ecb1dcaefaf734f3ac53 Mon Sep 17 00:00:00 2001 From: pinpom Date: Mon, 15 Mar 2021 16:49:28 +0800 Subject: [PATCH 2/2] add toggle menu button for tasks options --- web/src/Home/Home.css | 51 +++++---- web/src/Home/Home.js | 2 +- web/src/components/Header.js | 204 ++++++++++++++++++++++++++++------- 3 files changed, 194 insertions(+), 63 deletions(-) diff --git a/web/src/Home/Home.css b/web/src/Home/Home.css index 18d9ca92..5a521d82 100644 --- a/web/src/Home/Home.css +++ b/web/src/Home/Home.css @@ -1,24 +1,29 @@ .Home .lander { - z-index: 99999; - margin: 120px; - text-align: center; + z-index: 99999; + margin: 120px; + text-align: center; +} + +@media only screen and (max-width: 1100px) { + .Home .lander { + margin: 40px; + } } .Home .lander h1 { - z-index: 99999; - font-family: "Open Sans", sans-serif; - font-weight: 800; + z-index: 99999; + font-family: "Open Sans", sans-serif; + font-weight: 800; } .Home .lander p { - z-index: 99999; - color: #999; + z-index: 99999; + color: #999; } .Home .textItem { font-size: large; } - /* to replace background image .Home { background: url("../components/images.jpg") no-repeat center center fixed; @@ -30,17 +35,17 @@ min-height:100vh; } */ - body { - margin: 0; - padding: 0; - /* more styles */ - } - - .particles { - position: fixed; - right: 0; - right: 0; - bottom: 0; - left: 0; - z-index: -1; - } \ No newline at end of file +body { + margin: 0; + padding: 0; + /* more styles */ +} + +.particles { + position: fixed; + right: 0; + right: 0; + bottom: 0; + left: 0; + z-index: -1; +} diff --git a/web/src/Home/Home.js b/web/src/Home/Home.js index 02a78524..96eb8744 100644 --- a/web/src/Home/Home.js +++ b/web/src/Home/Home.js @@ -1,4 +1,4 @@ -import React, { Component } from "react"; +import React from "react"; import "./Home.css"; import Particles from "react-particles-js"; import Grid from "@material-ui/core/Grid"; diff --git a/web/src/components/Header.js b/web/src/components/Header.js index 30a1a16f..19ee8fbc 100644 --- a/web/src/components/Header.js +++ b/web/src/components/Header.js @@ -1,64 +1,77 @@ -import React from "react"; -import { Tabs, Tab, AppBar } from "@material-ui/core"; +import React, { useState, useEffect } from "react"; +import { + Tabs, + Tab, + AppBar, + Toolbar, + IconButton, + Drawer, + List, + ListItem, + ListItemText +} from "@material-ui/core"; import { Route, BrowserRouter, NavLink, Link } from "react-router-dom"; import Routes from "../Routes"; import { makeStyles } from "@material-ui/core/styles"; import Grid from "@material-ui/core/Grid"; +import MenuIcon from "@material-ui/icons/Menu"; const useStyles = makeStyles({ root: { flexGrow: 1, - backgroundColor: `#01213f`, - textDecoration: `none` + backgroundColor: "#01213f", + textDecoration: "none" }, - paper: { - fontSize: `25px`, - backgroundColor: `#01213f`, - padding: `20px 10px`, - textAlign: "center", - color: `#c5c3c3`, - textTransform: `capitalize`, - "&:hover": { - backgroundColor: "#1890ff !important", - color: `white` - } - }, - navHome: { - padding: `25px 60px 25px 80px`, - margin: `0px`, - fontSize: `30px`, + padding: "30px 14px", + textAlign: "center", + margin: "0px 15px", "&:hover": { - textDecoration: `none`, + textDecoration: "none", backgroundColor: "#1890ff !important" } }, - navHomeText: { - color: `#ffffff`, + color: "#ffffff", + fontSize: "22px", "&:hover": { - textDecoration: `none`, + textDecoration: "none", backgroundColor: "#1890ff !important", - color: `#ffffff` + color: "#ffffff" } }, - navItem: { - padding: `15px`, - color: `#c5c3c3`, - fontSize: `15px`, + padding: "15px", + color: "#c5c3c3", + fontSize: "15px", "&:hover": { - textDecoration: `none` + textDecoration: "none" } }, navText: { - fontSize: `15px`, - padding: `17px 30px`, + fontSize: "15px", + padding: "17px 30px", "&:hover": { - textDecoration: `none`, - color: `#ffffff`, + textDecoration: "none", + color: "#ffffff", backgroundColor: "#1890ff !important" } + }, + + drawerContainer: { + paddingTop: "30px", + textDecoration: "none", + listStyle: "none" + }, + drawerItem: { + // fontSize: "40px", + color: "#01213f", + padding: "20px 40px", + "&:hover": { + textDecoration: "none", + color: "#1890ff", + backgroundColor: "#D5D5D5" + } } }); @@ -72,18 +85,129 @@ export default function Header() { "/TabularClassification", "/TabularRegression" ]; - return ( -
+ + const [state, setState] = useState({ + mobileView: false, + drawerOpen: false + }); + const { mobileView, drawerOpen } = state; + + useEffect(() => { + const setResponsiveness = () => { + return window.innerWidth < 1100 + ? setState(prevState => ({ ...prevState, mobileView: true })) + : setState(prevState => ({ ...prevState, mobileView: false })); + }; + setResponsiveness(); + window.addEventListener("resize", () => setResponsiveness()); + }, []); + + const displayMobile = () => { + const handleDrawerOpen = () => + setState(prevState => ({ ...prevState, drawerOpen: true })); + const handleDrawerClose = () => + setState(prevState => ({ ...prevState, drawerOpen: false })); + return ( + + + + + + + ( + + + Image Classification + + + Object Detection + + + Question Answering + + + POS Tagging + + + Tabular Classification + + + Tabular Regression + + + )} + /> + + + + + + ); + }; + const displayDesktop = () => { + return ( ( - + @@ -147,6 +271,8 @@ export default function Header() { /> -
- ); + ); + }; + + return
{mobileView ? displayMobile() : displayDesktop()}
; }