Skip to content

Commit

Permalink
Add download icon
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathansick committed Apr 12, 2024
1 parent db24047 commit 3d4a22d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +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 (
<p>
<a href={url} download={filename}>
Download notebook
<StyledP>
<a href={url} title={filename} download={filename}>
<StyledFontAwesomeIcon icon="download" /> Download notebook
</a>
</p>
</StyledP>
);
}

const StyledP = styled.p`
margin-top: 1rem;
`;

const StyledFontAwesomeIcon = styled(FontAwesomeIcon)`
margin-right: 0.2em;
font-size: 1em;
color: ${(props) => props.color || 'inherit'};
`;
2 changes: 2 additions & 0 deletions apps/squareone/src/styles/icons.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
faCircleCheck,
faCircleMinus,
faCodeCommit,
faDownload,
} from '@fortawesome/free-solid-svg-icons';
import { faGithub } from '@fortawesome/free-brands-svg-icons';

Expand All @@ -25,4 +26,5 @@ library.add(faCircleXmark);
library.add(faCircleCheck);
library.add(faCircleMinus);
library.add(faCodeCommit);
library.add(faDownload);
library.add(faGithub);

0 comments on commit 3d4a22d

Please sign in to comment.