Skip to content

Commit 2195cdb

Browse files
seanforyou23dgutride
authored andcommitted
feat(deps): upgrade dependencies and improve first time experience
ensure selecting logo doesn't cause page refresh dress up 404 page to look better and provide smoother transition back to home bring favicon in house to avoid broken urls set stub brand logo add webpack copy plugin for favicon asset
1 parent c1eff0a commit 2195cdb

File tree

11 files changed

+12171
-10656
lines changed

11 files changed

+12171
-10656
lines changed

package-lock.json

Lines changed: 12030 additions & 10592 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 47 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
{
22
"name": "patternfly-seed",
3-
"version": "0.0.1",
3+
"version": "0.0.2",
44
"description": "An open source build scaffolding utility for web apps.",
55
"main": "server.js",
66
"repository": "https://github.com/patternfly/patternfly-react-seed.git",
7+
"homepage": "https://patternfly-react-seed.surge.sh",
78
"license": "MIT",
89
"private": true,
910
"scripts": {
1011
"prebuild": "npm run clean",
1112
"dr:surge": "node dr-surge.js",
1213
"build": "webpack --config webpack.prod.js && npm run dr:surge",
1314
"start": "node server.js",
14-
"start:dev": "webpack-dev-server --hot --color --progress --info=true --config webpack.dev.js",
15+
"start:dev": "webpack serve --hot --color --progress --config webpack.dev.js",
1516
"test": "jest",
1617
"eslint": "eslint --ext .tsx,.js ./src/",
1718
"lint": "npm run eslint",
@@ -25,62 +26,63 @@
2526
"build:storybook": "build-storybook"
2627
},
2728
"devDependencies": {
28-
"@storybook/addon-actions": "^5.3.19",
29-
"@storybook/addon-info": "^5.3.19",
30-
"@storybook/addon-links": "^5.3.19",
31-
"@storybook/addons": "^5.3.19",
32-
"@storybook/react": "^5.3.19",
33-
"@types/enzyme": "^3.10.5",
29+
"@storybook/addon-actions": "^6.0.26",
30+
"@storybook/addon-info": "^5.3.21",
31+
"@storybook/addon-links": "^6.0.26",
32+
"@storybook/addons": "^6.0.26",
33+
"@storybook/react": "^6.0.26",
34+
"@types/enzyme": "^3.10.7",
3435
"@types/enzyme-adapter-react-16": "^1.0.6",
35-
"@types/jest": "^25.2.3",
36-
"@types/react-router-dom": "^5.1.5",
36+
"@types/jest": "^26.0.14",
37+
"@types/react-router-dom": "^5.1.6",
3738
"@types/victory": "^33.1.4",
38-
"@typescript-eslint/eslint-plugin": "^3.1.0",
39-
"@typescript-eslint/parser": "^3.1.0",
40-
"css-loader": "^3.5.3",
41-
"dotenv-webpack": "^1.8.0",
39+
"@typescript-eslint/eslint-plugin": "^4.4.1",
40+
"@typescript-eslint/parser": "^4.4.1",
41+
"copy-webpack-plugin": "^6.2.1",
42+
"css-loader": "^5.0.0",
43+
"dotenv-webpack": "^4.0.0",
4244
"enzyme": "^3.7.0",
43-
"enzyme-adapter-react-16": "^1.15.1",
44-
"enzyme-to-json": "^3.5.0",
45-
"eslint": "^7.1.0",
46-
"eslint-plugin-react": "^7.20.0",
47-
"eslint-plugin-react-hooks": "^4.0.4",
48-
"file-loader": "^6.0.0",
49-
"html-webpack-plugin": "^4.3.0",
45+
"enzyme-adapter-react-16": "^1.15.5",
46+
"enzyme-to-json": "^3.6.1",
47+
"eslint": "^7.11.0",
48+
"eslint-plugin-react": "^7.21.4",
49+
"eslint-plugin-react-hooks": "^4.1.2",
50+
"file-loader": "^6.1.1",
51+
"html-webpack-plugin": "^4.5.0",
5052
"imagemin": "^7.0.0",
51-
"jest": "^26.0.1",
52-
"mini-css-extract-plugin": "^0.9.0",
53-
"optimize-css-assets-webpack-plugin": "^5.0.1",
54-
"prettier": "^2.0.5",
53+
"jest": "^26.5.3",
54+
"mini-css-extract-plugin": "^1.0.0",
55+
"optimize-css-assets-webpack-plugin": "^5.0.4",
56+
"prettier": "^2.1.2",
5557
"prop-types": "^15.6.1",
56-
"raw-loader": "^4.0.1",
57-
"react-axe": "^3.4.1",
58+
"raw-loader": "^4.0.2",
59+
"react-axe": "^3.5.4",
5860
"react-docgen-typescript-loader": "^3.7.2",
5961
"react-router-dom": "^5.2.0",
60-
"regenerator-runtime": "^0.13.5",
62+
"regenerator-runtime": "^0.13.7",
6163
"rimraf": "^3.0.2",
62-
"style-loader": "^1.2.1",
64+
"style-loader": "^2.0.0",
6365
"svg-url-loader": "^6.0.0",
64-
"terser-webpack-plugin": "^3.0.2",
65-
"ts-jest": "^26.1.0",
66-
"ts-loader": "^7.0.5",
67-
"tsconfig-paths-webpack-plugin": "^3.2.0",
68-
"tslib": "^2.0.0",
69-
"typescript": "^3.9.3",
70-
"url-loader": "^4.1.0",
71-
"webpack": "^4.43.0",
72-
"webpack-bundle-analyzer": "^3.8.0",
73-
"webpack-cli": "^3.3.11",
66+
"terser-webpack-plugin": "^5.0.0",
67+
"ts-jest": "^26.4.1",
68+
"ts-loader": "^8.0.5",
69+
"tsconfig-paths-webpack-plugin": "^3.3.0",
70+
"tslib": "^2.0.3",
71+
"typescript": "^4.0.3",
72+
"url-loader": "^4.1.1",
73+
"webpack": "^5.1.3",
74+
"webpack-bundle-analyzer": "^3.9.0",
75+
"webpack-cli": "^4.0.0",
7476
"webpack-dev-server": "^3.11.0",
75-
"webpack-merge": "^4.1.4"
77+
"webpack-merge": "^5.2.0"
7678
},
7779
"dependencies": {
78-
"@patternfly/react-core": "^4.32.1",
79-
"@patternfly/react-icons": "^4.5.0",
80-
"@patternfly/react-styles": "^4.5.0",
80+
"@patternfly/react-core": "^4.63.3",
81+
"@patternfly/react-icons": "^4.7.11",
82+
"@patternfly/react-styles": "^4.7.8",
8183
"express": "^4.17.1",
82-
"react": "^16.13.1",
83-
"react-dom": "^16.13.1",
84+
"react": "^16.14.0",
85+
"react-dom": "^16.14.0",
8486
"react-router-last-location": "^2.0.1"
8587
}
8688
}

