Skip to content

Commit

Permalink
feat(flat-web): add HomePage to Flat-web (#702)
Browse files Browse the repository at this point in the history
  • Loading branch information
Cheerego7 committed Jun 4, 2021
1 parent 0784719 commit 92f9106
Show file tree
Hide file tree
Showing 30 changed files with 1,452 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
.main-page-nav-horizontal-content {
display: flex;
justify-content: space-between;
height: 50px;
max-width: 960px;
max-height: 50px;
margin: 0 auto;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import "./style.less";
import React from "react";
import classNames from "classnames";
import { MainPageLayoutItem } from "../MainPageLayout/types";
import {
MainPageNavHorizontal,
MainPageNavHorizontalProps,
} from "../MainPageLayout/MainPageNavHorizontal";

export * from "../MainPageLayout/MainPageHeader";
export type { MainPageLayoutItem } from "../MainPageLayout/types";

export interface MainPageLayoutHorizontalProps extends MainPageNavHorizontalProps {
/** when an item is clicked */
onClick: (mainPageLayoutItem: MainPageLayoutItem) => void;
/** a list of keys to highlight the items */
activeKeys: string[];
/** inside sub menu in MainPageLayout */
subMenu?: MainPageLayoutItem[];
}

export const MainPageLayoutHorizontal: React.FC<MainPageLayoutHorizontalProps> = ({
onClick,
activeKeys,
subMenu,
children,
...restProps
}) => {
return (
<div className="main-horizontal-layout-container">
<MainPageNavHorizontal {...restProps} onClick={onClick} activeKeys={activeKeys} />
{subMenu && (
<div className="main-horizontal-layout-sub-menu-container">
<ul>
{subMenu.map(menuItem => {
return (
<li key={menuItem.key}>
<a
className={classNames("main-layout-sub-menu-item", {
"is-active": activeKeys.includes(menuItem.key),
})}
onClick={e => {
e.preventDefault();
onClick(menuItem);
}}
>
<span className="main-layout-sub-menu-item-icon">
{menuItem.icon(activeKeys.includes(menuItem.key))}
</span>
{menuItem.title}
</a>
</li>
);
})}
</ul>
</div>
)}
<div className="main-horizontal-layout-container-content fancy-scrollbar">
{children}
</div>
</div>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.main-horizontal-layout-container {
height: 100vh;
}

.main-horizontal-layout-container-content {
height: calc(100vh - 50px);
background-color: #f3f6f9;
}
1 change: 1 addition & 0 deletions packages/flat-components/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export * from "./components/InviteModal";
export * from "./components/LoadingPage";
export * from "./components/LoginPage";
export * from "./components/MainPageLayout";
export * from "./components/MainPageLayoutHorizontal";
export * from "./components/PeriodicRoomPage";
export * from "./components/RemoveRoomModal";
export * from "./components/RoomDetailPage";
Expand Down
50 changes: 49 additions & 1 deletion web/flat-web/src/AppRoutes/route-pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,54 @@ export const routePages: RoutePages = {
},
[RouteNameType.HomePage]: {
title: "Flat",
component: () => import("../pages/Homepage"),
component: () => import("../pages/HomePage"),
},
[RouteNameType.SmallClassPage]: {
title: "SmallClassPage",
component: () => Promise.resolve({ default: () => null }),
},
[RouteNameType.OneToOnePage]: {
title: "OneToOnePage",
component: () => Promise.resolve({ default: () => null }),
},
[RouteNameType.BigClassPage]: {
title: "BigClassPage",
component: () => Promise.resolve({ default: () => null }),
},
[RouteNameType.RoomDetailPage]: {
title: "RoomDetailPage",
component: () => Promise.resolve({ default: () => null }),
},
[RouteNameType.UserScheduledPage]: {
title: "UserScheduledPage",
component: () => Promise.resolve({ default: () => null }),
},
[RouteNameType.PeriodicRoomDetailPage]: {
title: "PeriodicRoomDetailPage",
component: () => Promise.resolve({ default: () => null }),
},
[RouteNameType.ReplayPage]: {
title: "ReplayPage",
component: () => Promise.resolve({ default: () => null }),
},
[RouteNameType.ModifyOrdinaryRoomPage]: {
title: "ModifyOrdinaryRoomPage",
component: () => Promise.resolve({ default: () => null }),
},
[RouteNameType.ModifyPeriodicRoomPage]: {
title: "ModifyPeriodicRoomPage",
component: () => Promise.resolve({ default: () => null }),
},
[RouteNameType.SystemCheckPage]: {
title: "SystemCheckPage",
component: () => Promise.resolve({ default: () => null }),
},
[RouteNameType.GeneralSettingPage]: {
title: "Flat",
component: () => Promise.resolve({ default: () => null }),
},
[RouteNameType.CloudStoragePage]: {
title: "Flat",
component: () => Promise.resolve({ default: () => null }),
},
};
17 changes: 17 additions & 0 deletions web/flat-web/src/assets/image/book.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions web/flat-web/src/assets/image/creat.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions web/flat-web/src/assets/image/join.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 92f9106

Please sign in to comment.