Skip to content

Commit 32c9a81

Browse files
authored
Create pull request CI #22 (#23)
* Create pull request CI #22 * Updating packages, formatting, and workflow files * Adding code formatting test on pull request * Handling formatting error
1 parent 9852fb3 commit 32c9a81

16 files changed

+22687
-18010
lines changed

.github/workflows/npm-publish.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ name: Deploy to GH Pages
33
on:
44
push:
55
branches:
6-
- main
7-
8-
permissions:
6+
- main
7+
8+
permissions:
99
contents: write
1010

1111
jobs:

.github/workflows/pull_request.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3+
4+
name: Pull Request Test
5+
6+
on: [pull_request]
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v3
14+
- name: Use Node.js
15+
uses: actions/setup-node@v3
16+
with:
17+
node-version: 16
18+
cache: 'npm'
19+
- run: npm ci
20+
- run: npm run build --if-present
21+
- run: npx standard

package-lock.json

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

package.json

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@
44
"private": true,
55
"homepage": "https://geovation.github.io/mapup-reactjs/",
66
"dependencies": {
7-
"@emotion/react": "^11.9.0",
8-
"@emotion/styled": "^11.8.1",
9-
"@fontsource/roboto": "^4.5.7",
10-
"@mui/icons-material": "^5.8.2",
11-
"@mui/material": "^5.8.2",
12-
"@testing-library/jest-dom": "^5.16.4",
13-
"@testing-library/react": "^13.3.0",
7+
"@emotion/react": "^11.10.4",
8+
"@emotion/styled": "^11.10.4",
9+
"@fontsource/roboto": "^4.5.8",
10+
"@mui/icons-material": "^5.10.6",
11+
"@mui/material": "^5.10.6",
12+
"@testing-library/jest-dom": "^5.16.5",
13+
"@testing-library/react": "^13.4.0",
1414
"@testing-library/user-event": "^13.5.0",
1515
"axios": "^0.27.2",
1616
"mapbox-gl": "npm:empty-npm-package@^1.0.0",
17-
"maplibre-gl": "^2.1.9",
18-
"react": "^18.1.0",
19-
"react-dom": "^18.1.0",
20-
"react-map-gl": "^7.0.15",
17+
"maplibre-gl": "^2.4.0",
18+
"react": "^18.2.0",
19+
"react-dom": "^18.2.0",
20+
"react-map-gl": "^7.0.19",
2121
"react-scripts": "5.0.1",
2222
"web-vitals": "^2.1.4",
2323
"workbox-background-sync": "^6.5.3",
@@ -60,6 +60,7 @@
6060
]
6161
},
6262
"devDependencies": {
63-
"gh-pages": "^4.0.0"
63+
"gh-pages": "^4.0.0",
64+
"standard": "^17.0.0"
6465
}
6566
}
File renamed without changes.

src/App.js

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
1-
import React from 'react';
1+
import React from 'react'
22

3-
import AppBar from '@mui/material/AppBar';
4-
import CssBaseline from '@mui/material/CssBaseline';
5-
import Toolbar from '@mui/material/Toolbar';
3+
import AppBar from '@mui/material/AppBar'
4+
import CssBaseline from '@mui/material/CssBaseline'
5+
import Toolbar from '@mui/material/Toolbar'
66

7-
import AdbIcon from '@mui/icons-material/Adb';
7+
import AdbIcon from '@mui/icons-material/Adb'
88

9-
import MapUpMap from './MapUpMap';
10-
import Search from './Search';
9+
import MapUpMap from './MapUpMap'
10+
import Search from './Search'
1111

12-
import Header from './Header';
13-
import Footer from './Footer';
12+
import Header from './Header'
13+
import Footer from './Footer'
1414

15-
import './App.css';
16-
import 'maplibre-gl/dist/maplibre-gl.css';
15+
import './App.css'
16+
import 'maplibre-gl/dist/maplibre-gl.css'
1717

18-
function App() {
18+
function App () {
1919
return (
20-
<React.Fragment>
21-
<Header/>
20+
<>
21+
<Header />
2222
<CssBaseline />
23-
<AppBar position="fixed" color="transparent" elevation={0}>
23+
<AppBar position='fixed' color='transparent' elevation={0}>
2424
<Toolbar>
2525
<Search />
2626
<AdbIcon sx={{ mr: 1 }} />
2727
</Toolbar>
2828
</AppBar>
2929
<MapUpMap />
30-
<Footer/>
31-
</React.Fragment>
32-
);
30+
<Footer />
31+
</>
32+
)
3333
}
3434

