generated from cfpb/open-source-project-template
-
Notifications
You must be signed in to change notification settings - Fork 14
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 #303 from cfpb/meissadia/print-submission-page
Submission page Print view and button
- Loading branch information
Showing
6 changed files
with
131 additions
and
0 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
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,46 @@ | ||
.print-page-container { | ||
position: absolute; | ||
top: 0px; | ||
right: 10px; | ||
transform: translateY(calc(50% + 15px + .5rem - 2px)); /* transform = half container + half icon + half text - half bottom margin */ | ||
} | ||
|
||
.print-page { | ||
cursor: pointer; | ||
background-color: transparent; | ||
color: black; | ||
font-size: 1.3rem; | ||
text-align: center; | ||
padding: 0; | ||
letter-spacing: .5px; | ||
} | ||
|
||
.print-page .icon { | ||
display: block; | ||
width: 30px; | ||
height: 30px; | ||
margin: 0 auto; | ||
margin-bottom: 4px; | ||
font-weight: bold; | ||
} | ||
|
||
.print-page:hover { | ||
color: #0071bc; | ||
background-color: transparent; | ||
} | ||
|
||
.print-page:hover .icon { | ||
fill: #0071bc; | ||
} | ||
|
||
@media screen and (max-width: 821px) { | ||
.print-page-container { | ||
position: relative; | ||
display: block; | ||
text-align: left; | ||
top: auto; | ||
right: auto; | ||
transform: translateY(0); | ||
margin-top: 2rem; | ||
} | ||
} |
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 React from "react" | ||
import { ReactComponent as PrinterIcon } from "../images/printer.svg" | ||
import "./PrintPageButton.css" | ||
|
||
function clickHandler(e) { | ||
e.preventDefault() | ||
window.print() | ||
document.activeElement.blur() | ||
} | ||
|
||
const PrintPageButton = () => { | ||
return ( | ||
<div className="print-page-container"> | ||
<button className="print-page" onClick={clickHandler}> | ||
<PrinterIcon className="icon" alt="printer" /> | ||
</button> | ||
</div> | ||
) | ||
} | ||
|
||
export default PrintPageButton |
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