惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

C
Check Point Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园 - 聂微东
月光博客
月光博客
博客园 - 司徒正美
爱范儿
爱范儿
aimingoo的专栏
aimingoo的专栏
量子位
Recent Announcements
Recent Announcements
V
V2EX
P
Proofpoint News Feed
小众软件
小众软件
云风的 BLOG
云风的 BLOG
腾讯CDC
宝玉的分享
宝玉的分享
Microsoft Azure Blog
Microsoft Azure Blog
大猫的无限游戏
大猫的无限游戏
Vercel News
Vercel News
The GitHub Blog
The GitHub Blog
A
About on SuperTechFans
B
Blog
博客园_首页
GbyAI
GbyAI
博客园 - Franky

博客园 - SKILL·NULL

获取指定 dom 的 touchmove 方向及到达边缘时是否禁止橡皮筋效果 如何实现超长数字:先缩小字号,再省略号 如何为GIT设置全局勾子,为每次提交追加信息 一文了解大模型、小模型与各类神经网络的关系 如何在Mac上调整外星人鼠标AW720M的灯光颜色 Karabiner-Elements最常用配置 IndexedDB封装 echarts获取坐标上的点距离顶部底部高度 Let`s Encrypt 生成免费自动续签 HTTPS 证书 H5滚动截取长图 ReactNative常见问题及处理 根据.nvmrc自动切换项目所需node版本 Command PhaseScriptExecution failed with a nonzero exit code echarts双Y轴,实现均分为包含刻度0的指定段数,同时对齐刻度 env(safe-area-inset-bottom) 兼容写法 缩放实现0.5px 禁止 IOS 橡皮筋效果 JS 拦截浏览器返回 海康威视DS-IPC-E42H-IWPT监控画面竖线处理 Echarts 5 动态按需引入图表 React 18 自定义 Hook 获取 useState 最新值 处理报错 ResizeObserver loop completed with undelivered notifications.
如何通过传参来实现SVG排序图标的三种状态
SKILL·NULL · 2026-08-07 · via 博客园 - SKILL·NULL
/**
* 表格排序图标
* - default:上下三角均为未激活色
* - asc:上三角高亮(升序)
* - desc:下三角高亮(降序)
*/
export type SortIconStatus = 'default' | 'asc' | 'desc'

interface SortIconProps extends SVGProps<SVGSVGElement> {
status?: SortIconStatus
/** 未激活三角颜色 */
inactiveColor?: string
/** 激活三角颜色 */
activeColor?: string
}

export const SortIcon = ({
status = 'default',
inactiveColor = '#A3A3A3',
activeColor = '#333333',
className = '',
'aria-label': ariaLabel,
...props
}: SortIconProps) => {
const upColor = status === 'asc' ? activeColor : inactiveColor
const downColor = status === 'desc' ? activeColor : inactiveColor

return (
<svg
{...props}
aria-hidden={ariaLabel ? undefined : true}
aria-label={ariaLabel}
className={className}
width="6"
height="10"
viewBox="0 0 6 10"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path d="M3 0L6 4H0L3 0Z" fill={upColor} />
<path d="M3 10L0 6H6L3 10Z" fill={downColor} />
</svg>
)
}