35-
export default App;
35+
export default App

src/App.test.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +0,0 @@
1-
import React from 'react';
2-
import { render, screen } from '@testing-library/react';
3-
import App from './App';

src/Footer.js

Lines changed: 35 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,48 @@
1-
import * as React from 'react';
2-
import { styled, alpha } from '@mui/material/styles';
1+
import * as React from 'react'
2+
import { styled, alpha } from '@mui/material/styles'
33

44
const FooterContainer = styled('div')(({ theme }) => ({
5-
position: 'fixed',
6-
left : 0,
7-
bottom : 0,
8-
color : 'white',
9-
display: 'flex',
10-
justifyContent: 'center',
11-
alignItems: 'center',
12-
borderRadius: theme.shape.borderRadius,
13-
backgroundColor: alpha(theme.palette.common.black,1),
14-
width: '100%',
15-
height : '90px',
16-
}));
5+
position: 'fixed',
6+
left: 0,
7+
bottom: 0,
8+
color: 'white',
9+
display: 'flex',
10+
justifyContent: 'center',
11+
alignItems: 'center',
12+
borderRadius: theme.shape.borderRadius,
13+
backgroundColor: alpha(theme.palette.common.black, 1),
14+
width: '100%',
15+
height: '90px'
16+
}))
1717

18-
const UseMapSpan = styled('span')(({theme}) => ({
18+
const UseMapSpan = styled('span')(({ theme }) => ({
1919
postion: 'absolute',
2020
left: '10px',
21-
padding: 5,
22-
}));
21+
padding: 5
22+
}))
2323

24-
const UseMapLink = styled('a')(({theme}) => ({
24+
const UseMapLink = styled('a')(({ theme }) => ({
2525
'&:link': {
26-
color: theme.palette.common.white,
26+
color: theme.palette.common.white
2727
},
2828
'&:hover': {
29-
color: theme.palette.common.red,
29+
color: theme.palette.common.red
3030
}
31-
}));
31+
}))
3232

33-
function Footer()
34-
{
35-
return (
36-
<FooterContainer>
37-
<img height="75" src={process.env.PUBLIC_URL + "/elelogo_transp.png"} />
38-
<UseMapSpan>
39-
UseMap | <UseMapLink href="#">Terms and Conditions</UseMapLink>
40-
</UseMapSpan>
41-
</FooterContainer>
42-
)
33+
function Footer () {
34+
return (
35+
<FooterContainer>
36+
<img
37+
alt='UseMap Logo'
38+
height='75'
39+
src={process.env.PUBLIC_URL + '/elelogo_transp.png'}
40+
/>
41+
<UseMapSpan>
42+
UseMap | <UseMapLink href='#'>Terms and Conditions</UseMapLink>
43+
</UseMapSpan>
44+
</FooterContainer>
45+
)
4346
}
4447

45-
export default Footer;
48+
export default Footer

src/Header.js

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,24 @@
1-
import * as React from 'react';
2-
import { styled, alpha } from '@mui/material/styles';
1+
import * as React from 'react'
2+
import { styled, alpha } from '@mui/material/styles'
33

44
const HeaderContainer = styled('div')(({ theme }) => ({
5-
position: 'fixed',
6-
left : 0,
7-
top : 0,
8-
zIndex : 20,
9-
color : 'white',
10-
display: 'flex',
11-
justifyContent: 'center',
12-
alignItems: 'center',
13-
borderBottom: 'solid black',
14-
borderRadius: theme.shape.borderRadius,
15-
backgroundColor: alpha(theme.palette.common.white, 1),
16-
width: '100%',
17-
height : '60px',
18-
}));
5+
position: 'fixed',
6+
left: 0,
7+
top: 0,
8+
zIndex: 20,
9+
color: 'white',
10+
display: 'flex',
11+
justifyContent: 'center',
12+
alignItems: 'center',
13+
borderBottom: 'solid black',
14+
borderRadius: theme.shape.borderRadius,
15+
backgroundColor: alpha(theme.palette.common.white, 1),
16+
width: '100%',
17+
height: '60px'
18+
}))
1919

