Skip to content

Commit 23a687b

Browse files
committed
Code refactoring
1 parent 76a4543 commit 23a687b

File tree

3 files changed

+23
-24
lines changed

3 files changed

+23
-24
lines changed

reactjs/src/components/Header/index.tsx

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,13 @@ export class Header extends React.Component<IHeaderProps> {
2626
return (
2727
<React.Fragment>
2828
<Col style={{ textAlign: 'left' }} span={12}>
29-
<Icon
30-
style={{ marginTop: 10, marginRight: 10, textAlign: 'left' }}
31-
className="trigger"
32-
type={this.props.collapsed ? 'menu-unfold' : 'menu-fold'}
33-
onClick={this.props.toggle}
34-
/>
29+
<Icon className="trigger" type={this.props.collapsed ? 'menu-unfold' : 'menu-fold'} onClick={this.props.toggle} />
3530
</Col>
36-
<Col style={{ margin: 15, marginLeft: 10, textAlign: 'right' }}>
37-
<LanguageSelect />
31+
<Col style={{ margin: '0px 15px 0px 15px', marginLeft: 10, textAlign: 'right' }}>
32+
<LanguageSelect /> {' '}
3833
<Dropdown overlay={userDropdownMenu} trigger={['click']}>
39-
<Badge style={{ margin: 10 }} count={3}>
40-
<Avatar style={{ margin: 10 }} size={48} alt={'profile'} src="https://sametkabay.com/images/smtkby/smtkby240.png" />
34+
<Badge style={{}} count={3}>
35+
<Avatar style={{}} size={24} alt={'profile'} src="https://sametkabay.com/images/smtkby/smtkby240.png" />
4136
</Badge>
4237
</Dropdown>
4338
</Col>

reactjs/src/components/Layout/AppLayout.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ class AppLayout extends React.Component<any> {
3838

3939
const layout = (
4040
<Layout style={{ minHeight: '100vh' }}>
41-
<SiderMenu path={path} onCollapse={this.onCollapse} history={history} collapsed={collapsed} />;
41+
<SiderMenu path={path} onCollapse={this.onCollapse} history={history} collapsed={collapsed} />
4242
<Layout>
43-
<Layout.Header style={{ background: '#fff', minHeight: 83, padding: 0 }}>
43+
<Layout.Header style={{ background: '#fff', minHeight: 52, padding: 0 }}>
4444
<Header collapsed={this.state.collapsed} toggle={this.toggle} />
4545
</Layout.Header>
4646
<Content style={{ margin: '0 16px' }}>

reactjs/src/components/Layout/UserLayout.tsx

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ import utils from 'src/utils/utils';
55
import { userRouter } from '../Router/router.config';
66
import { Col } from 'antd';
77
// import "./UserLayout.css";
8-
import "./UserLayout.less";
8+
import './UserLayout.less';
99
import Footer from '../Footer';
10+
import LanguageSelect from '../LanguageSelect';
1011

1112
class UserLayout extends React.Component<any> {
1213
render() {
@@ -15,18 +16,21 @@ class UserLayout extends React.Component<any> {
1516
} = this.props;
1617
return (
1718
<DocumentTitle title={utils.getPageTitle(pathname)}>
18-
<Col className="container">
19-
<Switch>
20-
{userRouter
21-
.filter((item: any) => !item.isLayout)
22-
.map((item: any, index: number) => (
23-
<Route key={index} path={item.path} component={item.component} exact={item.exact} />
24-
))}
19+
<Col className="container">
20+
<div className={'lang'}>
21+
<LanguageSelect />
22+
</div>
23+
<Switch>
24+
{userRouter
25+
.filter((item: any) => !item.isLayout)
26+
.map((item: any, index: number) => (
27+
<Route key={index} path={item.path} component={item.component} exact={item.exact} />
28+
))}
2529

26-
<Redirect from="/user" to="/user/login" />
27-
</Switch>
28-
<Footer/>
29-
</Col>
30+
<Redirect from="/user" to="/user/login" />
31+
</Switch>
32+
<Footer />
33+
</Col>
3034
</DocumentTitle>
3135
);
3236
}

0 commit comments

Comments
 (0)