diff --git a/express_backend/database.db b/express_backend/database.db index 96ae050..a01aa4b 100644 Binary files a/express_backend/database.db and b/express_backend/database.db differ diff --git a/react_frontend/src/Idea.js b/react_frontend/src/Idea.js index e89f262..ba27755 100644 --- a/react_frontend/src/Idea.js +++ b/react_frontend/src/Idea.js @@ -7,6 +7,15 @@ function Idea({ideaId, title, description, timestamp}){ let [t, setT] = useState(title); let [d, setD] = useState(description); + + const deleteIdea = async () => { + let data = await fetch('http://localhost:5000/idea/delete/' + ideaId); + const result = await data.json(); + console.log(result) + if(result.title === "Success"){ + window.location.reload(); + } + } const fetchIdea = async () => { const data = await fetch( 'http://localhost:5000/idea/get/' + params.ideaId @@ -35,7 +44,11 @@ function Idea({ideaId, title, description, timestamp}){

{t}

{d}

-

{timestamp}

+
+

Delete

+

{timestamp}

+
+
) diff --git a/react_frontend/src/IdeaList.js b/react_frontend/src/IdeaList.js index 6b19433..ce6bf62 100644 --- a/react_frontend/src/IdeaList.js +++ b/react_frontend/src/IdeaList.js @@ -1,12 +1,8 @@ import React, {useState, useEffect} from 'react'; import Idea from './Idea'; import './css/IdeaList.scss'; -import { useParams} from 'react-router-dom' function IdeaList() { - - let params = useParams() - let selectedIdeaId = params.ideaId; let [ideas, setIdeas] = useState([]); const createIdea = async() => { diff --git a/react_frontend/src/css/IdeaList.scss b/react_frontend/src/css/IdeaList.scss index 3f3d0a1..fc83fa9 100644 --- a/react_frontend/src/css/IdeaList.scss +++ b/react_frontend/src/css/IdeaList.scss @@ -100,14 +100,36 @@ white-space: nowrap; overflow: hidden; } - - .timestamp{ + + .right{ float: right; - width: 60px; - margin-top: 10px; - font-size: 0.7em; - color: rgba(195, 195, 195, 0.572); + + .timestamp{ + + width: 60px; + + font-size: 0.7em; + color: rgba(195, 195, 195, 0.572); + } + + .delete{ + font-size: 11pt; + color: rgb(177, 0, 0); + margin-top: -20px; + padding-bottom: 20px; + text-align: right; + padding-right: 5px; + text-transform: uppercase; + transition: 50ms; + transition-timing-function: linear; + + &:hover{ + text-decoration: underline; + color: rgb(255, 45, 45); + } + } } + } .current{