Skip to content

Commit

Permalink
npm install - copy command to clipboard, disabled input field.
Browse files Browse the repository at this point in the history
  • Loading branch information
darsan-in committed Nov 27, 2024
1 parent c245f19 commit 1447a16
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion components/utils/npm-install.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,22 @@ export default function NPMInstall({ className }: { className: string }) {
return (
<div className={className}>
<button className="text-gray-500 hover:text-primary absolute right-3 inset-y-0 my-auto active:text-gray-600">
<RiFileCopyLine />
<RiFileCopyLine
onClick={() => {
navigator.clipboard
.writeText("npm i @cresteem/richie-js")
.then(() => {
alert("Now paste it on terminal: ctrl + v");
})
.catch((err) => {
console.error("Failed to copy text: ", err);
});
}}
/>
</button>
<input
type="text"
disabled
placeholder="npm i @cresteem/richie-js"
className="w-full pr-12 pl-3 py-2 placeholder:text-gray-500 bg-transparent outline-none border focus:border-indigo-600 shadow-sm rounded-lg"
/>
Expand Down

0 comments on commit 1447a16

Please sign in to comment.