Skip to content
Snippets Groups Projects
App.tsx 1.29 KiB
Newer Older
  • Learn to ignore specific revisions
  • import React from "react";
    import "./App.scss";
    
    import TopBar from "./organisms/TopBar";
    import BottomBar from "./organisms/BottomBar";
    
    danieldeng2's avatar
    danieldeng2 committed
    import {
      faBookOpen,
      faEllipsisH,
      faCalendarWeek,
      faChalkboardTeacher,
    } from "@fortawesome/free-solid-svg-icons";
    
    import StandardView from "./pages/StandardView";
    
    type MyState = {
    
      isToggled: boolean;
    
    class App extends React.Component<{}, MyState> {
    
      constructor(props: {}) {
    
        super(props);
    
        this.state = { isToggled: false };
      }
    
    
      handleIconClick(e: React.MouseEvent<HTMLImageElement>) {
    
        e.preventDefault();
        this.setState((state) => ({
          isToggled: !state.isToggled,
        }));
    
      }
    
      render() {
        const horizontalBarPages = [
    
    danieldeng2's avatar
    danieldeng2 committed
          { name: "Modules", path: "/modules", icon: faChalkboardTeacher },
    
          { name: "Timetable", path: "/timetable", icon: faCalendarWeek },
          { name: "Exams", path: "/exams", icon: faBookOpen },
          { name: "Other", path: "/other", icon: faEllipsisH },
        ];
    
        return (
          <>
    
            <TopBar
              pages={horizontalBarPages}
              onIconClick={(e) => this.handleIconClick(e)}
            />
    
            <StandardView
              pages={horizontalBarPages}
              isToggled={this.state.isToggled}
            />
    
    
            <BottomBar pages={horizontalBarPages} />
          </>
        );
      }
    }
    
    
    export default App;