1.1.3 • Published 3 years ago

@feizheng/react-svg-circle v1.1.3

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

react-svg-circle

Svg circle for react.

version license size download

installation

npm install -S @feizheng/react-svg-circle

update

npm update @feizheng/react-svg-circle

properties

NameTypeRequiredDefaultDescription
classNamestringfalse-The extended className for component.
lineWidthnumberfalse10The circle line-width.
lineCapenumfalse'inherit'The circle line-cap.
valuenumberfalse0Circle deg, default 0.
onChangefuncfalsenoopThe change handler.
svgPropsanyfalse-Any other svg props.
elementPropsanyfalse-Any other circle(main element) props.

usage

  1. import css

    @import "~@feizheng/react-svg-circle/dist/style.scss";
    
    // customize your styles:
    $react-svg-circle-options: ()
  2. import js

    import ReactSvgCircle from '@feizheng/react-svg-circle';
    import ReactDOM from 'react-dom';
    import React from 'react';
    import './assets/style.scss';
    
    class App extends React.Component {
      state = {
        value: 180
      };
    
      render() {
        const { value } = this.state;
        return (
          <div className="app-container">
            <h2 className="is-title">Drag me to change</h2>
            <div className="is-control">
              <input
                type="range"
                onChange={(e) => {
                  const { value } = e.target;
                  this.setState({ value: parseInt(value) });
                }}
                step="1"
                min="0"
                max="360"
                value={value}
                name=""
                id=""
              />
            </div>
            <div className="is-component">
              <ReactSvgCircle lineWidth={20} lineCap="inherit" value={value}>
                <text
                  x="20"
                  y="35"
                  x="50%"
                  y="50%"
                  dominantBaseline="middle"
                  textAnchor="middle">
                  {value}%
                </text>
              </ReactSvgCircle>
            </div>
          </div>
        );
      }
    }
    
    ReactDOM.render(<App />, document.getElementById('app'));

fix ios9 debug

  • babel const error
    ["@babel/preset-env", {
      "targets": {
        "browsers": ["last 2 versions"],
      }
    }]
  • babel rest(..args)
    "@babel/plugin-transform-parameters"

documentation

resources

license

Code released under the MIT license.

1.1.3

3 years ago

1.1.1

4 years ago

1.1.2

4 years ago

1.1.0

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago