Browse Source

fix: Fixed the problem that icon size and size settings are not consistent, affecting version 2.59.0-2.60.1 (#2308)

YyumeiZhang 1 year ago
parent
commit
02976ad4a0

+ 12 - 0
packages/semi-ui/typography/_story/typography.stories.jsx

@@ -907,3 +907,15 @@ export const InheritSize = () => {
     </Text>
   )
 }
+
+export const SizeAffectIcon = () => {
+  // 增加用例,观察 size 设置对 icon 大小的影响
+  return (
+      <>
+          <Text size="normal"  icon={<IconLink />} underline>带下划线的网页链接</Text> 
+          <br />   
+          <br />     
+          <Text size="small"  icon={<IconLink />} underline>带下划线的网页链接</Text>
+      </>
+  )
+}

+ 1 - 1
packages/semi-ui/typography/base.tsx

@@ -626,7 +626,7 @@ export default class Base extends Component<BaseTypographyProps, BaseTypographyS
         const iconSize: Size = realSize === 'small' ? 'small' : 'default';
         return (
             <span className={`${prefixCls}-icon`} x-semi-prop="icon">
-                {isSemiIcon(icon) ? React.cloneElement((icon as React.ReactElement), { realSize: iconSize }) : icon}
+                {isSemiIcon(icon) ? React.cloneElement((icon as React.ReactElement), { size: iconSize }) : icon}
             </span>
         );
     }