Skip to content

Commit 2a75bd0

Browse files
committed
feat: reinstated add statement button
1 parent c42d207 commit 2a75bd0

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

src/components/MainPage.tsx

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,20 @@
33
import React from 'react';
44
import StatementList from './statements/StatementList';
55
import { useEntries } from '../hooks/useEntries';
6+
import { Button } from './ui/button';
7+
import { Plus } from 'lucide-react';
8+
import StatementWizard from './statementWizard/StatementWizard';
69

710
const MainPage: React.FC = () => {
811
const { data } = useEntries();
912
const { username } = data;
13+
const [isWizardOpen, setIsWizardOpen] = React.useState(false);
14+
15+
// Handler to open the wizard for creating a new statement from scratch
16+
const handleNewStatement = () => {
17+
setIsWizardOpen(true);
18+
};
19+
1020
return (
1121
<main className='min-h-screen bg-gradient-to-b from-gray-50 to-gray-100 py-12 '>
1222
<h1 className='text-3xl font-bold mb-8 text-center'>
@@ -15,6 +25,25 @@ const MainPage: React.FC = () => {
1525
<div className='container mx-auto px-4'>
1626
<StatementList username={username} />
1727
</div>
28+
{/* Floating Action Button (FAB) for creating a new custom statement */}
29+
30+
<Button
31+
onClick={handleNewStatement}
32+
variant='default'
33+
className='fixed bottom-8 right-8 rounded-full flex items-center space-x-2 px-6 py-3 shadow-lg bg-brand-pink text-white text-lg hover:bg-brand-darkPurple'
34+
>
35+
<Plus className='w-6 h-6' />
36+
<span className='text-lg'>Create your own statement</span>
37+
</Button>
38+
39+
{/* Conditionally render the wizard modal */}
40+
{isWizardOpen && (
41+
<StatementWizard
42+
username={username}
43+
onComplete={() => setIsWizardOpen(false)}
44+
onClose={() => setIsWizardOpen(false)}
45+
/>
46+
)}
1847
</main>
1948
);
2049
};

0 commit comments

Comments
 (0)