Skip to content

Commit

Permalink
Fix/hide add new favorite button (#208)
Browse files Browse the repository at this point in the history
* chore: Remove unused code

* fix: Hide button if nothing is typed in yet
  • Loading branch information
devcshort authored Oct 29, 2024
1 parent 70c5efd commit 171bb29
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
1 change: 0 additions & 1 deletion src/features/home/components/categories-section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { Separator } from '@/shared/components/ui/separator';
import { Card, CardContent } from '@/shared/components/ui/card';
import { useCategories } from '@/shared/hooks/use-categories';
import { ExternalLink } from 'lucide-react';
import { cn } from '@/shared/lib/utils';

type Props = {
index: string;
Expand Down
24 changes: 13 additions & 11 deletions src/shared/components/add-to-favorites-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,17 +129,19 @@ export function AddToFavoritesButton({
onChange={(e) => setValue(e.target.value)}
/>

{fetching.status === 'success' && fetching.data.length === 0 && (
<div className="flex items-center gap-4">
<p className="text-sm text-red-600">
{t('modal.add_to_list.not_found')}
</p>

<Button variant="outline" size="sm" onClick={createNewList()}>
{t('modal.add_to_list.create_new_list')}
</Button>
</div>
)}
{fetching.status === 'success' &&
fetching.data.length === 0 &&
value?.length > 0 && (
<div className="flex items-center gap-4">
<p className="text-sm text-red-600">
{t('modal.add_to_list.not_found')}
</p>

<Button variant="outline" size="sm" onClick={createNewList()}>
{t('modal.add_to_list.create_new_list')}
</Button>
</div>
)}

<Separator />

Expand Down

0 comments on commit 171bb29

Please sign in to comment.