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 editItem from '../modules/send';
// deleteEntity(e._id, reFetch)
const EditItem = ({tags, item, onExit, SetLoader, reFetch}) => {
const [name, setName] = useState(item.name);
const [tag, setTag] = useState(item.tag);
function EditItem() {
SetLoader(true)
editItem(name, item.link, tag, reFetch, onExit, SetLoader, "PUT", item._id);
SetLoader(true);
editItem(name, item.link, tag, reFetch, onExit, SetLoader, "PUT", item._id, item.title);
}
function deleteItem() {
SetLoader(true)
deleteEntity(item._id, reFetch, onExit, SetLoader)
SetLoader(true);
deleteEntity(item._id, reFetch, onExit, SetLoader);
}
function SetName(e) {

View File

@ -42,7 +42,7 @@ const List = ({data, tags, reFetch, SetLoader}) => {
</div>
<div className='etc'>
<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>
</LazyLoad>)

View File

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

View File

@ -72,10 +72,10 @@
border-radius: 100%;
margin: 20px 20px 20px 0px;
font-family: 'Font Awesome 5 Free';
width: 40px;
height: 40px;
width: 50px;
height: 50px;
padding: 10px;
font-size: 1.1rem;
font-size: 1.3rem;
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;
color: #ffffffb6;
@ -126,6 +126,9 @@
.delete {
float: right;
font-size: 1.1rem;
width: 40px;
height: 40px;
}
.delete:hover {