Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove copy-to-clipboard dependency #348

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"@types/react-dom": "18.0.10",
"@vercel/analytics": "^1.1.0",
"clsx": "^2.0.0",
"copy-to-clipboard": "^3.3.3",
"eslint-config-next": "^13.2.3",
"framer-motion": "^9.0.1",
"next": "13.4.19",
Expand Down
3 changes: 1 addition & 2 deletions website/src/components/CodeBlock/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react';
import Highlight, { defaultProps } from 'prism-react-renderer';
import useMeasure from 'react-use-measure';
import copy from 'copy-to-clipboard';
import { AnimatePresence, motion, MotionConfig } from 'framer-motion';

import styles from './code-block.module.css';
Expand Down Expand Up @@ -50,7 +49,7 @@ export const CodeBlock = ({ children, initialHeight = 0 }: { children: string; i
const [copying, setCopying] = React.useState<number>(0);

const onCopy = React.useCallback(() => {
copy(children);
navigator.clipboard.writeText(children)
setCopying((c) => c + 1);
setTimeout(() => {
setCopying((c) => c - 1);
Expand Down
3 changes: 1 addition & 2 deletions website/src/components/Installation/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use client';

import React from 'react';
import copy from 'copy-to-clipboard';
import { motion, AnimatePresence, MotionConfig } from 'framer-motion';

import styles from './installation.module.css';
Expand All @@ -15,7 +14,7 @@ export const Installation = () => {
const [copying, setCopying] = React.useState(0);

const onCopy = React.useCallback(() => {
copy('npm install sonner');
navigator.clipboard.writeText('npm install sonner')
setCopying((c) => c + 1);
setTimeout(() => {
setCopying((c) => c - 1);
Expand Down