-
Notifications
You must be signed in to change notification settings - Fork 828
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(flat-components): add LoadingPage
- Loading branch information
Showing
18 changed files
with
66 additions
and
42 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
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
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
7 changes: 3 additions & 4 deletions
7
desktop/renderer-app/src/pages/PeriodicRoomDetailPage/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
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
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
21 changes: 21 additions & 0 deletions
21
packages/flat-components/src/components/LoadingPage/LoadingPage.stories.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,21 @@ | ||
import { Meta, Story } from "@storybook/react"; | ||
import faker from "faker"; | ||
import React from "react"; | ||
import { BrowserRouter as Router } from "react-router-dom"; | ||
import { LoadingPage, LoadingPageProps } from "."; | ||
|
||
const storyMeta: Meta = { | ||
title: "LoadingPage/LoadingPage", | ||
component: LoadingPage, | ||
}; | ||
|
||
export default storyMeta; | ||
|
||
export const Overview: Story<LoadingPageProps> = args => ( | ||
<Router> | ||
<LoadingPage {...args} /> | ||
</Router> | ||
); | ||
Overview.args = { | ||
text: faker.random.words(), | ||
}; |
Binary file added
BIN
+41.3 KB
packages/flat-components/src/components/LoadingPage/icons/loading.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 11 additions & 16 deletions
27
desktop/renderer-app/src/LoadingPage.tsx → ...ents/src/components/LoadingPage/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 |
---|---|---|
@@ -1,44 +1,39 @@ | ||
import loading from "./assets/image/loading.gif"; | ||
import "./LoadingPage.less"; | ||
import "./style.less"; | ||
import loadingGIF from "./icons/loading.gif"; | ||
|
||
import React, { FC, useEffect, useState } from "react"; | ||
import { Button } from "antd"; | ||
import { Link } from "react-router-dom"; | ||
import classNames from "classnames"; | ||
import { Link } from "react-router-dom"; | ||
import { useTranslation } from "react-i18next"; | ||
|
||
export interface LoadingPageProps { | ||
text?: string; | ||
} | ||
|
||
export const LoadingPage: FC<LoadingPageProps> = ({ text }) => { | ||
const [isShowReturnHomePage, showReturnHomePage] = useState(false); | ||
const { t } = useTranslation(); | ||
|
||
useEffect(() => { | ||
const ticket = window.setTimeout(() => { | ||
showReturnHomePage(true); | ||
}, 20000); | ||
|
||
return () => { | ||
window.clearTimeout(ticket); | ||
}; | ||
const ticket = window.setTimeout(() => showReturnHomePage(true), 20000); | ||
return () => window.clearTimeout(ticket); | ||
}, []); | ||
|
||
return ( | ||
<div className="loading-page-container"> | ||
<div className="loading-page"> | ||
<div className="loading-page-content"> | ||
<img className="loading-page-image" src={loading} alt={"loading"} /> | ||
<img className="loading-page-image" src={loadingGIF} alt="loading" /> | ||
{text && <span>{text}</span>} | ||
</div> | ||
<Link | ||
to={"/"} | ||
to="/" | ||
className={classNames("loading-page-return-btn", { | ||
"is-show": isShowReturnHomePage, | ||
})} | ||
> | ||
<Button size="large">返回首页</Button> | ||
<Button size="large">{t("return-home")}</Button> | ||
</Link> | ||
</div> | ||
); | ||
}; | ||
|
||
export default LoadingPage; |
2 changes: 1 addition & 1 deletion
2
desktop/renderer-app/src/LoadingPage.less → ...nts/src/components/LoadingPage/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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
.loading-page-container { | ||
.loading-page { | ||
width: 100%; | ||
height: 100%; | ||
display: flex; | ||
|
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
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