-
Notifications
You must be signed in to change notification settings - Fork 63
Expand file tree
/
Copy pathAvatarPersistenceSavedItem.js
More file actions
30 lines (25 loc) · 1.01 KB
/
AvatarPersistenceSavedItem.js
File metadata and controls
30 lines (25 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import React, { useLayoutEffect } from "react";
import { faArrowAltCircleRight, faTrashAlt } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { deleteAvatarConfig, getAvatarConfig } from "../persistence";
export function AvatarPersistenceSavedItem({ slotKey, setAvatarConfig }) {
function loadAvatar() {
setAvatarConfig(getAvatarConfig(slotKey));
}
function deleteAvatar() {
deleteAvatarConfig(slotKey);
}
return (
<li>
<div>{slotKey}</div>
<div className="savedItemActions">
<button className="savedItemAction" title="Delete Icon" onClick={deleteAvatar}>
<FontAwesomeIcon icon={ faTrashAlt } />
</button>
<button className="savedItemAction" title="Load Avatar" onClick={loadAvatar}>
<FontAwesomeIcon icon={ faArrowAltCircleRight } />
</button>
</div>
</li>
)
}