Skip to content

Commit

Permalink
Merge pull request #26 from petergeorgas/development
Browse files Browse the repository at this point in the history
Add upload another button to success page
  • Loading branch information
petergeorgas authored Oct 29, 2021
2 parents 299bbb3 + 94aa27a commit addd6fb
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ function App() {
}
});

const newUpload = () => {
setSuccess(false); // Reset success state to false, which will cause a redirect to the home page
};

const handleFileChange = (event) => {
console.log("File change!!");
let target = event.target;
Expand Down Expand Up @@ -139,7 +143,7 @@ function App() {
if (inProg) {
return <Loading percentage={pct} header={uploadHeader} />;
} else if (success) {
return <Success imgUrl={downloadURL} />;
return <Success imgUrl={downloadURL} redirect={newUpload} />;
} else {
return (
<div className="flex-container">
Expand Down
12 changes: 12 additions & 0 deletions src/components/Success.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@
padding-left: 10px;
}

.new-upload-box {
margin-top: 12px;
line-height: 16px;
width: 355px;
height: 34px;
border-radius: 8px;
}

#newUpldBtn {
width: 100%;
}

.link-box {
display: flex;
flex-direction: row;
Expand Down
7 changes: 6 additions & 1 deletion src/components/Success.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const SnackbarType = {

function Success(props) {
const snackbarRef = useRef(null);
const { imgUrl } = props;
const { imgUrl, redirect } = props;

const copyLink = () => {
snackbarRef.current.show();
Expand Down Expand Up @@ -46,6 +46,11 @@ function Success(props) {
type={SnackbarType.success}
/>
</div>
<div className="new-upload-box">
<button className="btn" id="newUpldBtn" onClick={redirect}>
New Upload
</button>
</div>
</div>
</div>
</div>
Expand Down

0 comments on commit addd6fb

Please sign in to comment.