Skip to content

Commit

Permalink
style: run prettier to format code style
Browse files Browse the repository at this point in the history
  • Loading branch information
JeromeLin committed Feb 26, 2021
1 parent ce95d66 commit cc2ac73
Show file tree
Hide file tree
Showing 234 changed files with 4,574 additions and 3,626 deletions.
2 changes: 0 additions & 2 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,3 @@ What needs to be done to address this issue? Ideally, provide a pull request wit
- browser version

You can get this information from `package.json` and your device.


162 changes: 91 additions & 71 deletions CHANGELOG.md

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion COMMUNITY.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
# COMMUNITY

## PMC:

Jerome Lin <[email protected]>

## Maintanier:

Jerome Lin <[email protected]>

## Committer:

edison-hm <[email protected]>

## Reviewer:
Jerome Lin <[email protected]>

Jerome Lin <[email protected]>

## Contributors:

- Jerome Lin <[email protected]>
- Cheng007 <[email protected]>
- JasonYou <[email protected]>
Expand Down
10 changes: 7 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Contributing to zarm

## Set up

Install to fetch its dependencies after git clone the repo.

```bash
Expand All @@ -9,13 +10,14 @@ $ yarn
```

Then, you can runs Zarm Design website locally.

```bash
# develop for h5
$ yarn dev

If you want runs Zarm Design demo for react-native, Then
# develop for react-native
$ cd rnkit && yarn install && cd ios && pod install && cd ../..
$ cd rnkit && yarn install && cd ios && pod install && cd ../..

# develop for iOS
$ yarn dev:ios
Expand All @@ -24,8 +26,8 @@ $ yarn dev:ios
$ yarn dev:android
```


## Lint

checks the code style.

```bash
Expand All @@ -42,6 +44,7 @@ $ yarn lint:style
```

## Test

runs the complete test suite.

```bash
Expand All @@ -58,6 +61,7 @@ $ yarn test:h5 --coverage
```

## Build

compiles TypeScript code to the lib and es directory, and creates UMD build of zarm in dist directory.

