Skip to content

Commit

Permalink
fix: add missing property
Browse files Browse the repository at this point in the history
  • Loading branch information
huang-xiao-jian committed May 27, 2020
1 parent 4422e66 commit a34daec
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/Icon/Icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ interface IconProps {
name: string;
dot?: boolean;
color?: string;
size: string;
size?: string;
onClick?: (event: any) => void;
// info#info
message?: string;
Expand Down
15 changes: 12 additions & 3 deletions packages/Loading/Loading.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// packages
import React, { FunctionComponent, Fragment } from 'react';
import React, { FunctionComponent, Fragment, CSSProperties } from 'react';
import clsx from 'clsx';
import { View } from 'remax/wechat';
// internal
Expand All @@ -9,6 +9,8 @@ import withDefaultProps from '../tools/with-default-props';
interface LoadingProps {
vertical: boolean;
type: 'spinner' | 'circular';
color?: string;
size?: string;
// 容器类名,用以覆盖内部
className?: string;
// loading 提示信息
Expand All @@ -29,7 +31,7 @@ const Dots: FunctionComponent = () => (
);

const Loading: FunctionComponent<LoadingProps> = (props) => {
const { vertical, className, type, message } = props;
const { vertical, className, type, color, message, size } = props;
const classnames = {
container: clsx('van-loading', className, {
'van-loading--vertical': vertical,
Expand All @@ -39,9 +41,16 @@ const Loading: FunctionComponent<LoadingProps> = (props) => {
'van-loading__spinner--circular': type === 'circular',
}),
};
const stylesheets: Record<'container', CSSProperties> = {
container: {
color,
width: size,
height: size,
},
};

return (
<View className={classnames.container}>
<View className={classnames.container} style={stylesheets.container}>
<View className={classnames.spinner}>
{type === 'spinner' && <Dots />}
</View>
Expand Down

0 comments on commit a34daec

Please sign in to comment.