Skip to content

Commit

Permalink
chore: use jswork scope
Browse files Browse the repository at this point in the history
  • Loading branch information
afeiship committed Mar 3, 2021
1 parent ce78bcf commit 005852e
Show file tree
Hide file tree
Showing 39 changed files with 589 additions and 241 deletions.
21 changes: 9 additions & 12 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
{
"presets": ["@babel/preset-env", "@babel/react"],
"plugins": [
[
"@babel/plugin-proposal-decorators",
{
"legacy": true
}
],
[
"@babel/plugin-proposal-class-properties",
"presets": [[
"@babel/preset-env",
{
"loose": true
"targets": { "browsers": [ "last 2 versions" ] }
}
]
], "@babel/react"],
"plugins": [
[ "@babel/plugin-proposal-decorators", { "legacy": true } ],
[ "@babel/plugin-proposal-class-properties", { "loose": true } ],
"@babel/plugin-proposal-optional-chaining",
"@babel/plugin-transform-parameters"
]
}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,9 @@ Gemfile.lock
yarn-error.log
package-lock.json
.DS_Store
dist

# editor
.idea
.vscode
.history
17 changes: 14 additions & 3 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ postcss.config.js
Rakefile
**/npm-debug.log
**/node_modules
test
__test__
__tests__

bin
src
docs
build
Expand All @@ -19,6 +18,18 @@ public
tests
postcss.config.js
webpack.config.babel.js
example
examples

# vscode
jsconfig.json
.history

# tests
test
__test__
__tests__
jest.config.js
jest.setup.js

.release-it.json
1 change: 1 addition & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"jsxBracketSameLine": true,
"tabWidth": 2,
"semi": true,
"quoteProps": "consistent",
"singleQuote": true,
"overrides": [
{
Expand Down
14 changes: 14 additions & 0 deletions .release-it.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"hooks": {
"after:init": [
"t2k"
],
"after:bump": [
"npm run docs",
"npm run build"
]
},
"github": {
"release": true
}
}
5 changes: 0 additions & 5 deletions Gemfile

This file was deleted.

21 changes: 21 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2020 afei <1290657123@qq.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
88 changes: 74 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,43 @@
# react-status-manager
> React component for status manager.
## install
[![version][version-image]][version-url]
[![license][license-image]][license-url]
[![size][size-image]][size-url]
[![download][download-image]][download-url]

## installation
```shell
npm install -S afeiship/react-status-manager
npm install -S @jswork/react-status-manager
```

## properties
| Name | Type | Required | Default | Description |
| --------- | ------ | -------- | ------- | ------------------------------------- |
| className | string | false | - | The extended className for component. |
| items | array | false | [] | The status list. |
| value | any | false | - | Current status value. |
| nodeName | any | false | 'div' | The node name. |
| virtual | bool | false | false | If use React.Fragment element. |


## usage
1. import css
```scss
@import "~react-status-manager/style.scss";
@import "~@jswork/react-status-manager/dist/style.css";

// or use sass
@import "~@jswork/react-status-manager/dist/style.scss";

// customize your styles:
$react-status-manager-options: ()
```
2. import js
```js
import ReactStatusManager from '../src/main';
import ReactDOM from 'react-dom';
import ReactDemokit from '@jswork/react-demokit';
import React from 'react';
import ReactDOM from 'react-dom';
import ReactStatusManager from '@jswork/react-status-manager';
import './assets/style.scss';

class App extends React.Component {
Expand Down Expand Up @@ -63,7 +82,9 @@ npm install -S afeiship/react-status-manager

render() {
return (
<div className="app-container">
<ReactDemokit
className="p-3 app-container"
url="https://github.com/afeiship/react-status-manager">
<ReactStatusManager
size="16px"
value={this.state.value}
Expand All @@ -89,15 +110,38 @@ npm install -S afeiship/react-status-manager
<span>已经结束</span>
</ReactStatusManager>

<button onClick={this.click1}>to `init`</button>
<button onClick={this.click2}>to `active`</button>
<button onClick={this.click3}>to `running`</button>
<button onClick={this.click4}>to `finish`</button>

<button onClick={this._click5}>SetSMvalue</button>
<button
className="button is-primary is-fullwidth mb-2"
onClick={this.click1}>
to `init`
</button>
<button
className="button is-primary is-fullwidth mb-2"
onClick={this.click2}>
to `active`
</button>
<button
className="button is-primary is-fullwidth mb-2"
onClick={this.click3}>
to `running`
</button>
<button
className="button is-primary is-fullwidth mb-2"
onClick={this.click4}>
to `finish`
</button>
<button
className="button is-primary is-fullwidth mb-2"
onClick={this._click5}>
SetSMvalue
</button>

<h2>Wizard</h2>
<button onClick={this._clickStep}>next step</button>
<button
className="button is-primary is-fullwidth mb-2"
onClick={this._clickStep}>
next step
</button>
<ReactStatusManager value={this.state.step} items={[0, 1, 2, 3]}>
<div className="step">step1,input password</div>
<div className="step">step2,input phone</div>
Expand All @@ -106,7 +150,7 @@ npm install -S afeiship/react-status-manager
step4,do submit! <button>SUBMIT</button>
</div>
</ReactStatusManager>
</div>
</ReactDemokit>
);
}
}
Expand All @@ -117,3 +161,19 @@ npm install -S afeiship/react-status-manager

## documentation
- https://afeiship.github.io/react-status-manager/


## license
Code released under [the MIT license](https://github.com/afeiship/react-status-manager/blob/master/LICENSE.txt).

[version-image]: https://img.shields.io/npm/v/@jswork/react-status-manager
[version-url]: https://npmjs.org/package/@jswork/react-status-manager

[license-image]: https://img.shields.io/npm/l/@jswork/react-status-manager
[license-url]: https://github.com/afeiship/react-status-manager/blob/master/LICENSE.txt

[size-image]: https://img.shields.io/bundlephobia/minzip/@jswork/react-status-manager
[size-url]: https://github.com/afeiship/react-status-manager/blob/master/dist/react-status-manager.min.js

[download-image]: https://img.shields.io/npm/dm/@jswork/react-status-manager
[download-url]: https://www.npmjs.com/package/@jswork/react-status-manager
4 changes: 0 additions & 4 deletions Rakefile

This file was deleted.

12 changes: 0 additions & 12 deletions __tests__/basic.test.js

This file was deleted.

12 changes: 12 additions & 0 deletions __tests__/index.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react';
import { shallow } from 'enzyme';
import BoilerplateReactCompnent from '../src/main';

describe('Basic Test', () => {
test('renders to document', () => {
const component = shallow(<BoilerplateReactCompnent />);
const cnt = component.find('.react-component');
cnt.simulate('click');
expect(cnt).toMatch(/Hello React/);
});
});
48 changes: 48 additions & 0 deletions bin/docs.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/usr/bin/env ruby
require "net/http"
require "json"

TOKEN = ENV["GITHUB_API_TOKEN"]

class DocApp
def initialize
@uri = URI("https://api.github.com/repos/afeiship/react-status-manager/pages")
@http = Net::HTTP.new(@uri.host, @uri.port)
@http.use_ssl = true

@header = {
'Accept': "application/vnd.github.switcheroo-preview+json",
'Authorization': "token #{TOKEN}",
'Content-Type': "application/vnd.api+json",
}

@data = {
"source": {
"branch": "master",
"path": "/docs",
},
}
end

def del
@req = Net::HTTP::Delete.new(@uri.path, @header)
@http.request(@req)
end

def create
@req = Net::HTTP::Post.new(@uri.path, @header)
@req.body = @data.to_json
@http.request(@req)
end

def set_doc
del
create

puts "Has set master/docs to gh-pages!"
end
end

# start app:
app = DocApp.new
app.set_doc
50 changes: 50 additions & 0 deletions build/TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# react-status-manager
> React component for status manager.
[![version][version-image]][version-url]
[![license][license-image]][license-url]
[![size][size-image]][size-url]
[![download][download-image]][download-url]

## installation
```shell
npm install -S @jswork/react-status-manager
```

## properties
__GENERATE_DOCS__

## usage
1. import css
```scss
@import "~@jswork/react-status-manager/dist/style.css";

// or use sass
@import "~@jswork/react-status-manager/dist/style.scss";

// customize your styles:
$react-status-manager-options: ()
```
2. import js
```js
__GENERATE_DAPP__
```

## documentation
- https://afeiship.github.io/react-status-manager/


## license
Code released under [the MIT license](https://github.com/afeiship/react-status-manager/blob/master/LICENSE.txt).

[version-image]: https://img.shields.io/npm/v/@jswork/react-status-manager
[version-url]: https://npmjs.org/package/@jswork/react-status-manager

[license-image]: https://img.shields.io/npm/l/@jswork/react-status-manager
[license-url]: https://github.com/afeiship/react-status-manager/blob/master/LICENSE.txt

[size-image]: https://img.shields.io/bundlephobia/minzip/@jswork/react-status-manager
[size-url]: https://github.com/afeiship/react-status-manager/blob/master/dist/react-status-manager.min.js

[download-image]: https://img.shields.io/npm/dm/@jswork/react-status-manager
[download-url]: https://www.npmjs.com/package/@jswork/react-status-manager
Loading

0 comments on commit 005852e

Please sign in to comment.