book-icon
itshover/book-iconFreeComponent
itshover publishes no description for this item.
Install it
npx shadcn@latest add https://itshover.com/r/book-icon.jsonSource
1import { forwardRef, useImperativeHandle } from "react";2import type { AnimatedIconHandle, AnimatedIconProps } from "./types";3import { scaledStrokeWidth } from "./types";4import { motion, useAnimate } from "motion/react";56const BookIcon = forwardRef<AnimatedIconHandle, AnimatedIconProps>(7 (8 { size = 24, color = "currentColor", strokeWidth = 2, className = "" },9 ref,10 ) => {11 const [scope, animate] = useAnimate();1213 const start = async () => {14 await animate(15 ".book-line",16 { pathLength: 0, opacity: 0 },17 { duration: 0 },18 );1920 await animate(21 ".book-line-1",22 { pathLength: [0, 1], opacity: [0, 1] },23 { duration: 0.3, ease: "easeInOut", delay: 0.1 },24 );2526 await animate(27 ".book-line-2",28 { pathLength: [0, 1], opacity: [0, 1] },29 { duration: 0.3, ease: "easeInOut", delay: 0.05 },30 );3132 await animate(33 ".book-line-3",34 { pathLength: [0, 1], opacity: [0, 1] },35 { duration: 0.3, ease: "easeInOut", delay: 0.05 },36 );37 };3839 const stop = () => {40 animate(".book-line", { pathLength: 1, opacity: 1 }, { duration: 0.2 });41 };4243 useImperativeHandle(ref, () => {44 return {45 startAnimation: start,46 stopAnimation: stop,47 };48 });4950 const handleHoverStart = () => {51 start();52 };5354 const handleHoverEnd = () => {55 stop();56 };5758 return (59 <motion.div60 ref={scope}61 onHoverStart={handleHoverStart}62 onHoverEnd={handleHoverEnd}63 className={`inline-flex cursor-pointer ${className}`}64 >65 <svg66 xmlns="http://www.w3.org/2000/svg"67 width={size}68 height={size}69 viewBox="0 0 48 48"70 fill="none"71 stroke={color}72 strokeWidth={scaledStrokeWidth(strokeWidth, 48)}73 strokeMiterlimit="10"74 strokeLinecap="square"75 >76 <motion.path className="book-spine" d="M24 40.5V41L24 10V10.5" />7778 <motion.path79 className="book-cover"80 style={{ transformOrigin: "24px 25px" }}81 d="M24 41C31.0005 36.9995 37.9995 36.9995 45 41V10.0003C37.9995 5.99989 31.0005 5.99989 24 10.0003C16.9995 5.99989 10.0005 5.99989 3 10.0003V41C10.0005 36.9995 16.9995 36.9995 24 41Z"82 />8384 <motion.path85 className="book-line book-line-1"86 d="M30 16.5C32.8362 15.1345 36.5662 15.06 39.5 16.2763"87 />8889// … truncated
What it pulls in
npm packages
Files it writes
More from itshover
All 263 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| accessibility-iconaccessibility-icon | itshover | Components | Free | 1 dep · 2 files | |
| airplane-iconairplane-icon | itshover | Components | Free | 1 dep · 2 files | |
| alarm-clock-plus-iconalarm-clock-plus-icon | itshover | Components | Free | 1 dep · 2 files | |
| align-center-iconalign-center-icon | itshover | Components | Free | 1 dep · 2 files | |
| align-vertical-space-around-iconalign-vertical-space-around-icon | itshover | Components | Free | 1 dep · 2 files | |
| ambulance-iconambulance-icon | itshover | Components | Free | 1 dep · 2 files | |
| ampersand-iconampersand-icon | itshover | Components | Free | 1 dep · 2 files | |
| angry-iconangry-icon | itshover | Components | Free | 1 dep · 2 files |