src/app/AppLayout/AppLayout.tsx

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as React from 'react';
2-
import { NavLink, useLocation } from 'react-router-dom';
2+
import { NavLink, useLocation, useHistory } from 'react-router-dom';
33
import {
44
Nav,
55
NavList,
@@ -11,16 +11,13 @@ import {
1111
SkipToContent
1212
} from '@patternfly/react-core';
1313
import { routes, IAppRoute, IAppRouteGroup } from '@app/routes';
14+
import logo from '@app/bgimages/Patternfly-Logo.svg';
1415

1516
interface IAppLayout {
1617
children: React.ReactNode;
1718
}
1819

1920
const AppLayout: React.FunctionComponent<IAppLayout> = ({children}) => {
20-
const logoProps = {
21-
href: '/',
22-
target: '_blank'
23-
};
2421
const [isNavOpen, setIsNavOpen] = React.useState(true);
2522
const [isMobileView, setIsMobileView] = React.useState(true);
2623
const [isNavOpenMobile, setIsNavOpenMobile] = React.useState(false);
@@ -33,10 +30,20 @@ const AppLayout: React.FunctionComponent<IAppLayout> = ({children}) => {
3330
const onPageResize = (props: { mobileView: boolean; windowSize: number }) => {
3431
setIsMobileView(props.mobileView);
3532
};
33+
34+
function LogoImg() {
35+
const history = useHistory();
36+
function handleClick() {
37+
history.push('/');
38+
}
39+
return (
40+
<img src={logo} onClick={handleClick} alt="PatternFly Logo" />
41+
);
42+
}
43+
3644
const Header = (
3745
<PageHeader
38-
logo="Patternfly"
39-
logoProps={logoProps}
46+
logo={<LogoImg />}
4047
showNavToggle
4148
isNavOpen={isNavOpen}
4249
onNavToggle={isMobileView ? onNavToggleMobile : onNavToggle}

src/app/NotFound/NotFound.tsx

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,40 @@
11
import * as React from 'react';
2-
import { NavLink } from 'react-router-dom';
3-
import { Alert, PageSection } from '@patternfly/react-core';
2+
import { ExclamationTriangleIcon } from '@patternfly/react-icons';
3+
import {
4+
PageSection,
5+
Title,
6+
Button,
7+
EmptyState,
8+
EmptyStateIcon,
9+
EmptyStateBody,
10+
} from '@patternfly/react-core';
11+
import { useHistory } from 'react-router-dom';
412

5-
const NotFound: React.FunctionComponent = () => (
13+
const NotFound: React.FunctionComponent = () => {
14+
function GoHomeBtn() {
15+
const history = useHistory();
16+
function handleClick() {
17+
history.push('/');
18+
}
19+
return (
20+
<Button onClick={handleClick}>Take me home</Button>
21+
);
22+
}
23+
24+
return (
625
<PageSection>
7-
<Alert variant="danger" title="404! This view hasn't been created yet." /><br />
8-
<NavLink to="/" className="pf-c-nav__link">Take me home</NavLink>
9-
</PageSection>
26+
<EmptyState variant="full">
27+
<EmptyStateIcon icon={ExclamationTriangleIcon} />
28+
<Title headingLevel="h1" size="lg">
29+
404 Page not found
30+
</Title>
31+
<EmptyStateBody>
32+
We didn&apos;t find a page that matches the address you navigated to.
33+
</EmptyStateBody>
34+
<GoHomeBtn />
35+
</EmptyState>
36+
</PageSection>
1037
)
38+
};
1139

1240
export { NotFound };
Lines changed: 33 additions & 0 deletions
Loading

src/app/routes.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const Support = (routeProps: RouteComponentProps): React.ReactElement => {
2626
loadedComponent = (
2727
<PageSection aria-label="Loading Content Container">
2828
<div className="pf-l-bullseye">
29-
<Alert title="Loading" className="pf-l-bullseye__item" />
29+
<Alert title="Loading" variant="info" className="pf-l-bullseye__item" />
3030
</div>
3131
</PageSection>
3232
);

src/favicon.png

4.44 KB
Loading

src/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<title>Patternfly Seed</title>
77
<meta id="appName" name="application-name" content="Patternfly Seed">
88
<meta name="viewport" content="width=device-width, initial-scale=1.0">
9-
<link rel="icon" type="image/png" href="https://www.patternfly.org/components/patternfly/dist/img/favicon.ico">
9+
<link rel="icon" type="image/svg+xml" href="/images/favicon.png">
1010
<base href="/">
1111
</head>
1212

webpack.common.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
const path = require('path');
22
const HtmlWebpackPlugin = require('html-webpack-plugin');
3+
const CopyPlugin = require('copy-webpack-plugin');
34
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
45
const Dotenv = require('dotenv-webpack');
56
const BG_IMAGES_DIRNAME = 'bgimages';
6-
7+
const ASSET_PATH = process.env.ASSET_PATH || '/';
78
module.exports = env => {
89

910
return {
@@ -111,7 +112,8 @@ module.exports = env => {
111112
},
112113
output: {
113114
filename: '[name].bundle.js',
114-
path: path.resolve(__dirname, 'dist')
115+
path: path.resolve(__dirname, 'dist'),
116+
publicPath: ASSET_PATH
115117
},
116118
plugins: [
117119
new HtmlWebpackPlugin({
@@ -120,6 +122,11 @@ module.exports = env => {
120122
new Dotenv({
121123
systemvars: true,
122124
silent: true
125+
}),
126+
new CopyPlugin({
127+
patterns: [
128+
{ from: './src/favicon.png', to: 'images' },
129+
]
123130
})
124131
],
125132
resolve: {

webpack.dev.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const path = require('path');
2-
const merge = require("webpack-merge");
2+
const { merge } = require("webpack-merge");
33
const common = require("./webpack.common.js");
44
const HOST = process.env.HOST || "0.0.0.0";
55
const PORT = process.env.PORT || "9000";

0 commit comments

Comments
 (0)