Skip to content

Commit dd106bf

Browse files
committed
chore(lab):adjust hover-cursor
1 parent b2f2c5d commit dd106bf

File tree

2 files changed

+28
-13
lines changed

2 files changed

+28
-13
lines changed

src/data/labs/data.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
},
5555
"hover-cursor": {
5656
"name": "hover-cursor",
57-
"inDevelopment": true,
57+
"inDevelopment": false,
5858
"en_title": "Hover Cursor",
5959
"origin_url": "",
6060
"title": "悬停光标",

src/data/labs/hover-cursor/page.tsx

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { cn } from "@/lib/utils";
22
import { createContext, ReactNode, RefObject, useContext, useEffect, useRef, useState } from "react";
3-
import { IconSearch, IconRefresh } from "@tabler/icons-react";
3+
import { IconSearch, IconRefresh, IconAlertTriangle, IconRosetteDiscountCheck } from "@tabler/icons-react";
44
import { AnimatePresence, motion, Variants } from "motion/react";
55

6-
type CursorType = "default" | "link" | "button";
6+
type CursorType = "default" | "link" | "button" | "alert" | "check";
77

88
interface CursorTriggerProps extends React.HTMLAttributes<HTMLDivElement> {
99
type: CursorType;
@@ -57,17 +57,17 @@ export default function HoverCursor() {
5757
<CursorProvider>
5858
<div className="cursor-wrapper relative w-full h-full overflow-hidden flex items-center justify-center p-5">
5959
<div className="grid grid-cols-2 gap-5 items-center justify-center w-full h-full">
60-
<CursorTrigger type="button" className="w-full h-full bg-fuchsia-300 rounded-2xl p-5">
61-
<button>button - 1</button>
60+
<CursorTrigger type="button" className="w-full h-full bg-blue-300 rounded-2xl p-5">
61+
<button></button>
6262
</CursorTrigger>
63-
<CursorTrigger type="link" className="w-full h-full bg-fuchsia-400 rounded-2xl p-5">
64-
<button>button - 2</button>
63+
<CursorTrigger type="link" className="w-full h-full bg-blue-400 rounded-2xl p-5">
64+
<button></button>
6565
</CursorTrigger>
66-
<CursorTrigger type="default" className="w-full h-full bg-fuchsia-600 rounded-2xl p-5">
67-
<button>button - 3</button>
66+
<CursorTrigger type="alert" className="w-full h-full bg-blue-500 rounded-2xl p-5">
67+
<button></button>
6868
</CursorTrigger>
69-
<CursorTrigger type="default" className="w-full h-full bg-fuchsia-700 rounded-2xl p-5">
70-
<button>button - 4</button>
69+
<CursorTrigger type="check" className="w-full h-full bg-blue-600 rounded-2xl p-5">
70+
<button></button>
7171
</CursorTrigger>
7272
</div>
7373
</div>
@@ -107,7 +107,9 @@ const Cursor = () => {
107107
const cursorConfig: Record<CursorType, ReactNode> = {
108108
'default': '',
109109
'link': <IconSearch className="w-full h-full" />,
110-
'button': <IconRefresh className="w-full h-full" />
110+
'button': <IconRefresh className="w-full h-full" />,
111+
'alert': <IconAlertTriangle className="w-full h-full" />,
112+
'check': <IconRosetteDiscountCheck className="w-full h-full" />
111113
};
112114

113115
const variants: Variants = {
@@ -129,8 +131,21 @@ const Cursor = () => {
129131
borderRadius: 50,
130132
width: 48,
131133
height: 48,
132-
background: "#22c55e",
134+
background: "#666",
135+
color: "#fafafa"
136+
},
137+
alert: {
138+
borderRadius: 50,
139+
width: 48,
140+
height: 48,
141+
background: "#f43f5e",
133142
color: "#fafafa"
143+
},
144+
check: {
145+
borderRadius: 50,
146+
width: 48,
147+
height: 48,
148+
background: "#22c55e",
134149
}
135150
};
136151

0 commit comments

Comments
 (0)