-
Notifications
You must be signed in to change notification settings - Fork 825
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(flat-web): add HomePage to Flat-web (#702)
- Loading branch information
Showing
30 changed files
with
1,452 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
packages/flat-components/src/components/MainPageLayoutHorizontal/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
); | ||
}; |
8 changes: 8 additions & 0 deletions
8
packages/flat-components/src/components/MainPageLayoutHorizontal/style.less
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions
12
...at-web/src/components/MainPageLayoutHorizontalContainer/icons/device-active.svg
Loading
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
15
web/flat-web/src/components/MainPageLayoutHorizontalContainer/icons/device.svg
Loading
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
15
web/flat-web/src/components/MainPageLayoutHorizontalContainer/icons/feedback.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions
18
web/flat-web/src/components/MainPageLayoutHorizontalContainer/icons/github.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions
17
web/flat-web/src/components/MainPageLayoutHorizontalContainer/icons/logout.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions
16
web/flat-web/src/components/MainPageLayoutHorizontalContainer/icons/setting.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.