```bash
Expand All @@ -77,4 +81,4 @@ $ yarn build:ios

# Build react-native of Android
$ yarn build:android
```
```
37 changes: 19 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,23 @@

<div align="center">

[![Build Status](https://www.travis-ci.org/ZhongAnTech/zarm.svg?branch=master)](https://www.travis-ci.org/ZhongAnTech/zarm)
[![Coverage Status](https://img.shields.io/coveralls/ZhongAnTech/zarm/master.svg)](https://coveralls.io/github/ZhongAnTech/zarm?branch=master)
![JS gzip size](https://img.badgesize.io/https://unpkg.com/zarm@latest/dist/zarm.min.js?compression=gzip&label=gzip%20size:%20JS)
![CSS gzip size](https://img.badgesize.io/https://unpkg.com/zarm@latest/dist/zarm.min.css?compression=gzip&label=gzip%20size:%20CSS)
[![NPM downloads](https://img.shields.io/npm/dm/zarm.svg)](https://npmjs.org/package/zarm)
[![dependencies Status](https://david-dm.org/ZhongAnTech/zarm/status.svg)](https://david-dm.org/ZhongAnTech/zarm)
[![peerDependencies Status](https://david-dm.org/ZhongAnTech/zarm/peer-status.svg)](https://david-dm.org/ZhongAnTech/zarm?type=peer)
[![devDependencies Status](https://david-dm.org/ZhongAnTech/zarm/dev-status.svg)](https://david-dm.org/ZhongAnTech/zarm?type=dev)
[![Netlify Status](https://api.netlify.com/api/v1/badges/7afc45a9-dcac-4475-9903-d3896bc200ed/deploy-status)](https://app.netlify.com/sites/zarm/deploys)
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2FZhongAnTech%2Fzarm.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2FZhongAnTech%2Fzarm?ref=badge_shield)
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/ZhongAnTech/zarm?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)

众安科技基于 React、React-Native 研发的一款适用于企业级的移动端UI组件库。
[![Build Status](https://www.travis-ci.org/ZhongAnTech/zarm.svg?branch=master)](https://www.travis-ci.org/ZhongAnTech/zarm)
[![Coverage Status](https://img.shields.io/coveralls/ZhongAnTech/zarm/master.svg)](https://coveralls.io/github/ZhongAnTech/zarm?branch=master)
![JS gzip size](https://img.badgesize.io/https://unpkg.com/zarm@latest/dist/zarm.min.js?compression=gzip&label=gzip%20size:%20JS)
![CSS gzip size](https://img.badgesize.io/https://unpkg.com/zarm@latest/dist/zarm.min.css?compression=gzip&label=gzip%20size:%20CSS)
[![NPM downloads](https://img.shields.io/npm/dm/zarm.svg)](https://npmjs.org/package/zarm)
[![dependencies Status](https://david-dm.org/ZhongAnTech/zarm/status.svg)](https://david-dm.org/ZhongAnTech/zarm)
[![peerDependencies Status](https://david-dm.org/ZhongAnTech/zarm/peer-status.svg)](https://david-dm.org/ZhongAnTech/zarm?type=peer)
[![devDependencies Status](https://david-dm.org/ZhongAnTech/zarm/dev-status.svg)](https://david-dm.org/ZhongAnTech/zarm?type=dev)
[![Netlify Status](https://api.netlify.com/api/v1/badges/7afc45a9-dcac-4475-9903-d3896bc200ed/deploy-status)](https://app.netlify.com/sites/zarm/deploys)
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2FZhongAnTech%2Fzarm.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2FZhongAnTech%2Fzarm?ref=badge_shield)
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/ZhongAnTech/zarm?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)

众安科技基于 React、React-Native 研发的一款适用于企业级的移动端 UI 组件库。

</div>

Zarm 的命名,灵感来源于众安保险秉承的理念:做有温度的保险。Zarm = za + warm,za代表“众安”,warm有“温暖”的含义,以重合的a字母为中心,各取左右两部分。追求极致的用户体验,致力于做有温度的组件库也是zarm项目发起的初衷
Zarm 的命名,灵感来源于众安保险秉承的理念:做有温度的保险。Zarm = za + warm,za 代表“众安”,warm 有“温暖”的含义,以重合的 a 字母为中心,各取左右两部分。追求极致的用户体验,致力于做有温度的组件库也是 zarm 项目发起的初衷

## 版本

Expand Down Expand Up @@ -55,7 +56,7 @@ import 'zarm/dist/zarm.css';

### 定制主题

zarm 的样式使用了 [scss](https://sass-lang.com)[css变量](https://www.w3.org/Style/CSS/) 相结合做为开发语言,并定义了一系列全局/组件的样式变量,你可以根据需求进行相应调整,实现定制主题的能力。
zarm 的样式使用了 [scss](https://sass-lang.com)[css 变量](https://www.w3.org/Style/CSS/) 相结合做为开发语言,并定义了一系列全局/组件的样式变量,你可以根据需求进行相应调整,实现定制主题的能力。

```js
document.documentElement.style.setProperty('--theme-primary', '#108ee9');
Expand All @@ -67,13 +68,13 @@ document.documentElement.style.setProperty('--theme-primary', '#108ee9');
--theme-primary: #00bc70; // 全局主色
--theme-success: #00bc70; // 成功色
--theme-warning: #ec9231; // 警告色
--theme-danger: #ff5050; // 危险色
--theme-danger: #ff5050; // 危险色
```

## 社区

| 问题上报 | 讨论交流 | 微信群 |
| :--- | :--- | :--- |
| 问题上报 | 讨论交流 | 微信群 |
| :---------------------------------------------------------- | :-------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------- |
| [github issues](https://github.com/ZhongAnTech/zarm/issues) | [github discussions](https://github.com/ZhongAnTech/zarm/discussions) | <img src="https://cdn-health.zhongan.com/zarm/qrcode.jpg" width="80" /> <br />备注 "zarm" 加好友后邀请进群 |

## 开源协议
Expand Down
22 changes: 14 additions & 8 deletions components/action-sheet/ActionSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,23 @@ export default class ActionSheet extends PureComponent<ActionSheetProps, {}> {
const actionCls = classnames(`${prefixCls}__item`, action.className, {
[`${prefixCls}__item--${action.theme}`]: !!action.theme,
});
return <div key={+index} className={actionCls} onClick={action.onClick}>{action.text}</div>;
return (
<div key={+index} className={actionCls} onClick={action.onClick}>
{action.text}
</div>
);
};

renderCancel = () => {
const { prefixCls, onCancel, cancelText, locale } = this.props;
return (typeof onCancel === 'function') && (
<div className={`${prefixCls}__cancel`}>
<div className={`${prefixCls}__item`} onClick={onCancel}>{cancelText || locale!.cancelText}</div>
</div>
return (
typeof onCancel === 'function' && (
<div className={`${prefixCls}__cancel`}>
<div className={`${prefixCls}__item`} onClick={onCancel}>
{cancelText || locale!.cancelText}
</div>
</div>
)
);
};

Expand All @@ -43,9 +51,7 @@ export default class ActionSheet extends PureComponent<ActionSheetProps, {}> {
return (
<Popup className={className} visible={visible} onMaskClick={onMaskClick} destroy={destroy}>
<div className={cls}>
<div className={`${prefixCls}__actions`}>
{actions.map(this.renderActions)}
</div>
<div className={`${prefixCls}__actions`}>{actions.map(this.renderActions)}</div>
{this.renderCancel()}
</div>
</Popup>
Expand Down
49 changes: 27 additions & 22 deletions components/action-sheet/demo.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# ActionSheet 动作面板



## 基本用法

```jsx
import { useState } from 'react';
import { ActionSheet, Cell, Button } from 'zarm';
Expand Down Expand Up @@ -33,21 +32,27 @@ const Demo = () => {
<>
<Cell
description={
<Button size="xs" onClick={() => setVisible1(true)}>开启</Button>
<Button size="xs" onClick={() => setVisible1(true)}>
开启
</Button>
}
>
普通
</Cell>
<Cell
description={
<Button size="xs" onClick={() => setVisible2(true)}>开启</Button>
<Button size="xs" onClick={() => setVisible2(true)}>
开启
</Button>
}
>
带取消操作
</Cell>
<Cell
description={
<Button size="xs" onClick={() => setVisible3(true)}>开启</Button>
<Button size="xs" onClick={() => setVisible3(true)}>
开启
</Button>
}
>
圆角、留边
Expand All @@ -72,28 +77,28 @@ const Demo = () => {
onCancel={() => setVisible3(!visible3)}
/>
</>
)
}
);
};

