2022-05-04 07:30:06 +02:00
|
|
|
import { Button } from '@mantine/core';
|
2022-04-27 03:12:05 +02:00
|
|
|
import fileDownload from 'js-file-download';
|
|
|
|
|
import { Download } from 'tabler-icons-react';
|
2022-05-02 15:09:39 +02:00
|
|
|
import { useConfig } from '../../tools/state';
|
2022-04-27 03:12:05 +02:00
|
|
|
|
|
|
|
|
export default function SaveConfigComponent(props: any) {
|
2022-05-02 15:09:39 +02:00
|
|
|
const { config } = useConfig();
|
2022-04-27 03:12:05 +02:00
|
|
|
function onClick(e: any) {
|
2022-05-02 15:09:39 +02:00
|
|
|
if (config) {
|
2022-05-06 23:19:05 +02:00
|
|
|
fileDownload(JSON.stringify(config, null, '\t'), 'config.json');
|
2022-04-27 03:12:05 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return (
|
2022-04-30 21:51:37 +02:00
|
|
|
<Button leftIcon={<Download />} variant="outline" onClick={onClick}>
|
|
|
|
|
Download your config
|
|
|
|
|
</Button>
|
2022-04-27 03:12:05 +02:00
|
|
|
);
|
|
|
|
|
}
|