-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
286 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import React, { useContext } from "react"; | ||
import { Icon } from '@iconify/react'; | ||
|
||
import { AppContext } from "../contexts/context"; | ||
|
||
import "../styles/popups/popup.css"; | ||
import "../styles/popups/edit.css"; | ||
|
||
function Edit() { | ||
const { | ||
showEdit, setShowEdit, | ||
editContent, | ||
editType, | ||
setShowOverlay | ||
} = useContext(AppContext); | ||
|
||
if (!showEdit) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<div className="Popup"> | ||
<div className="Edit-title">Edit</div> | ||
<div className="Edit-input"> | ||
<label htmlFor="collection">Collection</label> | ||
|
||
<select id="collection" name="collection"> | ||
<option value="links">Links</option> | ||
<option value="notes">Notes</option> | ||
<option value="todos">Todos</option> | ||
</select> | ||
|
||
<label htmlFor="title">Title</label> | ||
<input type="text" id="title" name="title" defaultValue={editType === 'modify' ? editContent?.Title : ''} /> | ||
|
||
<label htmlFor="url">Url</label> | ||
<input type="url" id="url" name="url" defaultValue={editType === 'modify' ? editContent?.Url : ''} /> | ||
|
||
<label htmlFor="category">Category</label> | ||
<input type="text" id="category" name="category" defaultValue={editType === 'modify' ? editContent?.Category : ''} /> | ||
|
||
<label htmlFor="description">Description</label> | ||
<input type="text" id="description" name="description" defaultValue={editType === 'modify' ? editContent?.Description : ''} /> | ||
|
||
<label htmlFor="detail">Detail</label> | ||
<textarea id="detail" name="detail" defaultValue={editType === 'modify' ? editContent?.Detail : ''} /> | ||
|
||
<label htmlFor="links">Links</label> | ||
<div className="Edit-links"> | ||
{editType === 'modify' && editContent?.links?.map((link) => ( | ||
<div key={link.Url} className="Edit-link"> | ||
<input type="text" name="link-title" className="Edit-link-title" defaultValue={link.Title} /> | ||
<input type="url" name="link-url" className="Edit-link-url" defaultValue={link.Url} /> | ||
<Icon icon="ci:trash-full" className="Edit-link-delete"></Icon> | ||
</div> | ||
))} | ||
<Icon icon="ci:table-add" className="Edit-links-add"></Icon> | ||
</div> | ||
</div> | ||
<button type="button" className="Edit-ok" title="Save edit">Save</button> | ||
<button type="button" className="Edit-close" title="Close" onClick={() => { | ||
setShowEdit(false); | ||
setShowOverlay(false); | ||
}}> | ||
<Icon icon="ci:close-md" /> | ||
</button> | ||
</div> | ||
); | ||
} | ||
|
||
export default Edit; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,161 @@ | ||
.Edit-title { | ||
font-size: 2rem; | ||
text-transform: capitalize; | ||
font-weight: 900; | ||
} | ||
|
||
.Edit-input { | ||
display: grid; | ||
gap: 1rem; | ||
grid-template-columns: auto 1fr; | ||
|
||
align-items: start; | ||
justify-content: center; | ||
|
||
max-height: 500px; | ||
overflow-y: auto; | ||
} | ||
|
||
.Edit-input select { | ||
font-size: 1rem; | ||
padding: 0.5rem; | ||
|
||
width: 200px; | ||
|
||
border: none; | ||
border-radius: 5px; | ||
background-color: #f0f0f0; | ||
|
||
border: 2px solid transparent; | ||
|
||
cursor: pointer; | ||
} | ||
|
||
.Edit-input select:focus { | ||
outline: none; | ||
border-bottom: 2px solid #333333; | ||
} | ||
|
||
.Edit-input select option { | ||
font-size: 1rem; | ||
cursor: pointer; | ||
} | ||
|
||
.Edit-input input { | ||
font-size: 1rem; | ||
padding: 0.5rem; | ||
|
||
width: 500px; | ||
|
||
border: none; | ||
border-radius: 5px; | ||
background-color: #f0f0f0; | ||
|
||
border: 2px solid transparent; | ||
} | ||
|
||
.Edit-input input:focus { | ||
outline: none; | ||
border-bottom: 2px solid #333333; | ||
} | ||
|
||
.Edit-input textarea { | ||
font-size: 1rem; | ||
padding: 0.5rem; | ||
|
||
width: 500px; | ||
min-height: 4.5rem; | ||
max-height: 9rem; | ||
|
||
border: none; | ||
border-radius: 5px; | ||
background-color: #f0f0f0; | ||
|
||
border: 2px solid transparent; | ||
|
||
resize: vertical; | ||
} | ||
|
||
.Edit-input textarea:focus { | ||
outline: none; | ||
border-bottom: 2px solid #333333; | ||
} | ||
|
||
.Edit-input .Edit-links { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 1rem; | ||
width: 516px; | ||
} | ||
|
||
.Edit-input .Edit-links .Edit-link { | ||
display: flex; | ||
gap: 1rem; | ||
width: 100%; | ||
} | ||
|
||
.Edit-input .Edit-links .Edit-link .Edit-link-title { | ||
width: 200px; | ||
} | ||
|
||
.Edit-input .Edit-links .Edit-link .Edit-link-url {} | ||
|
||
.Edit-input .Edit-links .Edit-link .Edit-link-delete { | ||
font-size: 1.5rem; | ||
width: 4rem; | ||
color: white; | ||
background-color: rgba(255, 0, 0, 0.5); | ||
padding: 0.5rem; | ||
border-radius: 5px; | ||
cursor: pointer; | ||
} | ||
|
||
.Edit-input .Edit-links .Edit-link .Edit-link-delete:hover { | ||
background-color: rgba(255, 0, 0, 1); | ||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2); | ||
transition: box-shadow 0.1s; | ||
} | ||
|
||
.Edit-input .Edit-links .Edit-links-add { | ||
font-size: 1.8rem; | ||
color: black; | ||
cursor: pointer; | ||
} | ||
|
||
.Edit-input label { | ||
font-size: 1.2rem; | ||
font-weight: 700; | ||
} | ||
|
||
.Edit-ok { | ||
font-size: 1rem; | ||
padding: 0.5rem; | ||
background-color: #333333; | ||
color: #fff; | ||
border: none; | ||
border-radius: 5px; | ||
cursor: pointer; | ||
width: 100%; | ||
margin: 0 auto; | ||
text-transform: uppercase; | ||
font-weight: 700; | ||
} | ||
|
||
.Edit-ok:hover { | ||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.5); | ||
transition: box-shadow 0.1s; | ||
} | ||
|
||
.Edit-close { | ||
position: absolute; | ||
top: 0; | ||
right: 0; | ||
font-size: 2rem; | ||
padding: 0.5rem; | ||
border-radius: 5px; | ||
cursor: pointer; | ||
|
||
color: #333; | ||
background-color: #fff; | ||
border: none; | ||
} |
Oops, something went wrong.