Skip to content

Commit 0db85e4

Browse files
committed
Add file picker to splash page
1 parent 47e07a8 commit 0db85e4

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

auspice_client_customisation/splash.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from "react";
22
import { handleDroppedFiles } from "./handleDroppedFiles";
3-
import { P, Bold, Title, CenterContent, Line, NextstrainTitle, GitHub } from './styles';
3+
import { P, Bold, Title, UploadBox, UploadButton, CenterContent, Line, NextstrainTitle, GitHub } from './styles';
44
import pkg from "../package.json";
55

66

@@ -25,6 +25,11 @@ const SplashContent = (props) => {
2525
handleDroppedFiles(props.dispatch, event.dataTransfer.files);
2626
}
2727

28+
function handlePicked(event) {
29+
event.preventDefault();
30+
handleDroppedFiles(props.dispatch, event.target.files);
31+
}
32+
2833
return (
2934
<div className="static container">
3035

@@ -45,7 +50,12 @@ const SplashContent = (props) => {
4550

4651
<CenterContent>
4752
<Line/>
48-
<h2 style={{color: "#30353f", fontSize: 24}}>{`Drag & Drop a dataset on here to view`}</h2>
53+
<UploadBox>
54+
<input type="file" multiple onChange={handlePicked} style={{display: "none"}} />
55+
<h2 style={{color: "#30353f", fontSize: 24}}>{`Drag & Drop a dataset on here to view`}</h2>
56+
<div style={{marginTop: "14px"}}></div>
57+
<UploadButton>Select files</UploadButton>
58+
</UploadBox>
4959
<Line/>
5060
</CenterContent>
5161

auspice_client_customisation/styles.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,19 @@ export const Bold = styled.span`
3333
font-weight: 500;
3434
`;
3535

36+
export const UploadBox = styled.label`
37+
cursor: pointer;
38+
text-align: center;
39+
`;
40+
41+
export const UploadButton = styled.span`
42+
display: inline-block;
43+
border-radius: 4px;
44+
padding: 10px 20px;
45+
color: white;
46+
background-color: #63AC9A;
47+
`;
48+
3649

3750
export const CenterContent = (props) => (
3851
<div className="row">

0 commit comments

Comments
 (0)