Skip to content

Commit 81f60a8

Browse files
committed
Add cube download button to settings
1 parent e95ee59 commit 81f60a8

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { faDownload } from '@fortawesome/free-solid-svg-icons';
2+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
3+
import React from 'react';
4+
5+
type IDownloadCubeProps = {};
6+
7+
const DownloadCubeButton = (props: IDownloadCubeProps) => {
8+
const handleDownload = () => {
9+
const url =
10+
'https://raw.githubusercontent.com/QuantStack/jupyterlab-gather/main/resources/ar-cubes/cube1.pdf';
11+
const link = document.createElement('a');
12+
link.href = url;
13+
link.download = '';
14+
document.body.appendChild(link);
15+
link.click();
16+
document.body.removeChild(link);
17+
};
18+
19+
return (
20+
<div className="jlab-gather-device-settings-row">
21+
<span className="jlab-gather-device-title">AR Cube:</span>
22+
<button
23+
className="jlab-gather-btn-common jlab-gather-btn-primary"
24+
onClick={handleDownload}
25+
>
26+
<FontAwesomeIcon icon={faDownload} className="jlab-gather-icon" />
27+
Download
28+
</button>
29+
</div>
30+
);
31+
};
32+
33+
export default DownloadCubeButton;
34+
35+
//https://raw.githubusercontent.com/QuantStack/jupyterlab-gather/main/pattern-files

src/components/modals/DeviceSettingModal.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import React, { ChangeEvent, useEffect, useRef } from 'react';
33

44
import { useCubeStore } from '../../store';
55
import Modal from './Modal';
6+
import DownloadCubeButton from '../buttons/DownloadCubeButton';
67

78
interface IAddNewModelModalProps {
89
isOpen: boolean;
@@ -60,6 +61,7 @@ const DeviceSettingModal = ({ isOpen, onClose }: IAddNewModelModalProps) => {
6061
updateDeviceOnChange(e.target.value, DeviceType.audioOutput)
6162
}
6263
/>
64+
<DownloadCubeButton />
6365
</div>
6466
</Modal>
6567
);

0 commit comments

Comments
 (0)