Skip to content

Commit 7217e7b

Browse files
committed
style: create a whole sections instead of having the create custom statement floating around
1 parent aa2517e commit 7217e7b

File tree

2 files changed

+46
-23
lines changed

2 files changed

+46
-23
lines changed

src/features/statements/components/StatementList.tsx

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ import statementsCategories from '@/data/statementsCategories.json';
1313
import { formatCategoryName } from '@/lib/utils';
1414
import { updateEntry } from '../api/entriesApi';
1515
import { EditStatementModal } from '../../wizard/components/EditStatementModal';
16-
import { BellOff, ChevronUp, ChevronDown } from 'lucide-react';
16+
import { BellOff, ChevronUp, ChevronDown, Plus } from 'lucide-react';
17+
import { Button } from '../../../components/ui/button';
1718

1819
// Helper function to normalize category IDs for consistent comparison
1920
const normalizeCategoryIdForGrouping = (id: string): string => {
@@ -58,7 +59,15 @@ const groupStatementsByCategory = (statements: Entry[]) => {
5859
}, {});
5960
};
6061

61-
const StatementList: React.FC<{ username: string }> = ({ username }) => {
62+
interface StatementListProps {
63+
username: string;
64+
onAddCustomStatement?: () => void;
65+
}
66+
67+
const StatementList: React.FC<StatementListProps> = ({
68+
username,
69+
onAddCustomStatement
70+
}) => {
6271
const { data, setData } = useEntries();
6372
const { entries } = data;
6473

@@ -541,6 +550,26 @@ const StatementList: React.FC<{ username: string }> = ({ username }) => {
541550
{/* Snoozed sections */}
542551
{renderSnoozedQuestionsSection()}
543552

553+
{/* Add custom statement section */}
554+
{onAddCustomStatement && (
555+
<div className="mt-8 border-t pt-8 text-center">
556+
<div className="max-w-md mx-auto">
557+
<h3 className="text-lg font-medium text-gray-700 mb-2">Want to add your own statement?</h3>
558+
<p className="text-gray-500 mb-4">
559+
Create a custom statement to add anything that's not covered by the questions above.
560+
</p>
561+
<Button
562+
onClick={onAddCustomStatement}
563+
variant="pink"
564+
className="flex items-center px-6 py-2 mx-auto shadow-sm"
565+
>
566+
<Plus className="w-5 h-5 mr-2" />
567+
<span>Add custom statement</span>
568+
</Button>
569+
</div>
570+
</div>
571+
)}
572+
544573
<ConfirmationDialog
545574
isOpen={deleteConfirmation.isOpen}
546575
onClose={handleDeleteCancel}

src/layouts/components/MainPage.tsx

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
import StatementList from '../../features/statements/components/StatementList';
1010
import { useEntries } from '../../features/statements/hooks/useEntries';
1111
import { Button } from '../../components/ui/button';
12-
import { Plus, Mail } from 'lucide-react';
12+
import { Mail } from 'lucide-react';
1313
import StatementWizard from '../../features/wizard/components/StatementWizard';
1414
import ShareEmailModal from '../../components/modals/ShareEmailModal';
1515
import PrivacyModal from '../../components/modals/PrivacyModal';
@@ -54,35 +54,29 @@ const MainPage: React.FC = () => {
5454
? `${username} would like to share with ${managerName}`
5555
: `${username}'s statements for sharing`}
5656
</h1>
57-
58-
<Button
59-
onClick={handleNewStatement}
60-
variant='pink'
61-
className='flex items-center px-3 h-10 shadow-sm whitespace-nowrap self-start'
62-
>
63-
<Plus className='w-5 h-5 mr-1 flex-shrink-0' />
64-
<span>Add statement</span>
65-
</Button>
6657
</div>
6758
</div>
6859

6960
<div className='container mx-auto px-4 flex-grow'>
70-
<StatementList username={username} />
61+
<StatementList
62+
username={username}
63+
onAddCustomStatement={handleNewStatement}
64+
/>
7165
</div>
72-
66+
7367
{/* Footer with privacy links */}
74-
<footer className="mt-auto pt-6 pb-4 bg-gray-50 border-t border-gray-200">
75-
<div className="container mx-auto px-4">
76-
<div className="flex flex-col sm:flex-row justify-center items-center text-xs text-gray-500 space-y-2 sm:space-y-0 sm:space-x-4">
77-
<button
68+
<footer className='mt-auto pt-6 pb-4 bg-gray-50 border-t border-gray-200'>
69+
<div className='container mx-auto px-4'>
70+
<div className='flex flex-col sm:flex-row justify-center items-center text-xs text-gray-500 space-y-2 sm:space-y-0 sm:space-x-4'>
71+
<button
7872
onClick={() => setIsPrivacyModalOpen(true)}
79-
className="hover:text-brand-pink hover:underline"
73+
className='hover:text-brand-pink hover:underline'
8074
>
8175
Privacy Policy
8276
</button>
83-
<button
77+
<button
8478
onClick={() => setIsTermsModalOpen(true)}
85-
className="hover:text-brand-pink hover:underline"
79+
className='hover:text-brand-pink hover:underline'
8680
>
8781
Terms of Use
8882
</button>
@@ -139,12 +133,12 @@ const MainPage: React.FC = () => {
139133
{isShareModalOpen && (
140134
<ShareEmailModal onClose={() => setIsShareModalOpen(false)} />
141135
)}
142-
136+
143137
{/* Conditionally render the privacy modal */}
144138
{isPrivacyModalOpen && (
145139
<PrivacyModal onClose={() => setIsPrivacyModalOpen(false)} />
146140
)}
147-
141+
148142
{/* Conditionally render the terms modal */}
149143
{isTermsModalOpen && (
150144
<TermsModal onClose={() => setIsTermsModalOpen(false)} />

0 commit comments

Comments
 (0)