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 1, 2021
1 parent 680e3f9 commit da1c364
Show file tree
Hide file tree
Showing 34 changed files with 521 additions and 208 deletions.
11 changes: 9 additions & 2 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
{
"presets": ["@babel/preset-env", "@babel/react"],
"presets": [[
"@babel/preset-env",
{
"targets": { "browsers": [ "last 2 versions" ] }
}
], "@babel/react"],
"plugins": [
[ "@babel/plugin-proposal-decorators", { "legacy": true } ],
[ "@babel/plugin-proposal-class-properties", { "loose": 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
7 changes: 6 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Rakefile
**/npm-debug.log
**/node_modules

bin
src
docs
build
Expand All @@ -20,11 +21,15 @@ 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 <[email protected]>

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.
96 changes: 73 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,52 +1,102 @@
# react-textarea
> Textarea with text limit for react.
## installation
```shell
npm install -S @feizheng/react-textarea
```
[![version][version-image]][version-url]
[![license][license-image]][license-url]
[![size][size-image]][size-url]
[![download][download-image]][download-url]

## update
## installation
```shell
npm update @feizheng/react-textarea
npm install -S @jswork/react-textarea
```

## properties
| property | type | default | description |
| --------- | ------ | ------- | ----------- |
| className | String | - | - |
| value | - | - | - |
| onChange | - | - | - |
| Name | Type | Required | Default | Description |
| --------- | ------ | -------- | ------- | ------------------------------------- |
| className | string | false | - | The extended className for component. |
| autosize | bool | false | - | If auto height. |
| onChange | func | false | noop | The handler when value change. |
| value | string | false | - | The runtime value. |


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

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

// customize your styles:
$react-textarea-options: ()
```
2. import js
```js
import ReactDemokit from '@jswork/react-demokit';
import React from 'react';
import ReactDOM from 'react-dom';
import ReactTextarea from '@feizheng/react-textarea';

// your app:
class App extends React.Component{
render(){
import ReactTextarea from '@jswork/react-textarea';
import './assets/style.scss';

class App extends React.Component {
state = { value: '' };

handleChange = (inEvent) => {
this.setState({ value: inEvent.target.value });
};

handleSubmit = (inEvent) => {
console.log({ value: this.state.value });
};

render() {
return (
<ReactTextarea />
)
<ReactDemokit
className="p-3 app-container"
url="https://github.com/afeiship/react-textarea">
<article className="message is-info">
<div className="message-header">Preview:</div>
<div className="message-body">
<ReactTextarea
placeholder="Please input your text..."
className="textarea mb-2"
autosize
onChange={this.handleChange}
/>
<button className="button is-primary" onClick={this.handleSubmit}>
Submit
</button>
</div>
</article>
<article className="message">
<div className="message-header">Value changed:</div>
<div className="message-body">{JSON.stringify(this.state.value)}</div>
</article>
</ReactDemokit>
);
}
}

// render to dom:
ReactDOM.render(<App/>, document.getElementById('app'));
ReactDOM.render(<App />, document.getElementById('app'));

```

## documentation
- https://afeiship.github.io/react-textarea/

## resources
- https://github.com/jackmoore/autosize

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

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

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

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

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

This file was deleted.

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-textarea/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
52 changes: 52 additions & 0 deletions build/TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# react-textarea
> Textarea with text limit for react.
[![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-textarea
```

## properties
__GENERATE_DOCS__

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

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

// customize your styles:
$react-textarea-options: ()
```
2. import js
```js
__GENERATE_DAPP__
```
## resources
- https://github.com/jackmoore/autosize

## documentation
- https://afeiship.github.io/react-textarea/


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

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

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

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

[download-image]: https://img.shields.io/npm/dm/@jswork/react-textarea
[download-url]: https://www.npmjs.com/package/@jswork/react-textarea
16 changes: 12 additions & 4 deletions build/index.js → build/base.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {
configs,
inputs,
outputs,
loaders,
outputs,
plugins
} from '@feizheng/webpack-lib-kits';
} from '@jswork/webpack-lib-kits';

export default {
mode: configs.mode(),
Expand All @@ -15,7 +15,15 @@ export default {
alias: configs.alias()
},
module: {
rules: [loaders.babel(), loaders.image(), loaders.sass(), loaders.version()]
rules: [
loaders.babel(),
loaders.image(),
loaders.sass(),
loaders.version()
]
},
plugins: [plugins.minCssExtract()]
plugins: [
plugins.progressBar(),
plugins.minCssExtract()
]
};
22 changes: 0 additions & 22 deletions build/build.js

This file was deleted.

4 changes: 2 additions & 2 deletions build/dev.js → build/development.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import baseConfig from '.';
import baseConfig from './base';
import merge from 'webpack-merge';
import { configs, inputs, outputs, loaders, plugins } from '@feizheng/webpack-lib-kits';
import { configs, inputs, outputs, loaders, plugins } from '@jswork/webpack-lib-kits';

export default merge(baseConfig, {
entry: inputs.docs(),
Expand Down
Loading

0 comments on commit da1c364

Please sign in to comment.