Skip to content

Commit

Permalink
chore: remove react-rough-fiber
Browse files Browse the repository at this point in the history
  • Loading branch information
zouhangwithsweet committed Aug 26, 2024
1 parent 577f61f commit 5620126
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 73 deletions.
34 changes: 1 addition & 33 deletions entrypoints/injected/components/Download.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { useAtomValue } from 'jotai'
import { memo, useEffect, useState } from 'react'
import { Clipboard } from 'react-feather'
import SVG from 'react-inlinesvg'
import { RoughSVG } from 'react-rough-fiber'
import { useCopyToClipboard } from 'usehooks-ts'

import { arrayBufferToBase64, arrayBufferToImageFile } from '@/entrypoints/utils/file'
Expand All @@ -22,7 +21,6 @@ function isSVG(node: SceneNode, depth: number = 0): boolean {

export const Download = memo((props: { minimized?: boolean }) => {
const node = useAtomValue(currentSelection)
const [rough, setRough] = useState(false)
const [imageBase64, setImageBase64] = useState('')
const [svgString, setSvgString] = useState('')
const scale = useAtomValue(exportScale)
Expand Down Expand Up @@ -118,40 +116,10 @@ export const Download = memo((props: { minimized?: boolean }) => {
}}
>
{svgString ? (
rough ? (
<RoughSVG
className="[&>svg]:min-w-20 p-5"
options={{
roughness: 1,
bowing: 1,
seed: 0,
fillStyle: 'hachure',
fillWeight: 1,
hachureAngle: -41,
hachureGap: 1,
curveStepCount: 9,
curveFitting: 0.95,
disableMultiStroke: false,
disableMultiStrokeFill: false,
simplification: 0,
dashOffset: 4,
dashGap: 4,
zigzagOffset: 4,
preserveVertices: false,
}}
>
<SVG src={svgString} height="auto" />
</RoughSVG>
) : (
<SVG src={svgString} height="auto" className="min-w-20 p-5 max-h-210px" />
)
<SVG src={svgString} height="auto" className="min-w-20 p-5 max-h-210px" />
) : (
<img src={imageBase64} alt="" className="w-full max-w-60 max-h-210px h-auto object-contain" />
)}

{svgString && (
<ColorWheelIcon className="absolute bottom-3 right-3 cursor-pointer" onClick={() => setRough(!rough)} />
)}
</div>
)}
{svgString && (
Expand Down
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@
"react-dom": "^18.2.0",
"react-feather": "^2.0.10",
"react-inlinesvg": "^4.1.3",
"react-reconciler": "^0.29.2",
"react-rough-fiber": "^0.0.5",
"shiki": "^1.1.7",
"tailwind-merge": "^2.2.1",
"transform-to-tailwindcss-core": "^0.0.19",
Expand Down
38 changes: 0 additions & 38 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5620126

Please sign in to comment.