Skip to content

Commit

Permalink
fix: add contact button + trash button (#146)
Browse files Browse the repository at this point in the history
  • Loading branch information
chalabi2 authored Dec 10, 2024
1 parent 215915e commit 3ad83d5
Showing 1 changed file with 25 additions and 13 deletions.
38 changes: 25 additions & 13 deletions components/groups/forms/groups/GroupDetailsForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,19 +141,31 @@ export default function GroupDetails({
className="flex-grow"
rightElement={
values.authors.length > 1 && index !== 0 ? (
<button
type="button"
onClick={() => {
const newAuthors = values.authors.filter(
(_, i) => i !== index
);
setFieldValue('authors', newAuthors);
updateField('authors', newAuthors);
}}
className="btn btn-error btn-sm text-white"
>
<TrashIcon className="w-5 h-5" />
</button>
<div className="flex gap-2">
<button
type="button"
onClick={() => {
setActiveAuthorIndex(index);
setIsContactsOpen(true);
}}
className="btn btn-primary btn-sm text-white"
>
<MdContacts className="w-5 h-5" />
</button>
<button
type="button"
onClick={() => {
const newAuthors = values.authors.filter(
(_, i) => i !== index
);
setFieldValue('authors', newAuthors);
updateField('authors', newAuthors);
}}
className="btn btn-error btn-sm text-white"
>
<TrashIcon className="w-5 h-5" />
</button>
</div>
) : (
<div className="flex gap-2">
<button
Expand Down

0 comments on commit 3ad83d5

Please sign in to comment.