Skip to content

Commit

Permalink
Merge pull request #30 from XiaoMi/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
sivan authored Nov 30, 2018
2 parents 150c230 + 11f5888 commit 61f8926
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
> 1. 修订号:当你做了向下兼容的问题修正。
> 先行版本号及版本编译信息可以加到“主版本号.次版本号.修订号”的后面,作为延伸。
## 1.1.1
- 修改:修复 <Button /> 在使用旧版 api 时的样式兼容;
- 修改:修复 <Checkbox /> 占据整行及点击区域的 bug。

## 1.1.0
- 修改:按钮组件 `<Button />` API 调整,向前兼容;
- 修改:修改 `<Notification />` 回调改为非必填项,关闭按钮可配置;
Expand Down
17 changes: 17 additions & 0 deletions components/_util/deprecatedPropsCheck.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
function deprecatedWarning (componentName, propName, propValue) {
console.warn(
`Deprecated Warning: Invalid prop \`${propName}\` of value \`${propValue}\` supplied to \`${componentName}\`.`
)
}

export default function deprecatedPropsCheck (deprecatedProps, props, componentName) {
for (const propName in deprecatedProps) {
if (deprecatedProps.hasOwnProperty(propName)) {
if (deprecatedProps[propName].includes(props[propName])) {
deprecatedWarning(componentName, propName, props[propName])
}
}
}
}

export { deprecatedWarning }
9 changes: 9 additions & 0 deletions components/button/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { Component } from 'react'
import PropTypes from 'prop-types'
import classNames from 'classnames'
import Provider from '../context'
import deprecatedPropsCheck from '../_util/deprecatedPropsCheck'

class Button extends Component {
static propTypes = {
Expand All @@ -16,6 +17,11 @@ class Button extends Component {
target: PropTypes.oneOf(['_self', '_blank', '_parent', '_top'])
}

deprecatedProps = {
type: ['info'],
appearance: ['line']
}

static defaultProps = {
prefixCls: 'hi-btn',
type: 'default',
Expand Down Expand Up @@ -59,6 +65,9 @@ class Button extends Component {
)

const disabledBool = !!disabled

deprecatedPropsCheck(this.deprecatedProps, this.props, 'Button')

return (
href
? <a
Expand Down
3 changes: 2 additions & 1 deletion components/button/style/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@
}

// Common Styles
&--type--default {
&--type--default,
&--type--info {
background-color: $white;
border-color: $gray;
color: $black;
Expand Down
13 changes: 7 additions & 6 deletions components/checkbox/style/index.scss
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
.label-checkbox {
span {
font-size: 12px;
padding: 0 5px;
}
}
@import '@hi-ui/core-css';

.hi-checkbox {
display: inline-block;
cursor: pointer;

@include component-reset();

&:hover {
.hi-checkbox-input {
border: 1px solid #4284f5;
Expand Down Expand Up @@ -44,6 +42,8 @@
opacity: 0;
// display: none;
cursor: pointer;
width: 18px;
height: 18px;
}

&.hi-checkbox-input-checked,
Expand All @@ -52,6 +52,7 @@

&::after {
transform: rotate(45deg) scaleY(1);
pointer-events: none;
box-sizing: content-box;
content: '';
border: 2px solid #fff;
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hi-ui/hiui",
"version": "1.1.0",
"version": "1.1.1",
"description": "HIUI for React",
"scripts": {
"test": "node_modules/.bin/standard && node_modules/.bin/stylelint --config .stylelintrc 'components/**/*.scss'",
Expand Down Expand Up @@ -34,7 +34,7 @@
],
"dependencies": {
"@hi-ui/classic-theme": "^0.9.6",
"@hi-ui/core-css": "^1.0.0-beta.9",
"@hi-ui/core-css": "^1.0.0",
"async-validator": "^1.8.5",
"axios": "^0.18.0",
"classnames": "^2.2.5",
Expand Down

0 comments on commit 61f8926

Please sign in to comment.