From 4f3716b641ba9f39e6ecbef53206de66bdff0196 Mon Sep 17 00:00:00 2001 From: Rokas Puzonas Date: Sat, 9 Apr 2022 14:37:55 +0000 Subject: [PATCH] feat: add reset button --- src/components/DiscRow.tsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/components/DiscRow.tsx b/src/components/DiscRow.tsx index 90eb881..6d4b513 100644 --- a/src/components/DiscRow.tsx +++ b/src/components/DiscRow.tsx @@ -1,12 +1,13 @@ import DiscTooltip from "./DiscTooltip" -import { selectDiscs, useAppSelector } from "../store" +import { selectDiscs, useAppDispatch, useAppSelector } from "../store" import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" import { solid } from "@fortawesome/fontawesome-svg-core/import.macro" import ReactTooltip from "react-tooltip" import EditNameModal from "./EditNameModal" +import { setDescription, setTitle } from "../store/discs" +import { useState } from "react" import "./DiscRow.css" -import { useState } from "react" interface DiscRowProps { discId: number @@ -18,9 +19,15 @@ function DiscRow({ discId }: DiscRowProps) { const [showEditName, setShowEditName] = useState(false); + const dispatch = useAppDispatch() + function onReset() { + dispatch(setTitle({ id: discId, title: "" })) + dispatch(setDescription({ id: discId, description: "" })) + } + return (
-