ReactDOM.render(<Demo />, mountNode);
```


## API

| 属性 | 类型 | 默认值 | 说明 |
| :--- | :--- | :--- | :--- |
| visible | boolean | false | 是否显示 |
| spacing | boolean | false | 是否和外部有间距 |
| actions | Action[] | [] | 动作列表 |
| onMaskClick | () => void | - | 点击遮罩层时触发的回调函数 |
| onCancel | () => void | - | 显示取消菜单,点击时触发的回调函数 |
| cancelText | string | '取消' | 取消菜单的文案 |
| 属性 | 类型 | 默认值 | 说明 |
| :---------- | :--------- | :----- | :--------------------------------- |
| visible | boolean | false | 是否显示 |
| spacing | boolean | false | 是否和外部有间距 |
| actions | Action[] | [] | 动作列表 |
| onMaskClick | () => void | - | 点击遮罩层时触发的回调函数 |
| onCancel | () => void | - | 显示取消菜单,点击时触发的回调函数 |
| cancelText | string | '取消' | 取消菜单的文案 |

### Action 类型定义
| 属性 | 类型 | 默认值 | 说明 |
| :--- | :--- | :--- | :--- |
| text | ReactNode | - | 按钮文字 |
| theme | string | 'default' | 按钮主题,可选值 `default``primary``danger`
| className | string | - | 追加类名
| onClick | () => void | - | 按钮点击后触发的回调函数 |

| 属性 | 类型 | 默认值 | 说明 |
| :-------- | :--------- | :-------- | :---------------------------------------------- |
| text | ReactNode | - | 按钮文字 |
| theme | string | 'default' | 按钮主题,可选值 `default``primary``danger` |
| className | string | - | 追加类名 |
| onClick | () => void | - | 按钮点击后触发的回调函数 |
60 changes: 20 additions & 40 deletions components/action-sheet/index.native.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
import React, { PureComponent, CSSProperties } from 'react';
import {
StyleSheet,
Text,
View,
TouchableOpacity,
ViewStyle,
} from 'react-native';
import { StyleSheet, Text, View, TouchableOpacity, ViewStyle } from 'react-native';
import PropsType from './PropsType';
import actionsheetStyle from './style/index.native';
import Popup from '../popup/index.native';
Expand Down Expand Up @@ -47,10 +41,7 @@ export default class ActionSheet extends PureComponent<ButtonProps, any> {
styles!.actionItemMask,
activeIndex === index && isActive && styles!.actionItemActive,
];
const actionStyle = [
styles!.actionItem,
!!action.theme && styles![`theme-${action.theme}`],
];
const actionStyle = [styles!.actionItem, !!action.theme && styles![`theme-${action.theme}`]];

return (
<TouchableOpacity
Expand All @@ -70,50 +61,39 @@ export default class ActionSheet extends PureComponent<ButtonProps, any> {
renderCancel = () => {
const { styles, onCancel, cancelText } = this.props;
const { isActive, activeIndex } = this.state;
const cancelWrapperStyle = [
styles!.wrapperCacnel,
];
const cancelWrapperStyle = [styles!.wrapperCacnel];
const cancelMaskStyle = [
styles!.actionItemMask,
isActive && activeIndex === 'cancel' && styles!.actionItemActive,
];
const cancelStyle = [
styles!.actionCancelItem,
];
const cancelStyle = [styles!.actionCancelItem];

return (typeof onCancel === 'function') && (
<TouchableOpacity
style={cancelWrapperStyle}
activeOpacity={1}
onPress={onCancel}
onPressIn={() => this.onPressIn('cancel')}
onPressOut={() => this.onPressOut('cancel')}
>
<View style={cancelMaskStyle as ViewStyle} />
<Text style={cancelStyle as ViewStyle}>{cancelText}</Text>
</TouchableOpacity>
return (
typeof onCancel === 'function' && (
<TouchableOpacity
style={cancelWrapperStyle}
activeOpacity={1}
onPress={onCancel}
onPressIn={() => this.onPressIn('cancel')}
onPressOut={() => this.onPressOut('cancel')}
>
<View style={cancelMaskStyle as ViewStyle} />
<Text style={cancelStyle as ViewStyle}>{cancelText}</Text>
</TouchableOpacity>
)
);
};

render() {
const { style, styles, spacing, visible, onMaskClick, actions } = this.props;
const wrapperStyle = [
styles!.wrapper,
spacing && styles!.wrapperSpacing,
style,
];
const wrapperStyle = [styles!.wrapper, spacing && styles!.wrapperSpacing, style];

const actionsStyle = [
styles!.wrapperActions,
{ margin: 0 },
];
const actionsStyle = [styles!.wrapperActions, { margin: 0 }];

return (
<Popup visible={visible} onMaskClick={onMaskClick}>
<View style={wrapperStyle as ViewStyle}>
<View style={actionsStyle}>
{actions.map(this.renderActions)}
</View>
<View style={actionsStyle}>{actions.map(this.renderActions)}</View>
{this.renderCancel()}
</View>
</Popup>
Expand Down
2 changes: 1 addition & 1 deletion components/activity-indicator/PropsType.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ export default interface PropsType {
size?: 'lg';
strokeWidth?: number;
percent?: number;
type? : 'circular' | 'spinner';
type?: 'circular' | 'spinner';
loading?: Boolean;
}
Loading

0 comments on commit cc2ac73

Please sign in to comment.