Skip to content

Commit

Permalink
docs: add how to custom cursor, close #496
Browse files Browse the repository at this point in the history
  • Loading branch information
YunYouJun committed Feb 16, 2025
1 parent d76b956 commit cd24ae6
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 12 deletions.
5 changes: 0 additions & 5 deletions demo/yun/styles/css-vars.scss

This file was deleted.

1 change: 1 addition & 0 deletions demo/yun/styles/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import './vars.scss'
31 changes: 31 additions & 0 deletions demo/yun/styles/vars.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// custom your css variables here
:root {
/* 侧边栏背景图片 */
// --yun-sidebar-bg-img: url("https://cdn.yunyoujun.cn/img/avatar/none.jpg");
}

:root {
--cursor-default: url('https://cdn.yunyoujun.cn/css/md-cursors/pointer.cur');
--cursor-pointer: url('https://cdn.yunyoujun.cn/css/md-cursors/link.cur');
--cursor-text: url('https://cdn.yunyoujun.cn/css/md-cursors/text.cur');
}

body {
cursor: var(--cursor-default), auto;
}

a {
cursor: var(--cursor-pointer), auto;

&:hover {
cursor: var(--cursor-pointer), auto;
}
}

button {
cursor: var(--cursor-pointer), pointer;
}

input {
cursor: var(--cursor-text), text;
}
16 changes: 9 additions & 7 deletions docs/pages/guide/custom/styles.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,20 +78,22 @@ For example, you can override the default font in 'styles/css-vars.scss'.

### Custom Cursor {lang="en"}

::: warning

编写中...

:::

替换鼠标光标,默认关闭。
替换鼠标光标样式。

例如使用 [Material Design Cursors](https://www.deviantart.com/rosea92/art/Material-Design-Cursors-Dark-756850032)

- `default`: 默认状态下图标。
- `pointer`: 指针(即链接状态下)图标。
- `text`: 文本选择图标。

新建 `styles/index.ts` 文件,引入 `vars.scss`

```ts
import './vars.scss'
```

新建 `styles/vars.scss` 文件:

```scss
:root {
--cursor-default: url('https://cdn.yunyoujun.cn/css/md-cursors/pointer.cur');
Expand Down

1 comment on commit cd24ae6

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 Published on https://yun.valaxy.site as production
🚀 Deployed on https://67b1bc793fdff025aee02011--valaxy.netlify.app

Please sign in to comment.