Skip to content

Commit 524778e

Browse files
authored
Merge branch 'frontendstudygroup:master' into master
2 parents e8d3563 + 0103387 commit 524778e

File tree

6 files changed

+80
-18
lines changed

6 files changed

+80
-18
lines changed

.dockerignore

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/node_modules
2+
3+
/build
4+
5+
.git
6+
7+
*.md
8+
9+
.gitignore

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
.env.development.local
1818
.env.test.local
1919
.env.production.local
20-
20+
.env
2121
npm-debug.log*
2222
yarn-debug.log*
2323
yarn-error.log*

.nginx/nginx.conf

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
worker_processes 4;
2+
3+
events { worker_connections 1024; }
4+
5+
http {
6+
server {
7+
listen 80;
8+
root /usr/share/nginx/html;
9+
include /etc/nginx/mime.types;
10+
11+
location / {
12+
try_files $uri /index.html;
13+
}
14+
}
15+
}

Dockerfile

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# stage1 as builder
2+
FROM node:16-alpine as builder
3+
4+
# copy the package.json to install dependencies
5+
COPY package.json package-lock.json ./
6+
7+
# Install the dependencies and make the folder
8+
RUN npm install && mkdir /react-ui && mv ./node_modules ./react-ui
9+
10+
WORKDIR /react-ui
11+
12+
COPY . .
13+
14+
# Build the project and copy the files
15+
RUN npm run build
16+
17+
18+
FROM nginx:1.20-alpine
19+
20+
#!/bin/sh
21+
22+
COPY ./.nginx/nginx.conf /etc/nginx/nginx.conf
23+
24+
## Remove default nginx index page
25+
RUN rm -rf /usr/share/nginx/html/*
26+
27+
# Copy from the stage 1
28+
COPY --from=builder /react-ui/build /usr/share/nginx/html
29+
30+
EXPOSE 443 80

src/App.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import '../src/assets/css/App.css';
2-
import HomePage from './components/HomePage/HomePage';
1+
import "../src/assets/css/App.css";
2+
import React from "react";
3+
import HomePage from "./components/HomePage/HomePage";
34

45
function App() {
56
return (
+22-15
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
11
import "./InputField.css";
2-
2+
import React from "react";
33
const InputField = ({ label, placeholder, onChange, value, error, type }) => {
4-
return (
5-
<div className="inputfield_wrapper">
6-
<label>{ label ? label : "" }</label>
7-
<input type={ type ? type : "text" } id="email" placeholder={ placeholder }
8-
value={ value && value }
9-
onChange={onChange && onChange}
10-
/>
11-
<p className="formContentError" >
12-
{ error && type === "email" ? "Please enter a valid email" : error ? "This field is required" : ""}
13-
</p>
14-
</div>
15-
)
16-
}
4+
return (
5+
<div className="inputfield_wrapper">
6+
<label>{label ? label : ""}</label>
7+
<input
8+
type={type ? type : "text"}
9+
id="email"
10+
placeholder={placeholder}
11+
value={value && value}
12+
onChange={onChange && onChange}
13+
/>
14+
<p className="formContentError">
15+
{error && type === "email"
16+
? "Please enter a valid email"
17+
: error
18+
? "This field is required"
19+
: ""}
20+
</p>
21+
</div>
22+
);
23+
};
1724

18-
export default InputField
25+
export default InputField;

0 commit comments

Comments
 (0)