Skip to content

Commit

Permalink
Merge pull request #66 from irfan-iiitr/url-copied
Browse files Browse the repository at this point in the history
copy link ui improved
  • Loading branch information
Nishitbaria authored May 14, 2024
2 parents 4b262a1 + 6322225 commit 0ca522d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/ui/Share.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,16 @@ import {
DialogTrigger,
} from "@/components/ui/dialog";
import { Button } from "./button";
import { useState } from "react";

type ShareProps = {
shareurl: string;
handleShare: () => void;
};

const Share = ({ shareurl, handleShare }: ShareProps) => {

const [urlCopied, setUrlCopied] = useState(false);
const data = [
{
label: "Facebook",
Expand Down Expand Up @@ -111,8 +114,9 @@ const Share = ({ shareurl, handleShare }: ShareProps) => {
value={shareurl}
></input>
<Button
className="bg-white"
className={urlCopied ? 'bg-green-400' : 'bg-white'}
onClick={() => {
setUrlCopied(true);
window.navigator.clipboard.writeText(shareurl);
}}
>
Expand Down

0 comments on commit 0ca522d

Please sign in to comment.