This commit is contained in:
Daniel 2022-06-04 16:19:41 +04:30
parent e57365fd0c
commit dac172a5c5
5 changed files with 13 additions and 12 deletions

View File

@ -4,20 +4,18 @@ import '../styles/AddItem.css';
import TagSelection from './TagSelection'; import TagSelection from './TagSelection';
import editItem from '../modules/send'; import editItem from '../modules/send';
// deleteEntity(e._id, reFetch)
const EditItem = ({tags, item, onExit, SetLoader, reFetch}) => { const EditItem = ({tags, item, onExit, SetLoader, reFetch}) => {
const [name, setName] = useState(item.name); const [name, setName] = useState(item.name);
const [tag, setTag] = useState(item.tag); const [tag, setTag] = useState(item.tag);
function EditItem() { function EditItem() {
SetLoader(true) SetLoader(true);
editItem(name, item.link, tag, reFetch, onExit, SetLoader, "PUT", item._id); editItem(name, item.link, tag, reFetch, onExit, SetLoader, "PUT", item._id, item.title);
} }
function deleteItem() { function deleteItem() {
SetLoader(true) SetLoader(true);
deleteEntity(item._id, reFetch, onExit, SetLoader) deleteEntity(item._id, reFetch, onExit, SetLoader);
} }
function SetName(e) { function SetName(e) {

View File

@ -42,7 +42,7 @@ const List = ({data, tags, reFetch, SetLoader}) => {
</div> </div>
<div className='etc'> <div className='etc'>
<ViewArchived className='view-archived' id={e._id} /> <ViewArchived className='view-archived' id={e._id} />
<button className="edit-btn" onClick={() => edit(i)}>&#xf044;</button> <button className="edit-btn" onClick={() => edit(i)}>&#xf303;</button>
</div> </div>
</div> </div>
</LazyLoad>) </LazyLoad>)

View File

@ -1,7 +1,7 @@
import config from '../config'; import config from '../config';
import { nanoid } from 'nanoid'; import { nanoid } from 'nanoid';
const addItem = async (name, link, tag, reFetch, onExit, SetLoader, method, id=nanoid()) => { const addItem = async (name, link, tag, reFetch, onExit, SetLoader, method, id=nanoid(), title='') => {
function isValidHttpUrl(string) { function isValidHttpUrl(string) {
let url; let url;
@ -21,7 +21,7 @@ const addItem = async (name, link, tag, reFetch, onExit, SetLoader, method, id=n
body: JSON.stringify({ body: JSON.stringify({
_id: id, _id: id,
name: name, name: name,
title: '', title: title,
link: link, link: link,
tag: tag tag: tag
}), }),

View File

@ -72,10 +72,10 @@
border-radius: 100%; border-radius: 100%;
margin: 20px 20px 20px 0px; margin: 20px 20px 20px 0px;
font-family: 'Font Awesome 5 Free'; font-family: 'Font Awesome 5 Free';
width: 40px; width: 50px;
height: 40px; height: 50px;
padding: 10px; padding: 10px;
font-size: 1.1rem; font-size: 1.3rem;
cursor: pointer; cursor: pointer;
box-shadow: rgba(0, 0, 0, 0.4) 0px 2px 4px, rgba(0, 0, 0, 0.3) 0px 7px 13px -3px, rgba(0, 0, 0, 0.2) 0px -3px 0px inset; box-shadow: rgba(0, 0, 0, 0.4) 0px 2px 4px, rgba(0, 0, 0, 0.3) 0px 7px 13px -3px, rgba(0, 0, 0, 0.2) 0px -3px 0px inset;
color: #ffffffb6; color: #ffffffb6;
@ -126,6 +126,9 @@
.delete { .delete {
float: right; float: right;
font-size: 1.1rem;
width: 40px;
height: 40px;
} }
.delete:hover { .delete:hover {