From ca314bbfb59917dccbf6018c24a59f02ee4fe225 Mon Sep 17 00:00:00 2001 From: Yaodong Yu <2814461814@qq.com> Date: Tue, 6 Dec 2022 00:50:17 +0800 Subject: [PATCH] feat: refactor layout and fix footer CSS (#1370) --- web/src/App.js | 147 ++++++++++++++++++------------------- web/src/App.less | 30 ++------ web/src/Setting.js | 4 +- web/src/auth/ForgetPage.js | 2 +- web/src/auth/LoginPage.js | 6 +- web/src/auth/SignupPage.js | 33 ++++----- 6 files changed, 103 insertions(+), 119 deletions(-) diff --git a/web/src/App.js b/web/src/App.js index 56093eef..1cd70912 100644 --- a/web/src/App.js +++ b/web/src/App.js @@ -76,7 +76,7 @@ import AdapterListPage from "./AdapterListPage"; import AdapterEditPage from "./AdapterEditPage"; import {withTranslation} from "react-i18next"; -const {Header, Footer} = Layout; +const {Header, Footer, Content} = Layout; class App extends Component { constructor(props) { @@ -537,44 +537,45 @@ class App extends Component { renderContent() { if (!Setting.isMobile()) { return ( -
- -
+ +
+ { + Setting.isMobile() ? null : ( + +
+ + ) + } +
+ + { - Setting.isMobile() ? null : ( - -
- - ) + this.renderAccount() } -
- - - { - this.renderAccount() - } - {this.state.account && } -
-
- - - { - this.renderRouter() - } - - -
-
+ {this.state.account && } + + + + + { + this.renderRouter() + } + + + { + this.renderFooter() + } + ); } else { return ( -
+
{ Setting.isMobile() ? null : ( @@ -604,10 +605,11 @@ class App extends Component { {this.state.account && }
- { - this.renderRouter() - } - + { + this.renderRouter()} + + {this.renderFooter()} + ); } } @@ -644,50 +646,47 @@ class App extends Component { renderPage() { if (this.isDoorPages()) { return ( -
-
- - this.renderHomeIfLoggedIn()} /> - this.renderHomeIfLoggedIn( {this.onUpdateAccount(account);}} />)} /> - this.renderHomeIfLoggedIn()} /> - this.renderHomeIfLoggedIn()} /> - {this.onUpdateAccount(account);}} />} /> - {this.onUpdateAccount(account);}} />} /> - {this.onUpdateAccount(account);}} />} /> - {this.onUpdateAccount(account);}} />} /> - this.renderHomeIfLoggedIn( this.setState({account: null})} {...props} />)} /> - {return ();}} /> - - - this.renderHomeIfLoggedIn()} /> - this.renderHomeIfLoggedIn()} /> - this.renderLoginIfNotLoggedIn()} /> - this.renderLoginIfNotLoggedIn( {this.onUpdateAccount(account);}} {...props} />)} /> - this.renderLoginIfNotLoggedIn()} /> - } />} /> - -
- { - this.renderFooter() - } -
+ <> + + + + this.renderHomeIfLoggedIn()} /> + this.renderHomeIfLoggedIn( {this.onUpdateAccount(account);}} />)} /> + this.renderHomeIfLoggedIn()} /> + this.renderHomeIfLoggedIn()} /> + {this.onUpdateAccount(account);}} />} /> + {this.onUpdateAccount(account);}} />} /> + {this.onUpdateAccount(account);}} />} /> + {this.onUpdateAccount(account);}} />} /> + this.renderHomeIfLoggedIn( this.setState({account: null})} {...props} />)} /> + {return ();}} /> + + + this.renderHomeIfLoggedIn()} /> + this.renderHomeIfLoggedIn()} /> + this.renderLoginIfNotLoggedIn()} /> + this.renderLoginIfNotLoggedIn( {this.onUpdateAccount(account);}} {...props} />)} /> + this.renderLoginIfNotLoggedIn()} /> + } />} /> + + + { + this.renderFooter() + } + + ); } return ( -
+ <> -
- { - this.renderContent() - } -
{ - this.renderFooter() + this.renderContent() } -
+ ); } diff --git a/web/src/App.less b/web/src/App.less index 5fd1f829..f6662b79 100644 --- a/web/src/App.less +++ b/web/src/App.less @@ -27,15 +27,15 @@ color: #61dafb; } -#root { - height: 100%; -} - img { border-style: none; vertical-align: middle; } +#root { + height: 100%; +} + #parent-area { display: flex; flex-direction: column; @@ -44,23 +44,8 @@ img { background-color: #f5f5f5; } -#content-wrap { - display: flex; - flex: 1 1 0; - align-items: stretch; - width: 100%; -} - -#login-content-wrap { - display: flex; - flex: 1 1 0; - width: 100%; -} - -#footer { - bottom: 0; - width: 100%; - padding: 24px 50px; +.panel-logo { + margin-bottom: 30px; } .language-box { @@ -105,6 +90,7 @@ img { .forget-content { padding: 10px 100px 20px; + margin: 30px auto; border: 2px solid #fff; border-radius: 7px; background-color: rgb(255 255 255); @@ -135,9 +121,9 @@ img { } .loginBackground { + flex: auto; display: flex; align-items: center; - flex: 1 1 0; background: #fff no-repeat; background-size: 100% 100%; background-attachment: fixed; diff --git a/web/src/Setting.js b/web/src/Setting.js index 9bd04a0f..1b8c6e2e 100644 --- a/web/src/Setting.js +++ b/web/src/Setting.js @@ -732,12 +732,12 @@ export function renderLogo(application) { if (application.homepageUrl !== "") { return ( - {application.displayName} + {application.displayName} ); } else { return ( - {application.displayName} + {application.displayName} ); } } diff --git a/web/src/auth/ForgetPage.js b/web/src/auth/ForgetPage.js index c8811ce6..e17faf84 100644 --- a/web/src/auth/ForgetPage.js +++ b/web/src/auth/ForgetPage.js @@ -492,7 +492,7 @@ class ForgetPage extends React.Component { return (
-
+
diff --git a/web/src/auth/LoginPage.js b/web/src/auth/LoginPage.js index 8477dae4..b1f5c141 100644 --- a/web/src/auth/LoginPage.js +++ b/web/src/auth/LoginPage.js @@ -361,7 +361,7 @@ class LoginPage extends React.Component { size="large" >

{ diff --git a/web/src/auth/SignupPage.js b/web/src/auth/SignupPage.js index 27ab3f5c..bc9c8f1b 100644 --- a/web/src/auth/SignupPage.js +++ b/web/src/auth/SignupPage.js @@ -42,7 +42,7 @@ const formItemLayout = { span: 24, }, sm: { - span: 18, + span: 16, }, }, }; @@ -563,12 +563,13 @@ class SignupPage extends React.Component { application: application.name, organization: application.organization, }} - style={{width: !Setting.isMobile() ? "400px" : "300px"}} size="large" + layout={Setting.isMobile() ? "vertical" : "horizontal"} + style={{width: Setting.isMobile() ? "300px" : "400px"}} >