generated from cepdnaclk/eYY-XXX-project-template
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from e20178dulanga/main
Download page frontend updated
- Loading branch information
Showing
5 changed files
with
132 additions
and
4 deletions.
There are no files selected for viewing
Binary file not shown.
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 |
---|---|---|
@@ -1,9 +1,64 @@ | ||
import React, { useState } from "react"; | ||
import fileDownload from '../assets/download.png'; | ||
|
||
function Downloads() { | ||
return( | ||
|
||
// Downloading files | ||
const handleDownload = async (fileName) => { | ||
try { | ||
const response = await fetch(`/pdf/${fileName}`); | ||
const blob = await response.blob(); | ||
|
||
const url = window.URL.createObjectURL(new Blob([blob])); | ||
const link = document.createElement('a'); | ||
link.href = url; | ||
link.setAttribute('download', fileName); | ||
document.body.appendChild(link); | ||
link.click(); | ||
link.parentNode.removeChild(link); | ||
} catch (error) { | ||
console.error("There was an error downloading the file!", error); | ||
} | ||
}; | ||
|
||
return ( | ||
<> | ||
<h1>Downloads</h1> | ||
</> | ||
<div className="downloadTitle"> | ||
<h3>Downloads</h3> | ||
</div> | ||
|
||
|
||
<div className="downloadPage"> | ||
|
||
<div className="downloadButton"> | ||
<h4>Project Card</h4> | ||
<img src={fileDownload} alt="fileDownload"/> | ||
<button className="downloadButton" onClick={() => handleDownload('Project-101128627.pdf')}>Download</button> | ||
</div> | ||
|
||
<div className="downloadButton"> | ||
<h4>Application Form</h4> | ||
<img src={fileDownload} alt="fileDownload"/> | ||
<a className="openlink" href="http://www.pgis.pdn.ac.lk/downloads/students.php"><p>Open</p></a> | ||
</div> | ||
|
||
<div className="downloadButton"> | ||
<h4>Handbook</h4> | ||
<img src={fileDownload} alt="fileDownload"/> | ||
<button className="downloadButton" onClick={() => handleDownload('Handbook.pdf')}>Download</button> | ||
</div> | ||
|
||
<div className="downloadButton"> | ||
<nav> | ||
<h4>For PGIS Staff</h4> | ||
<img src={fileDownload} alt="fileDownload"/> | ||
<a className="openlink" href="http://www.pgis.pdn.ac.lk/downloads/staff.php"><p>Open</p></a> | ||
</nav> | ||
</div> | ||
|
||
</div> | ||
</> | ||
); | ||
} | ||
|
||
export default Downloads; | ||
export default Downloads; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,72 @@ | ||
.downloadPage { | ||
align-items: center; | ||
justify-content: center; | ||
display: flex; | ||
flex-direction: row; | ||
margin-bottom: 2%; | ||
} | ||
|
||
.downloadTitle { | ||
margin-top: 2%; | ||
margin-left: 5%; | ||
text-align: left; | ||
margin-bottom: 3%; | ||
font-size: 20px; | ||
} | ||
|
||
.downloadButton { | ||
border: 1px solid hsl(222, 83%, 98%); | ||
box-shadow: 2px 2px 5px rgba(63, 108, 148, 0.1), | ||
-2px -2px 5px rgba(255, 255, 255, 0.7), | ||
2px -2px 5px rgba(255, 255, 255, 0.7), | ||
-2px 2px 5px rgba(63, 108, 148, 0.1); | ||
padding: 20px; | ||
display: inline-block; | ||
background-color: hsl(0, 0%, 100%);; | ||
margin-left: 5%; | ||
margin-right: 5%; | ||
margin-bottom: 5%; | ||
text-align: center; | ||
} | ||
|
||
.downloadButton img { | ||
height: 200px; | ||
width: auto; | ||
} | ||
|
||
.downloadButton button { | ||
width: 150px; | ||
height: 55px; | ||
background: hsl(211, 44%, 66%); | ||
border: none; | ||
border-radius: 6px; | ||
cursor: pointer; | ||
font-size: 16px; | ||
font: #ffffff; | ||
color: #000000; | ||
text-align: center; | ||
margin-top: 10px; | ||
} | ||
|
||
.downloadButton button:hover { | ||
background: hsl(211, 40%, 69%); | ||
color: #2a2929; | ||
} | ||
|
||
.openlink { | ||
width: 50px; | ||
color: #000000; | ||
text-align: center; | ||
font-size: 16px; | ||
} | ||
|
||
@media (max-width: 1500px) { | ||
.downloadPage { | ||
flex-direction: column; | ||
margin-left: 0px; | ||
} | ||
|
||
} | ||
|
||
|
||
|