Skip to content

Commit

Permalink
Testing only: add examples for the new modals
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasr8 committed Jul 23, 2024
1 parent ce6369d commit db1561d
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion src/pages/Settings.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import {ReactNode, useEffect, useState} from 'react';
import {ChevronDownIcon, TrashIcon, WrenchScrewdriverIcon} from '@heroicons/react/20/solid';
import {Typography} from '../Components/Tailwind';
import {DangerButton, SimpleButton} from '../Components/Tailwind/Button';
import Button, {DangerButton, SimpleButton} from '../Components/Tailwind/Button';
import {Toggle} from '../Components/Tailwind/Toggle';
import TopNav from '../Components/TopNav';
import db from '../db/db';
import {useConfirmModal, useErrorModal} from '../hooks/useModal';
import useSettings from '../hooks/useSettings';
import {playSound, sounds} from '../utils/sound';

Expand Down Expand Up @@ -37,6 +38,8 @@ function MainSettings() {
hapticFeedback,
setHapticFeedback,
} = useSettings();
const errorModal = useErrorModal();
const confirmModal = useConfirmModal();

const toggleDarkMode = () => {
// Set the theme preference in localStorage and in the SettingsContext
Expand Down Expand Up @@ -86,6 +89,27 @@ function MainSettings() {
<SettingsSection title="Appearance">
<SettingsToggle title="Dark theme" checked={darkMode} onToggle={toggleDarkMode} />
</SettingsSection>
<Button
onClick={() => {
errorModal({
title: 'Oops! The application crashed.',
content: 'We blame the developers. They blame the caffeine shortage.',
});
}}
>
Show error
</Button>
<Button
onClick={() => {
confirmModal({
title: 'Unsubscribe from this newsletter?',
content: 'But what about the three people in the world who will notice?',
onConfirm: () => {},
});
}}
>
Show confirmation
</Button>
</div>
);
}
Expand Down

0 comments on commit db1561d

Please sign in to comment.