Skip to content

Commit

Permalink
use the NewfoldRuntime.comingSoon api and add some inline styles
Browse files Browse the repository at this point in the history
  • Loading branch information
circlecube committed Aug 29, 2024
1 parent 1ce16b5 commit d235d74
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 57 deletions.
1 change: 0 additions & 1 deletion src/components/Icons/index.js

This file was deleted.

12 changes: 0 additions & 12 deletions src/components/Icons/launch.jsx

This file was deleted.

45 changes: 31 additions & 14 deletions src/components/Modal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,20 @@ import { __ } from '@wordpress/i18n';
* Internal dependencies
*/
import { store as nfdComingSoonStore } from '../store';
import { setComingSoon } from '../utils/api/comingSoon';

const Modal = () => {
const { setIsModalOpen } = useDispatch(nfdComingSoonStore);
const [isComingSoonActive, setIsComingSoonActive] = useState(true);

const { isModalOpen } = useSelect((select) => ({
isModalOpen: select(nfdComingSoonStore).isModalOpen(),
}));

const handlePublishAndLaunch = () => {
setComingSoon(false);
setIsComingSoonActive(false);
window.NewfoldRuntime.comingSoon.disable();
setIsModalOpen(false);
};

if (!isModalOpen || !isComingSoonActive) {
if (!isModalOpen || !window.NewfoldRuntime.comingSoon.isEnabled) {
return null;
}

Expand All @@ -49,16 +46,36 @@ const Modal = () => {
<div>
<p>{heading}</p>
<br />
<Button variant="primary" onClick={handlePublishAndLaunch}>
{launchButtonText}
</Button>
&nbsp;
<Button
variant="secondary"
onClick={() => setIsModalOpen(false)}
<div
style={ {
alignContent: 'space-between',
display: 'flex',
flexWrap: 'wrap',
gap: '16px',
boxSizing: 'inherit',
} }
>
{withoutLaunchButtonText}
</Button>
<Button
variant="primary"
onClick={handlePublishAndLaunch}
style={{
flex: 1,
justifyContent: 'center',
}}
>
{launchButtonText}
</Button>
<Button
variant="link"
onClick={() => setIsModalOpen(false)}
style={{
flex: 1,
justifyContent: 'center',
}}
>
{withoutLaunchButtonText}
</Button>
</div>
</div>
</WP2Modal>
);
Expand Down
16 changes: 0 additions & 16 deletions src/utils/api/comingSoon.js

This file was deleted.

14 changes: 0 additions & 14 deletions src/utils/api/resolve.js

This file was deleted.

0 comments on commit d235d74

Please sign in to comment.