diff --git a/CHANGELOG.md b/CHANGELOG.md index 2cbd874..29234ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ ## [CoreUI](https://coreui.io/) for [react](./REACT.md) changelog +##### `v2.1.1` +- refactor(App.js): code splitting with `react-loadable` (waiting for release of `react-router-dom`) +- refactor(routes.js): code splitting with `React.lazy`, remove `react-loadable` +- refactor(DefaultLayout): code splitting with `React.lazy` Aside, Footer, Header, routes +- refactor(Dashboard): tweak lazy and Suspense for Widget03 +- refactor(Login): add router link to `Register` button +- refactor(Register): add margins to social-media buttons +- chore: disable eslint warning for href="#" attribute +- chore: update `@coreui/coreui` to `^2.1.1` +- chore: update `enzyme-adapter-react-16` to `1.7.0` +- chore: update `react` to `16.6.3` +- chore: update `react-dom` to `16.6.3` +- chore: update `react-test-renderer` to `16.6.3` + ##### `v2.1.0` - feat(SidebarNav): navLink `attributes` - optional JS object with valid JS API naming: - valid attributes: `rel`, `target`, `hidden`, `disabled`, etc... diff --git a/package.json b/package.json index fec002e..ba2e7ca 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@coreui/coreui-free-react-admin-template", - "version": "2.1.0", + "version": "2.1.1", "description": "CoreUI React Open Source Bootstrap 4 Admin Template", "author": "Ɓukasz Holeczek", "homepage": "https://coreui.io", @@ -12,7 +12,7 @@ "url": "git@github.com:coreui/coreui-free-react-admin-template.git" }, "dependencies": { - "@coreui/coreui": "^2.1.0", + "@coreui/coreui": "^2.1.1", "@coreui/coreui-plugin-chartjs-custom-tooltips": "^1.2.0", "@coreui/icons": "0.3.0", "@coreui/react": "^2.1.0", @@ -21,19 +21,19 @@ "classnames": "^2.2.6", "core-js": "^2.5.7", "enzyme": "^3.7.0", - "enzyme-adapter-react-16": "^1.6.0", + "enzyme-adapter-react-16": "^1.7.0", "flag-icon-css": "^3.2.1", "font-awesome": "^4.7.0", "node-sass": "^4.10.0", "prop-types": "^15.6.2", - "react": "^16.6.1", + "react": "^16.6.3", "react-app-polyfill": "^0.1.3", "react-chartjs-2": "^2.7.2", - "react-dom": "^16.6.1", + "react-dom": "^16.6.3", "react-loadable": "^5.5.0", "react-router-config": "^4.4.0-beta.6", "react-router-dom": "^4.3.1", - "react-test-renderer": "^16.6.1", + "react-test-renderer": "^16.6.3", "reactstrap": "^6.5.0", "simple-line-icons": "^2.4.1" }, diff --git a/src/App.js b/src/App.js index bde3499..9744ed1 100644 --- a/src/App.js +++ b/src/App.js @@ -1,25 +1,50 @@ import React, { Component } from 'react'; import { HashRouter, Route, Switch } from 'react-router-dom'; +// import { renderRoutes } from 'react-router-config'; +import Loadable from 'react-loadable'; import './App.scss'; -// Containers -import { DefaultLayout } from './containers'; -// Pages -import { Login, Page404, Page500, Register } from './views/Pages'; +const loading = () =>
Loading...
; -// import { renderRoutes } from 'react-router-config'; +// Containers +const DefaultLayout = Loadable({ + loader: () => import('./containers/DefaultLayout'), + loading +}); + +// Pages +const Login = Loadable({ + loader: () => import('./views/Pages/Login'), + loading +}); + +const Register = Loadable({ + loader: () => import('./views/Pages/Register'), + loading +}); + +const Page404 = Loadable({ + loader: () => import('./views/Pages/Page404'), + loading +}); + +const Page500 = Loadable({ + loader: () => import('./views/Pages/Page500'), + loading +}); class App extends Component { + render() { return ( - - - - - - - + + + + + + + ); } diff --git a/src/containers/DefaultLayout/DefaultHeader.js b/src/containers/DefaultLayout/DefaultHeader.js index d1e2a1c..f4d856b 100644 --- a/src/containers/DefaultLayout/DefaultHeader.js +++ b/src/containers/DefaultLayout/DefaultHeader.js @@ -1,4 +1,5 @@ import React, { Component } from 'react'; +import { Link } from 'react-router-dom'; import { Badge, DropdownItem, DropdownMenu, DropdownToggle, Nav, NavItem, NavLink } from 'reactstrap'; import PropTypes from 'prop-types'; @@ -32,7 +33,7 @@ class DefaultHeader extends Component { Dashboard - Users + Users Settings @@ -50,7 +51,7 @@ class DefaultHeader extends Component { - admin@bootstrapmaster.com + admin@bootstrapmaster.com Account @@ -65,7 +66,7 @@ class DefaultHeader extends Component { Projects42 Lock Account - Logout + this.props.onLogout(e)}> Logout diff --git a/src/containers/DefaultLayout/DefaultLayout.js b/src/containers/DefaultLayout/DefaultLayout.js index 57aad02..72f3a4a 100644 --- a/src/containers/DefaultLayout/DefaultLayout.js +++ b/src/containers/DefaultLayout/DefaultLayout.js @@ -1,4 +1,4 @@ -import React, { Component } from 'react'; +import React, { Component, Suspense } from 'react'; import { Redirect, Route, Switch } from 'react-router-dom'; import { Container } from 'reactstrap'; @@ -18,46 +18,70 @@ import { import navigation from '../../_nav'; // routes config import routes from '../../routes'; -import DefaultAside from './DefaultAside'; -import DefaultFooter from './DefaultFooter'; -import DefaultHeader from './DefaultHeader'; + +const DefaultAside = React.lazy(() => import('./DefaultAside')); +const DefaultFooter = React.lazy(() => import('./DefaultFooter')); +const DefaultHeader = React.lazy(() => import('./DefaultHeader')); class DefaultLayout extends Component { + + loading = () =>
Loading...
+ + signOut(e) { + e.preventDefault() + this.props.history.push('/login') + } + render() { return (
- + + this.signOut(e)}/> +
+ +
- - {routes.map((route, idx) => { - return route.component ? ( ( - - )} />) - : (null); - }, - )} - - + + + {routes.map((route, idx) => { + return route.component ? ( + ( + + )} /> + ) : (null); + })} + + +
- + + +
- + + +
); diff --git a/src/routes.js b/src/routes.js index cf06b50..e45082b 100644 --- a/src/routes.js +++ b/src/routes.js @@ -1,188 +1,41 @@ import React from 'react'; -import Loadable from 'react-loadable' - import DefaultLayout from './containers/DefaultLayout'; -function Loading() { - return
Loading...
; -} - -const Breadcrumbs = Loadable({ - loader: () => import('./views/Base/Breadcrumbs'), - loading: Loading, -}); - -const Cards = Loadable({ - loader: () => import('./views/Base/Cards'), - loading: Loading, -}); - -const Carousels = Loadable({ - loader: () => import('./views/Base/Carousels'), - loading: Loading, -}); - -const Collapses = Loadable({ - loader: () => import('./views/Base/Collapses'), - loading: Loading, -}); - -const Dropdowns = Loadable({ - loader: () => import('./views/Base/Dropdowns'), - loading: Loading, -}); - -const Forms = Loadable({ - loader: () => import('./views/Base/Forms'), - loading: Loading, -}); - -const Jumbotrons = Loadable({ - loader: () => import('./views/Base/Jumbotrons'), - loading: Loading, -}); - -const ListGroups = Loadable({ - loader: () => import('./views/Base/ListGroups'), - loading: Loading, -}); - -const Navbars = Loadable({ - loader: () => import('./views/Base/Navbars'), - loading: Loading, -}); - -const Navs = Loadable({ - loader: () => import('./views/Base/Navs'), - loading: Loading, -}); - -const Paginations = Loadable({ - loader: () => import('./views/Base/Paginations'), - loading: Loading, -}); - -const Popovers = Loadable({ - loader: () => import('./views/Base/Popovers'), - loading: Loading, -}); - -const ProgressBar = Loadable({ - loader: () => import('./views/Base/ProgressBar'), - loading: Loading, -}); - -const Switches = Loadable({ - loader: () => import('./views/Base/Switches'), - loading: Loading, -}); - -const Tables = Loadable({ - loader: () => import('./views/Base/Tables'), - loading: Loading, -}); - -const Tabs = Loadable({ - loader: () => import('./views/Base/Tabs'), - loading: Loading, -}); - -const Tooltips = Loadable({ - loader: () => import('./views/Base/Tooltips'), - loading: Loading, -}); - -const BrandButtons = Loadable({ - loader: () => import('./views/Buttons/BrandButtons'), - loading: Loading, -}); - -const ButtonDropdowns = Loadable({ - loader: () => import('./views/Buttons/ButtonDropdowns'), - loading: Loading, -}); - -const ButtonGroups = Loadable({ - loader: () => import('./views/Buttons/ButtonGroups'), - loading: Loading, -}); - -const Buttons = Loadable({ - loader: () => import('./views/Buttons/Buttons'), - loading: Loading, -}); - -const Charts = Loadable({ - loader: () => import('./views/Charts'), - loading: Loading, -}); - -const Dashboard = Loadable({ - loader: () => import('./views/Dashboard'), - loading: Loading, -}); - -const CoreUIIcons = Loadable({ - loader: () => import('./views/Icons/CoreUIIcons'), - loading: Loading, -}); - -const Flags = Loadable({ - loader: () => import('./views/Icons/Flags'), - loading: Loading, -}); - -const FontAwesome = Loadable({ - loader: () => import('./views/Icons/FontAwesome'), - loading: Loading, -}); - -const SimpleLineIcons = Loadable({ - loader: () => import('./views/Icons/SimpleLineIcons'), - loading: Loading, -}); - -const Alerts = Loadable({ - loader: () => import('./views/Notifications/Alerts'), - loading: Loading, -}); - -const Badges = Loadable({ - loader: () => import('./views/Notifications/Badges'), - loading: Loading, -}); - -const Modals = Loadable({ - loader: () => import('./views/Notifications/Modals'), - loading: Loading, -}); - -const Colors = Loadable({ - loader: () => import('./views/Theme/Colors'), - loading: Loading, -}); - -const Typography = Loadable({ - loader: () => import('./views/Theme/Typography'), - loading: Loading, -}); - -const Widgets = Loadable({ - loader: () => import('./views/Widgets/Widgets'), - loading: Loading, -}); - -const Users = Loadable({ - loader: () => import('./views/Users/Users'), - loading: Loading, -}); - -const User = Loadable({ - loader: () => import('./views/Users/User'), - loading: Loading, -}); - - +const Breadcrumbs = React.lazy(() => import('./views/Base/Breadcrumbs')); +const Cards = React.lazy(() => import('./views/Base/Cards')); +const Carousels = React.lazy(() => import('./views/Base/Carousels')); +const Collapses = React.lazy(() => import('./views/Base/Collapses')); +const Dropdowns = React.lazy(() => import('./views/Base/Dropdowns')); +const Forms = React.lazy(() => import('./views/Base/Forms')); +const Jumbotrons = React.lazy(() => import('./views/Base/Jumbotrons')); +const ListGroups = React.lazy(() => import('./views/Base/ListGroups')); +const Navbars = React.lazy(() => import('./views/Base/Navbars')); +const Navs = React.lazy(() => import('./views/Base/Navs')); +const Paginations = React.lazy(() => import('./views/Base/Paginations')); +const Popovers = React.lazy(() => import('./views/Base/Popovers')); +const ProgressBar = React.lazy(() => import('./views/Base/ProgressBar')); +const Switches = React.lazy(() => import('./views/Base/Switches')); +const Tables = React.lazy(() => import('./views/Base/Tables')); +const Tabs = React.lazy(() => import('./views/Base/Tabs')); +const Tooltips = React.lazy(() => import('./views/Base/Tooltips')); +const BrandButtons = React.lazy(() => import('./views/Buttons/BrandButtons')); +const ButtonDropdowns = React.lazy(() => import('./views/Buttons/ButtonDropdowns')); +const ButtonGroups = React.lazy(() => import('./views/Buttons/ButtonGroups')); +const Buttons = React.lazy(() => import('./views/Buttons/Buttons')); +const Charts = React.lazy(() => import('./views/Charts')); +const Dashboard = React.lazy(() => import('./views/Dashboard')); +const CoreUIIcons = React.lazy(() => import('./views/Icons/CoreUIIcons')); +const Flags = React.lazy(() => import('./views/Icons/Flags')); +const FontAwesome = React.lazy(() => import('./views/Icons/FontAwesome')); +const SimpleLineIcons = React.lazy(() => import('./views/Icons/SimpleLineIcons')); +const Alerts = React.lazy(() => import('./views/Notifications/Alerts')); +const Badges = React.lazy(() => import('./views/Notifications/Badges')); +const Modals = React.lazy(() => import('./views/Notifications/Modals')); +const Colors = React.lazy(() => import('./views/Theme/Colors')); +const Typography = React.lazy(() => import('./views/Theme/Typography')); +const Widgets = React.lazy(() => import('./views/Widgets/Widgets')); +const Users = React.lazy(() => import('./views/Users/Users')); +const User = React.lazy(() => import('./views/Users/User')); // https://github.com/ReactTraining/react-router/tree/master/packages/react-router-config const routes = [ diff --git a/src/views/Base/Breadcrumbs/Breadcrumbs.js b/src/views/Base/Breadcrumbs/Breadcrumbs.js index af3a2cc..9b78f2f 100644 --- a/src/views/Base/Breadcrumbs/Breadcrumbs.js +++ b/src/views/Base/Breadcrumbs/Breadcrumbs.js @@ -21,11 +21,14 @@ class Breadcrumbs extends Component { Home + {/*eslint-disable-next-line*/} Home Library + {/*eslint-disable-next-line*/} Home + {/* eslint-disable-next-line*/} Library Data diff --git a/src/views/Base/Cards/Cards.js b/src/views/Base/Cards/Cards.js index 1082869..3690956 100644 --- a/src/views/Base/Cards/Cards.js +++ b/src/views/Base/Cards/Cards.js @@ -388,8 +388,11 @@ class Cards extends Component { Card actions
+ {/*eslint-disable-next-line*/} + {/*eslint-disable-next-line*/} + {/*eslint-disable-next-line*/}
diff --git a/src/views/Base/Tooltips/Tooltips.js b/src/views/Base/Tooltips/Tooltips.js index 27c6378..c3a7d8c 100644 --- a/src/views/Base/Tooltips/Tooltips.js +++ b/src/views/Base/Tooltips/Tooltips.js @@ -82,6 +82,7 @@ class Tooltips extends Component { + {/*eslint-disable-next-line*/}

Somewhere in here is a tooltip.

{this.toggle(0);}}> Hello world! @@ -94,6 +95,7 @@ class Tooltips extends Component { disable autohide + {/*eslint-disable-next-line*/}

Sometimes you need to allow users to select text within a tooltip.

{this.toggle(1);}}> Try to select this text! @@ -117,6 +119,7 @@ class Tooltips extends Component { uncontrolled + {/*eslint-disable-next-line*/}

Somewhere in here is a tooltip.

Hello world! @@ -128,4 +131,4 @@ class Tooltips extends Component { } } -export default Tooltips; \ No newline at end of file +export default Tooltips; diff --git a/src/views/Dashboard/Dashboard.js b/src/views/Dashboard/Dashboard.js index fdf0849..f0521a7 100644 --- a/src/views/Dashboard/Dashboard.js +++ b/src/views/Dashboard/Dashboard.js @@ -23,9 +23,7 @@ import { import { CustomTooltips } from '@coreui/coreui-plugin-chartjs-custom-tooltips'; import { getStyle, hexToRgba } from '@coreui/coreui/dist/js/coreui-utilities' -// import Widget03 from '../../views/Widgets/Widget03' const Widget03 = lazy(() => import('../../views/Widgets/Widget03')); -const Loading = () =>
Loading...
const brandPrimary = getStyle('--primary') const brandSuccess = getStyle('--success') @@ -479,6 +477,8 @@ class Dashboard extends Component { }); } + loading = () =>
Loading...
+ render() { return ( @@ -640,7 +640,7 @@ class Dashboard extends Component { - + ({ variant: 'facebook', friends: '89k', feeds: '459' })} >
@@ -650,7 +650,7 @@ class Dashboard extends Component { - + ({ variant: 'twitter', followers: '973k', tweets: '1.792' })} >
@@ -660,7 +660,7 @@ class Dashboard extends Component { - + ({ variant: 'linkedin', contacts: '500+', feeds: '292' })} >
@@ -670,24 +670,13 @@ class Dashboard extends Component { -
-
- + + ({ variant: 'google-plus', followers: '894', circles: '92' })} >
-
-
-
-
894
-
followers
-
-
-
92
-
circles
-
-
-
+ + diff --git a/src/views/Notifications/Alerts/Alerts.js b/src/views/Notifications/Alerts/Alerts.js index 9790c33..db1d63a 100644 --- a/src/views/Notifications/Alerts/Alerts.js +++ b/src/views/Notifications/Alerts/Alerts.js @@ -66,27 +66,35 @@ class Alerts extends Component { + {/*eslint-disable-next-line*/} This is a primary alert with an example link. Give it a click if you like. + {/*eslint-disable-next-line*/} This is a secondary alert with an example link. Give it a click if you like. + {/*eslint-disable-next-line*/} This is a success alert with an example link. Give it a click if you like. + {/*eslint-disable-next-line*/} This is a danger alert with an example link. Give it a click if you like. + {/*eslint-disable-next-line*/} This is a warning alert with an example link. Give it a click if you like. + {/*eslint-disable-next-line*/} This is a info alert with an example link. Give it a click if you like. + {/*eslint-disable-next-line*/} This is a light alert with an example link. Give it a click if you like. + {/*eslint-disable-next-line*/} This is a dark alert with an example link. Give it a click if you like. diff --git a/src/views/Pages/Login/Login.js b/src/views/Pages/Login/Login.js index a296f7d..faf1d9b 100644 --- a/src/views/Pages/Login/Login.js +++ b/src/views/Pages/Login/Login.js @@ -1,4 +1,5 @@ import React, { Component } from 'react'; +import { Link } from 'react-router-dom'; import { Button, Card, CardBody, CardGroup, Col, Container, Form, Input, InputGroup, InputGroupAddon, InputGroupText, Row } from 'reactstrap'; class Login extends Component { @@ -41,13 +42,15 @@ class Login extends Component { - +

Sign up

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

- + + +
diff --git a/src/views/Pages/Register/Register.js b/src/views/Pages/Register/Register.js index cecc651..c355535 100644 --- a/src/views/Pages/Register/Register.js +++ b/src/views/Pages/Register/Register.js @@ -7,7 +7,7 @@ class Register extends Component {
- +
@@ -49,10 +49,10 @@ class Register extends Component { - + - + diff --git a/src/views/Users/Users.js b/src/views/Users/Users.js index af203f6..6574429 100644 --- a/src/views/Users/Users.js +++ b/src/views/Users/Users.js @@ -1,11 +1,12 @@ import React, { Component } from 'react'; +import { Link } from 'react-router-dom'; import { Badge, Card, CardBody, CardHeader, Col, Row, Table } from 'reactstrap'; import usersData from './UsersData' function UserRow(props) { const user = props.user - const userLink = `#/users/${user.id}` + const userLink = `/users/${user.id}` const getBadge = (status) => { return status === 'Active' ? 'success' : @@ -17,11 +18,11 @@ function UserRow(props) { return ( - {user.id} - {user.name} - {user.registered} - {user.role} - {user.status} + {user.id} + {user.name} + {user.registered} + {user.role} + {user.status} ) }