-
-
-
- {props.code}
-
-
-
{props.title || props.id}
-
- Edited {formatDistanceToNow(correctTimestamp(props.updatedAt), { addSuffix: true })}
-
-
+
+
+
+
+ {props.code}
+
-
-
-
+
{props.title || props.id}
+
+ Edited {formatDistanceToNow(correctTimestamp(props.updatedAt), { addSuffix: true })}
+
+
+
+
+
+
+
+ Delete
+
+
+
+
)
}
@@ -127,9 +155,9 @@ function ActionButton(props) {
border
center
margin="0.5rem"
- flex="0 0 266px"
+ flex="unset"
color={COLORS.GRAY}
- style={{ minHeight: 266 }}
+ style={{ width: 266, minHeight: 266 }}
{...props}
/>
)
@@ -164,6 +192,10 @@ function SnippetsPage() {
}
}, [loadMore, page, user])
+ function deleteSnippet(id) {
+ return api.snippet.delete(id).then(() => setSnippets(curr => curr.filter(s => s.id !== id)))
+ }
+
if (!user) {
return
}
@@ -171,7 +203,12 @@ function SnippetsPage() {
return (
{snippets.map(snippet => (
-
+
))}
{snippets.length && previousRes && previousRes.length < 10 ? null : (