Skip to content

Commit 831993c

Browse files
committed
feat: codename styles
1 parent c88f8db commit 831993c

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

src/components/Toast.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { motion } from 'framer-motion';
33
import { XIcon } from '@phosphor-icons/react';
44
import colors from '../config/colors';
55

6-
const Toast = ({ id, title, message, duration, removeToast }) => {
6+
const Toast = ({ id, title, message, duration = 3000, removeToast }) => {
77
useEffect(() => {
88
const timer = setTimeout(() => {
99
removeToast(id);

src/pages/apps/CodenameGeneratorPage.js

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,14 @@ const CodenameGeneratorPage = () => {
5555
setCodename(`${prefix} ${noun}`);
5656
};
5757

58-
const handleCopy = () => {
59-
navigator.clipboard.writeText(codename);
60-
addToast('Copied to clipboard!', 'success');
58+
const handleCopy = async () => {
59+
try {
60+
await navigator.clipboard.writeText(codename);
61+
addToast({title: 'Success', message: 'Codename is copied to clipboard!', duration: 3000});
62+
} catch (err) {
63+
addToast({title: 'Failure', message: 'Failed to copy name!', duration: 3000});
64+
console.error('Failed to copy: ', err);
65+
}
6166
};
6267

6368
const cardStyle = {
@@ -100,16 +105,10 @@ const CodenameGeneratorPage = () => {
100105
<h1 className="text-3xl font-arvo font-normal mb-4 text-app"> Codename Generator </h1>
101106
<hr className="border-gray-700 mb-4" />
102107
<div className="flex flex-col items-center gap-8">
103-
<div className="relative text-4xl text-rose-600 font-bold text-center h-16 mt-12">
108+
<div className="relative text-4xl text-lime-100 font-bold text-center h-16 mt-12">
104109
<div
105-
className="absolute top-0 left-0 w-full h-full text-stone-950"
106-
style={{ fontFamily: 'Playfair Display, serif', transition: 'all 0.5s ease-in-out', transform: 'translate(4px, 4px)' }}
107-
>
108-
{codename}
109-
</div>
110-
<div
111-
className="relative"
112-
style={{ fontFamily: 'Playfair Display, serif', transition: 'all 0.5s ease-in-out' }}
110+
className="relative underline"
111+
style={{ fontFamily: 'Playfair Display', textDecorationThickness: '20px' }}
113112
>
114113
{codename}
115114
</div>

0 commit comments

Comments
 (0)