Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"less-loader": "^6.2.0",
"prop-types": "^15.7.2",
"react": "^16.13.1",
"react-app-rewired": "^2.1.6",
"react-app-rewired": "^2.1.9",
"react-dom": "^16.13.1",
"react-helmet": "^6.1.0",
"react-router": "^5.2.0",
Expand Down
12 changes: 7 additions & 5 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ import { renderRoutes } from 'react-router-config';
import { Switch, BrowserRouter } from 'react-router-dom';
import getRoutes from './routes';

const App = () => (
<BrowserRouter>
<Switch>{renderRoutes(getRoutes({ isLoggedUser: true }))}</Switch>
</BrowserRouter>
);
const App = function () {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete ·

return (
<BrowserRouter>
<Switch>{renderRoutes(getRoutes({ isLoggedUser: true }))}</Switch>
</BrowserRouter>
);
};

export default App;
34 changes: 18 additions & 16 deletions src/components/skeleton/content/Content.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,24 @@ import PropTypes from 'prop-types';

const { Content: AntContent } = Layout;

const Content = ({ children, matchedRoutes }) => (
<AntContent style={{ margin: '0 16px' }}>
<Breadcrumb style={{ margin: '16px 16px 0px 16px' }}>
{matchedRoutes.map(({ route }, idx) => (
<Breadcrumb.Item key={route.path}>
{idx === matchedRoutes.length - 1 ? (
route.title
) : (
<Link to={route.path}>{route.title}</Link>
)}
</Breadcrumb.Item>
))}
</Breadcrumb>
<div style={{ padding: 16 }}>{children}</div>
</AntContent>
);
const Content = function ({ children, matchedRoutes }) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unexpected unnamed function.

return (
<AntContent style={{ margin: '0 16px' }}>
<Breadcrumb style={{ margin: '16px 16px 0px 16px' }}>
{matchedRoutes.map(({ route }, idx) => (
<Breadcrumb.Item key={route.path}>
{idx === matchedRoutes.length - 1 ? (
route.title
) : (
<Link to={route.path}>{route.title}</Link>
)}
</Breadcrumb.Item>
))}
</Breadcrumb>
<div style={{ padding: 16 }}>{children}</div>
</AntContent>
);
};

Content.propTypes = {
children: PropTypes.oneOfType([
Expand Down
6 changes: 3 additions & 3 deletions src/components/skeleton/footer/Footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import PropTypes from 'prop-types';

const { Footer: AntFooter } = Layout;

const Footer = ({ footer }) => (
<AntFooter style={{ textAlign: 'center' }}>{footer}</AntFooter>
);
const Footer = function ({ footer }) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unexpected unnamed function.

return <AntFooter style={{ textAlign: 'center' }}>{footer}</AntFooter>;
};

Footer.propTypes = {
footer: PropTypes.string.isRequired,
Expand Down
34 changes: 18 additions & 16 deletions src/components/skeleton/header/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,25 @@ const avatarMenu = (
</Menu>
);

const Header = ({ isSiderCollapsed, onToggleSider }) => (
<AntHeader style={{ background: '#fff', padding: 0 }}>
<LegacyIcon
className="trigger"
type={isSiderCollapsed ? 'menu-unfold' : 'menu-fold'}
onClick={onToggleSider}
/>
<Dropdown overlay={avatarMenu} trigger={['click']}>
<Avatar
size="large"
shape="square"
className="avatar"
icon={<UserOutlined />}
const Header = function ({ isSiderCollapsed, onToggleSider }) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unexpected unnamed function.

return (
<AntHeader style={{ background: '#fff', padding: 0 }}>
<LegacyIcon
className="trigger"
type={isSiderCollapsed ? 'menu-unfold' : 'menu-fold'}
onClick={onToggleSider}
/>
</Dropdown>
</AntHeader>
);
<Dropdown overlay={avatarMenu} trigger={['click']}>
<Avatar
size="large"
shape="square"
className="avatar"
icon={<UserOutlined />}
/>
</Dropdown>
</AntHeader>
);
};

Header.propTypes = {
isSiderCollapsed: PropTypes.bool.isRequired,
Expand Down
2 changes: 1 addition & 1 deletion src/components/skeleton/layout/Layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import PropTypes from 'prop-types';
import { Footer, Sider, Header, Content } from '..';
import * as menuTypes from '../../../routes/menuTypes';

const Layout = ({ route, location }) => {
const Layout = function ({ route, location }) {
const { routes } = route;
const { pathname } = location;
const children = renderRoutes(routes);
Expand Down
2 changes: 1 addition & 1 deletion src/components/skeleton/sider/Sider.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import './Sider.css';
const { Sider: AntSider } = Layout;
const { SubMenu, Item } = Menu;

const Sider = ({ isCollapsed, mainMenuRoutes, matchedRoutes }) => {
const Sider = function ({ isCollapsed, mainMenuRoutes, matchedRoutes }) {
const activeKeys = matchedRoutes.map((item) => item.route.name);

return (
Expand Down
8 changes: 4 additions & 4 deletions src/pages/Home.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import { Statistic, Card, Row, Col, Avatar, Button, Calendar } from 'antd';

const { Meta } = Card;

export default () => (
<>
export default function () {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function default has 59 lines of code (exceeds 25 allowed). Consider refactoring.

return (
<Row gutter={16} style={{ marginBottom: 20 }}>
<Col span={4}>
<Card
Expand Down Expand Up @@ -68,5 +68,5 @@ export default () => (
</Card>
</Col>
</Row>
</>
);
);
}
4 changes: 2 additions & 2 deletions src/pages/UserSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Security from './user-configs/Security';

const { TabPane } = Tabs;

export default () => {
export default function () {
return (
<Card bodyStyle={{ paddingLeft: 0 }}>
<Tabs defaultActiveKey="1" tabPosition="left">
Expand All @@ -23,4 +23,4 @@ export default () => {
</Tabs>
</Card>
);
};
}
5 changes: 1 addition & 4 deletions src/routes/withHelmet.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ const withHelmet = (Component) => {
const routeComponent = ({ route, ...props }) => (
<>
<Helmet>
<link
rel="shortcut icon"
href={route.title || 'favicons/favicon-32x32.png'}
/>
<link rel="icon" href={route.title || 'favicons/favicon-32x32.png'} />
<title>{route.title}</title>
</Helmet>
<Component {...props} route={route} />
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10606,10 +10606,10 @@ react-app-polyfill@^1.0.6:
regenerator-runtime "^0.13.3"
whatwg-fetch "^3.0.0"

react-app-rewired@^2.1.6:
version "2.1.6"
resolved "https://registry.yarnpkg.com/react-app-rewired/-/react-app-rewired-2.1.6.tgz#33ee3076a7f34d6a7c94e649cac67e7c8c580de8"
integrity sha512-06flj0kK5tf/RN4naRv/sn6j3sQd7rsURoRLKLpffXDzJeNiAaTNic+0I8Basojy5WDwREkTqrMLewSAjcb13w==
react-app-rewired@^2.1.9:
version "2.1.9"
resolved "https://registry.yarnpkg.com/react-app-rewired/-/react-app-rewired-2.1.9.tgz#20c432c6414d354547e232c4fa1ac1112615ca3e"
integrity sha512-eOIRsDXbRCA9x+vIABS+VFBXO78bUbZ1pIyOuAkbP0Y6NEfbr4v9lHAyGsix4DxNcKpPqKYtvDKKlbOxMUCxlw==
dependencies:
semver "^5.6.0"

Expand Down