Skip to content

Commit 374866d

Browse files
feat: use toast.promise and chirag's styling (#38)
* feat: use toast.promise and chirag's styling * yeet: yeet return
1 parent fdfa875 commit 374866d

File tree

2 files changed

+7
-15
lines changed

2 files changed

+7
-15
lines changed

frontend/src/styles/styles.scss

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,13 @@ $fg-color: #f7f7f7;
2121
$fg-inverse: #3d3d3d;
2222

2323
.toast {
24-
background-color: $bg-color !important;
24+
background-color: $surface-1 !important;
2525
color: $fg-color !important;
2626
fill: $fg-color !important;
2727

28-
border: 1px solid $accent-color;
2928
border-radius: 10px !important;
3029
}
3130

32-
.toast-err {
33-
border: 1px solid rgba(rgb(194, 42, 42), 0.7);
34-
}
35-
3631
body {
3732
color: rgba($fg-color, 0.8);
3833
background-color: $bg-color;

frontend/src/utils/copyLink.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
import { toast } from 'solid-toast';
22

3-
export async function copyLink(e: Event, link: string) {
3+
export function copyLink(e: Event, link: string) {
44
e.preventDefault();
55

6-
try {
7-
await navigator.clipboard.writeText(link);
8-
toast('Link copied to clipboard.');
9-
} catch (e) {
10-
toast('Error copying link to the clipboard.', {
11-
className: "toast toast-err"
12-
});
13-
}
6+
toast.promise(navigator.clipboard.writeText(link), {
7+
loading: "Copying link to clipboard...",
8+
success: "Link copied to clipboard.",
9+
error: "Failed to copy link to clipboard."
10+
})
1411
}

0 commit comments

Comments
 (0)