Bläddra i källkod

fix: optimize code

代强 1 år sedan
förälder
incheckning
c44885512a

+ 3 - 0
content/show/avatar/index-en-US.md

@@ -169,6 +169,9 @@ import { IconCamera } from '@douyinfe/semi-icons';
 ### Top and Bottom Slot
 
 ```jsx live=true
+import React from 'react';
+import { Avatar } from '@douyinfe/semi-ui';
+
 <Avatar
             alt="beautiful cat"
             src="https://lf3-static.bytednsdoc.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/root-web-sites/dy.png"

+ 3 - 0
content/show/avatar/index.md

@@ -166,6 +166,9 @@ import { IconCamera } from '@douyinfe/semi-icons';
 ### 顶部和底部 Slot
 
 ```jsx live=true
+import React from 'react';
+import { Avatar } from '@douyinfe/semi-ui';
+
  <Avatar
             alt="beautiful cat"
             src="https://lf3-static.bytednsdoc.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/root-web-sites/dy.png"

+ 4 - 4
packages/semi-foundation/slider/foundation.ts

@@ -38,11 +38,11 @@ export interface SliderProps{
     'aria-valuetext'?: string;
     getAriaValueText?: (value: number, index?: number) => string;
     handleDot?: {
-        size: string;
-        color: string
+        size?: string;
+        color?: string
     } & ({
-        size: string;
-        color: string
+        size?: string;
+        color?: string
     }[])
 }
 

+ 7 - 7
packages/semi-ui/avatar/index.tsx

@@ -57,19 +57,19 @@ export default class Avatar extends BaseComponent<AvatarProps, AvatarState> {
         bottomSlot: PropTypes.shape({
             render: PropTypes.func,
             shape: PropTypes.oneOf(['circle', 'square']),
-            text: PropTypes.node.isRequired,
-            bgColor: PropTypes.string.isRequired,
-            textColor: PropTypes.string.isRequired,
-            className: PropTypes.string.isRequired,
+            text: PropTypes.node,
+            bgColor: PropTypes.string,
+            textColor: PropTypes.string,
+            className: PropTypes.string,
             style: PropTypes.object,
         }),
         topSlot: PropTypes.shape({
             render: PropTypes.func,
             gradientStart: PropTypes.string,
             gradientEnd: PropTypes.string,
-            text: PropTypes.node.isRequired,
-            textColor: PropTypes.string.isRequired,
-            className: PropTypes.string.isRequired,
+            text: PropTypes.node,
+            textColor: PropTypes.string,
+            className: PropTypes.string,
             style: PropTypes.object,
         }),
         border: PropTypes.oneOfType([

+ 1 - 1
packages/semi-ui/input/index.tsx

@@ -479,7 +479,7 @@ class Input extends BaseComponent<InputProps, InputState> {
             [`${wrapperPrefix}-hidden`]: type === 'hidden',
             [`${wrapperPrefix}-${size}`]: size,
             [`${prefixCls}-borderless`]: borderless,
-            [`${prefixCls}-only_border`]: onlyBorder!==undefined,  
+            [`${prefixCls}-only_border`]: onlyBorder!==undefined && onlyBorder!==null,
         });
         const inputCls = cls(prefixCls, {
             [`${prefixCls}-${size}`]: size,

+ 4 - 4
packages/semi-ui/slider/index.tsx

@@ -56,13 +56,13 @@ export default class Slider extends BaseComponent<SliderProps, SliderState> {
         getAriaValueText: PropTypes.func,
         handleDot: PropTypes.oneOfType([
             PropTypes.shape({
-                size: PropTypes.string.isRequired,
-                color: PropTypes.string.isRequired,
+                size: PropTypes.string,
+                color: PropTypes.string,
             }),
             PropTypes.arrayOf(
                 PropTypes.shape({
-                    size: PropTypes.string.isRequired,
-                    color: PropTypes.string.isRequired,
+                    size: PropTypes.string,
+                    color: PropTypes.string,
                 })
             ),
         ]),