-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This link includes the current parameters so that the user can pick up what they're looking at in their own JupyterLab. Add the download icon from fontawesome.
- Loading branch information
1 parent
2adb0af
commit 0574c00
Showing
4 changed files
with
42 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'squareone': minor | ||
--- | ||
|
||
Users can now download the Jupyter Notebook (ipynb) file that they are viewing, with the current parameters filled in. This enables further interactive exploration. |
25 changes: 25 additions & 0 deletions
25
apps/squareone/src/components/TimesSquareGitHubPagePanel/IpynbDownloadLink.js
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,25 @@ | ||
import styled from 'styled-components'; | ||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; | ||
|
||
export default function IpynbDownloadLink({ url, sourcePath }) { | ||
// get the filename from the sourcePath | ||
const filename = sourcePath.split('/').pop(); | ||
|
||
return ( | ||
<StyledP> | ||
<a href={url} title={filename} download={filename}> | ||
<StyledFontAwesomeIcon icon="download" /> Download notebook | ||
</a> | ||
</StyledP> | ||
); | ||
} | ||
|
||
const StyledP = styled.p` | ||
margin-top: 2rem; | ||
`; | ||
|
||
const StyledFontAwesomeIcon = styled(FontAwesomeIcon)` | ||
margin-right: 0.2em; | ||
font-size: 1em; | ||
color: ${(props) => props.color || 'inherit'}; | ||
`; |
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