20-
function Header()
21-
{
22-
return (
23-
<HeaderContainer>
24-
</HeaderContainer>
25-
)
20+
function Header () {
21+
return <HeaderContainer />
2622
}
2723

28-
export default Header;
24+
export default Header

src/MapUpMap.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import React from 'react';
2-
import Map from 'react-map-gl';
1+
import React from 'react'
2+
import Map from 'react-map-gl'
33

44
// eslint-disable-next-line import/no-webpack-loader-syntax
5-
import maplibregl from "!maplibre-gl";
5+
import maplibregl from '!maplibre-gl'
66

7-
function MapUpMap() {
7+
function MapUpMap () {
88
return (
99
<Map
1010
initialViewState={{
@@ -14,9 +14,9 @@ function MapUpMap() {
1414
}}
1515
mapLib={maplibregl}
1616
style={{ width: '100vw', height: '100vh' }}
17-
mapStyle="https://basemaps.cartocdn.com/gl/positron-gl-style/style.json"
17+
mapStyle='https://basemaps.cartocdn.com/gl/positron-gl-style/style.json'
1818
/>
19-
);
19+
)
2020
}
2121

22-
export default MapUpMap;
22+
export default MapUpMap

src/Search.js

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
import * as React from 'react';
2-
import { styled, alpha } from '@mui/material/styles';
3-
import InputBase from '@mui/material/InputBase';
4-
import SearchIcon from '@mui/icons-material/Search';
5-
import Autocomplete from '@mui/material/Autocomplete';
1+
import * as React from 'react'
2+
import { styled, alpha } from '@mui/material/styles'
3+
import InputBase from '@mui/material/InputBase'
4+
import SearchIcon from '@mui/icons-material/Search'
5+
import Autocomplete from '@mui/material/Autocomplete'
66

77
const SearchContainer = styled('div')(({ theme }) => ({
88
position: 'relative',
99
borderRadius: theme.shape.borderRadius,
1010
backgroundColor: alpha(theme.palette.common.white, 0.15),
1111
'&:hover': {
12-
backgroundColor: alpha(theme.palette.common.white, 0.25),
12+
backgroundColor: alpha(theme.palette.common.white, 0.25)
1313
},
1414
marginRight: theme.spacing(2),
1515
marginLeft: 0,
1616
width: '100%',
1717
[theme.breakpoints.up('sm')]: {
1818
marginLeft: theme.spacing(3),
19-
width: 'auto',
20-
},
21-
}));
19+
width: 'auto'
20+
}
21+
}))
2222

2323
const SearchIconWrapper = styled('div')(({ theme }) => ({
2424
padding: theme.spacing(0, 2),
@@ -27,8 +27,8 @@ const SearchIconWrapper = styled('div')(({ theme }) => ({
2727
pointerEvents: 'none',
2828
display: 'flex',
2929
alignItems: 'center',
30-
justifyContent: 'center',
31-
}));
30+
justifyContent: 'center'
31+
}))
3232

3333
const StyledInputBase = styled(InputBase)(({ theme }) => ({
3434
color: 'inherit',
@@ -39,39 +39,37 @@ const StyledInputBase = styled(InputBase)(({ theme }) => ({
3939
transition: theme.transitions.create('width'),
4040
width: '100%',
4141
[theme.breakpoints.up('md')]: {
42-
width: '20ch',
43-
},
44-
},
45-
}));
42+
width: '20ch'
43+
}
44+
}
45+
}))
4646

4747
const testData = [
4848
{ label: 'Ordnance Survey', location: [-1.471061, 50.9382] },
4949
{ label: 'Bradford on Avon', location: [-2.249391, 51.347659] },
5050
{ label: 'Geovation', location: [-0.099754, 51.52435] },
51-
{ label : 'Berwick-upon-Tweed', location : [-2.00477, 55.768824]}
52-
];
53-
54-
function Search() {
51+
{ label: 'Berwick-upon-Tweed', location: [-2.00477, 55.768824] }
52+
]
5553

54+
function Search () {
5655
return (
5756
<SearchContainer>
5857
<SearchIconWrapper>
5958
<SearchIcon />
6059
</SearchIconWrapper>
6160
<Autocomplete
6261
disablePortal
63-
id="combo-box-demo"
62+
id='combo-box-demo'
6463
options={testData}
65-
getOptionLabel={(option) => option.label}
64+
getOptionLabel={option => option.label}
6665
style={{ width: 300 }}
67-
renderInput={(params) => {
68-
const { InputLabelProps, InputProps, ...rest } = params;
66+
renderInput={params => {
67+
const { InputLabelProps, InputProps, ...rest } = params
6968
return <StyledInputBase {...params.InputProps} {...rest} />
70-
}
71-
}
69+
}}
7270
/>
7371
</SearchContainer>
74-
);
72+
)
7573
}
7674

77-
export default Search;
75+
export default Search

0 commit comments

Comments
 (0)