Files
Homarr/components/Config/SaveConfig.tsx

19 lines
540 B
TypeScript
Raw Normal View History

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';
import { useConfig } from '../../tools/state';
2022-04-27 03:12:05 +02:00
export default function SaveConfigComponent(props: any) {
const { config } = useConfig();
2022-04-27 03:12:05 +02:00
function onClick(e: any) {
if (config) {
fileDownload(JSON.stringify(config, null, '\t'), `${config.name}.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
);
}