// Copyright (C) 2022-present Daniel31x13 // This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. // You should have received a copy of the GNU General Public License along with this program. If not, see . import React, { useState } from "react"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faPlus } from "@fortawesome/free-solid-svg-icons"; import useCollectionStore from "@/store/collections"; import { NewCollection } from "@/types/global"; type Props = { toggleCollectionModal: Function; }; export default function AddCollection({ toggleCollectionModal }: Props) { const [newCollection, setNewCollection] = useState({ name: "", description: "", }); const { addCollection } = useCollectionStore(); const submitCollection = async () => { console.log(newCollection); const response = await addCollection(newCollection as NewCollection); if (response) toggleCollectionModal(); }; return (

New Collection

Name

setNewCollection({ ...newCollection, name: e.target.value }) } type="text" placeholder="e.g. Example Collection" className="w-96 rounded-md p-3 border-sky-100 border-solid border text-sm outline-none focus:border-sky-500 duration-100" />

Description

setNewCollection({ ...newCollection, description: e.target.value }) } type="text" placeholder="Collection description (Optional)" className="w-96 rounded-md p-3 border-sky-100 border-solid border text-sm outline-none focus:border-sky-500 duration-100" />
Add Collection
); }