strapi-plugin-config-sync/admin/src/components/FirstExport/index.js

40 lines
1.0 KiB
JavaScript
Raw Normal View History

2021-03-24 22:03:30 +01:00
import React, { useState } from 'react';
import { useDispatch } from 'react-redux';
2021-10-14 17:13:12 +02:00
import { Button } from '@strapi/design-system/Button';
2021-10-14 17:13:12 +02:00
2021-03-24 22:03:30 +01:00
import { exportAllConfig } from '../../state/actions/Config';
import ConfirmModal from '../ConfirmModal';
const FirstExport = () => {
const dispatch = useDispatch();
const [modalIsOpen, setModalIsOpen] = useState(false);
return (
2021-10-14 17:13:12 +02:00
<div style={{
2021-03-24 22:03:30 +01:00
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
flexDirection: 'column',
textAlign: 'center',
height: '300px',
2021-10-14 17:13:12 +02:00
}}>
2021-03-24 22:03:30 +01:00
<ConfirmModal
isOpen={modalIsOpen}
onClose={() => setModalIsOpen(false)}
2021-10-14 17:13:12 +02:00
type="export"
onSubmit={() => dispatch(exportAllConfig())}
2021-03-24 22:03:30 +01:00
/>
<h3>Looks like this is your first time using config-sync for this project.</h3>
<p>Make the initial export!</p>
2021-10-14 17:13:12 +02:00
<Button
onClick={() => setModalIsOpen(true)}
>
Initial export
</Button>
2021-03-24 22:03:30 +01:00
</div>
);
2021-10-14 17:13:12 +02:00
};
export default FirstExport;