-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: highlight component into sections
- Loading branch information
1 parent
ac73da5
commit 7fbfa8d
Showing
13 changed files
with
316 additions
and
140 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { UseFieldArrayRemove } from "react-hook-form"; | ||
import { Button } from "../ui/button"; | ||
import { Textarea } from "../ui/textarea"; | ||
|
||
export interface HighlightPropTypes { | ||
index: number | ||
} | ||
|
||
export function HighlightForm({ isFirst, id, formProps, remove }: { isFirst: boolean, id: string, formProps: any, remove: UseFieldArrayRemove }) { | ||
return ( | ||
<> | ||
<Textarea | ||
rows={2} | ||
className="min-h-fit" | ||
key={id} | ||
label={isFirst ? 'Highlight (Impact)' : ''} | ||
placeholder={isFirst ? 'Enter your impact during this period' : ''} | ||
{...formProps} | ||
/> | ||
<div className="flex justify-end"> | ||
<Button | ||
variant='link' | ||
onClick={() => remove()} | ||
className="p-0 h-auto text-xs text-muted-foreground" | ||
type="button" | ||
> | ||
Remove | ||
</Button> | ||
</div > | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { Trash2 } from "lucide-react" | ||
import { Button } from "../ui/button" | ||
|
||
interface SectionItemFooterProps { | ||
onRemoveBlock: () => void | ||
onAddHighlight: () => void | ||
} | ||
|
||
export function SectionItemFooter({ onRemoveBlock, onAddHighlight }: SectionItemFooterProps) { | ||
return ( | ||
<div className="flex gap-2"> | ||
<Button type="button" onClick={onAddHighlight}>Add Highlight</Button> | ||
<Button variant='outline' className="text-destructive hover:text-red-600" onClick={onRemoveBlock}> | ||
<Trash2 size={18} className="mr-2" /> | ||
<span>Remove Block</span> | ||
</Button> | ||
</div> | ||
) | ||
} |
Oops, something went wrong.