diff --git a/packages/loading/index.tsx b/packages/loading/index.tsx index c0e2cdb14..8c281eeb4 100644 --- a/packages/loading/index.tsx +++ b/packages/loading/index.tsx @@ -1,4 +1,5 @@ import { use, suffixPx } from '../utils'; +import { GRAY } from '../utils/color'; import { inherit } from '../utils/functional'; // Types @@ -16,7 +17,36 @@ export type LoadingProps = { }; const [sfc, bem] = use('loading'); -const DEFAULT_COLOR = '#c9c9c9'; + +function LoadingIcon(h: CreateElement, props: LoadingProps) { + if (props.type === 'spinner') { + const Spin = []; + for (let i = 0; i < 12; i++) { + Spin.push(); + } + return Spin; + } + + return ( + + ); +} + +function LoadingText(h: CreateElement, props: LoadingProps, slots: DefaultSlots) { + if (slots.default) { + const style = props.textSize && { + fontSize: suffixPx(props.textSize) + }; + + return ( + + {slots.default()} + + ); + } +} function Loading( h: CreateElement, @@ -33,40 +63,12 @@ function Loading( style.height = iconSize; } - const Spin = []; - if (type === 'spinner') { - for (let i = 0; i < 12; i++) { - Spin.push(); - } - } - - const Circular = type === 'circular' && ( - - ); - - function Text() { - if (slots.default) { - const style = props.textSize && { - fontSize: suffixPx(props.textSize) - }; - - return ( - - {slots.default()} - - ); - } - } - return (