-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ add image upload by cloudinary and 404 page
- Loading branch information
1 parent
5a7f97e
commit ca5354d
Showing
11 changed files
with
160 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ | |
|
||
# misc | ||
.DS_Store | ||
.env | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import React from "react"; | ||
import styled from "styled-components"; | ||
|
||
const FieldContainer = styled.div` | ||
padding-top: 1rem; | ||
`; | ||
|
||
const FieldTitle = styled.h2` | ||
font-size: 13px; | ||
line-height: 18px; | ||
color: #4f4f4f; | ||
margin-bottom: 5px; | ||
`; | ||
|
||
const FieldInput = styled.input` | ||
border: 1px solid ${(props) => (props.error ? "red" : "#828282")}; | ||
min-width: 60%; | ||
/* border: 1px solid #828282; */ | ||
border-radius: 12px; | ||
padding: 15px 20px; | ||
outline: none; | ||
`; | ||
|
||
const Error = styled.p` | ||
font-size: 11px; | ||
margin: 2px 10px; | ||
color: red; | ||
`; | ||
|
||
const InputField = ({ title, children, error, ...rest }) => ( | ||
<FieldContainer> | ||
<label> | ||
<FieldTitle>{title}</FieldTitle> | ||
<FieldInput error={error} {...rest} /> | ||
{error && <Error>{error}</Error>} | ||
</label> | ||
</FieldContainer> | ||
); | ||
|
||
export default InputField; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import React from "react"; | ||
import styled from "styled-components"; | ||
|
||
const Container = styled.div` | ||
height: 100vh; | ||
width: 100vw; | ||
position: relative; | ||
h1 { | ||
font-weight: 400; | ||
font-size: 36px; | ||
line-height: 49px; | ||
} | ||
h2 { | ||
font-weight: 300; | ||
font-size: 18px; | ||
line-height: 25px; | ||
} | ||
`; | ||
|
||
const Child = styled.div` | ||
position: absolute; | ||
top: 0; | ||
left: 50%; | ||
transform: translate(-50%, 100%); | ||
text-align: center; | ||
`; | ||
|
||
const FourOhFour = () => ( | ||
<Container> | ||
<Child> | ||
<h1>Four Oh Four</h1> | ||
<h2>Seems like, you are lost just like me</h2> | ||
</Child> | ||
</Container> | ||
); | ||
|
||
export default FourOhFour; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import axios from "axios"; | ||
|
||
const imageUpload = (imageFile, callback) => { | ||
const formData = new FormData(); | ||
|
||
formData.append("file", imageFile); | ||
formData.append( | ||
"upload_preset", | ||
process.env.REACT_APP_CLOUDINARY_UPLOAD_PRESET | ||
); | ||
|
||
axios | ||
.post( | ||
`https://api.cloudinary.com/v1_1/${process.env.REACT_APP_CLOUDINARY_CLOUD_NAME}/image/upload`, | ||
formData | ||
) | ||
.then((res) => res.data.secure_url) | ||
.then((url) => callback(url)) | ||
.catch((err) => new Error(err)); | ||
}; | ||
|
||
export default imageUpload; |
File renamed without changes.