feat: add ThemeTag

This commit is contained in:
jialin
2025-04-28 10:05:06 +08:00
parent fb90d79eb3
commit 548e1378f5
8 changed files with 116 additions and 49 deletions
+28
View File
@@ -0,0 +1,28 @@
import useUserSettings from '@/hooks/use-user-settings';
import { Tag, TagProps } from 'antd';
import React from 'react';
const ThemeTag: React.FC<TagProps & { opacity?: number }> = ({
opacity,
style,
children,
...restProps
}) => {
const { userSettings } = useUserSettings();
const { isDarkTheme } = userSettings;
return (
<Tag
{...restProps}
style={{
...style,
opacity: isDarkTheme ? 1 : opacity
}}
>
{children}
</Tag>
);
};
ThemeTag.displayName = 'ThemeTag';
export default ThemeTag;