Skip to content

Commit

Permalink
Add file picker to splash page
Browse files Browse the repository at this point in the history
  • Loading branch information
victorlin committed Dec 26, 2023
1 parent 47e07a8 commit 0db85e4
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
14 changes: 12 additions & 2 deletions auspice_client_customisation/splash.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import { handleDroppedFiles } from "./handleDroppedFiles";
import { P, Bold, Title, CenterContent, Line, NextstrainTitle, GitHub } from './styles';
import { P, Bold, Title, UploadBox, UploadButton, CenterContent, Line, NextstrainTitle, GitHub } from './styles';
import pkg from "../package.json";


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

function handlePicked(event) {
event.preventDefault();
handleDroppedFiles(props.dispatch, event.target.files);
}

return (
<div className="static container">

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

<CenterContent>
<Line/>
<h2 style={{color: "#30353f", fontSize: 24}}>{`Drag & Drop a dataset on here to view`}</h2>
<UploadBox>
<input type="file" multiple onChange={handlePicked} style={{display: "none"}} />
<h2 style={{color: "#30353f", fontSize: 24}}>{`Drag & Drop a dataset on here to view`}</h2>
<div style={{marginTop: "14px"}}></div>
<UploadButton>Select files</UploadButton>
</UploadBox>
<Line/>
</CenterContent>

Expand Down
13 changes: 13 additions & 0 deletions auspice_client_customisation/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,19 @@ export const Bold = styled.span`
font-weight: 500;
`;

export const UploadBox = styled.label`
cursor: pointer;
text-align: center;
`;

export const UploadButton = styled.span`
display: inline-block;
border-radius: 4px;
padding: 10px 20px;
color: white;
background-color: #63AC9A;
`;


export const CenterContent = (props) => (
<div className="row">
Expand Down

0 comments on commit 0db85e4

Please sign in to comment.