1.0.3 • Published 6 years ago

react-speedofme v1.0.3

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

React SpeedOf.Me Component

react-speedofme is a react component to use the API Speed Of Me

Build Status GitHub license GitHub issues

NPM

Usage:

NPM: npm install --save react-speedofme

Yarn: yarn add react-speedofme

// import the component
import { SpeedOfMe, preloadScript } from "react-speedofme";
// and just use it
class App extends Component {
  render () {
    return (
        <SpeedOfMe/>
    );
  }
}
// Export preloadScrtipt
export default preloadScript(App);

Creating Account and configuring SpeedOf.Me API

Configuration Options:

proptypedefaultcomments
segmentsnumber5Number of segments in the speedometer
textColorstring#666Should be a valid color code - colorname, hexadecimal name or rgb value. Used for both showing the current value and the segment values
startColorstring#FF471AShould be a valid color code - colorname, hexadecimal name or rgb value. Should be a valid input for d3.interpolateHsl
endColorstring#33CC33Should be a valid color code - colorname, hexadecimal name or rgb value. Should be a valid input for d3.interpolateHsl
needleColorstringsteelblueShould be a valid color code - colorname, hexadecimal name or rgb value. Should be a valid input for d3.interpolateHsl
needleTransitionDurationnumber500Time in milliseconds.
needleTransitionstringeaseQuadInOutd3-easing-identifiers - easeLinear, easeQuadIn, easeQuadOut, easeQuadInOut, easeCubicIn, easeCubicOut, easeCubicInOut, easePolyIn, easePolyOut, easePolyInOut, easeSinIn,
currentValueTextstring${value}Should be provided a string which should have ${value} placeholder which will be replaced with current value. By default, current value is shown (formatted with valueFormat). For example, if current Value is 333
loadingTextDownloadstringvalueShould be provided a string for modify the text default the test of download
loadingTextUploadstringvalueShould be provided a string for modify the text default the test of upload
textdownloadexcellentstringvalueShould be provided a string for modify the text default for download Excellent
textdownloadacceptablestringvalueShould be provided a string for modify the text default for download Acceptable
textuploadexcellentstringvalueShould be provided a string for modify the text default for upload Excellent
textuploadacceptablestringvalueShould be provided a string for modify the text default for upload Acceptable
accountstringvalueShould be provided your account SpeedOf.me
domainNamestringvalueDomain that will be tested

Examples

You can view Examples here

Default with no config
import { SpeedOfMe, preloadScript } from "react-speedofme";
class App extends Component {
  render () {
    return (
        <SpeedOfMe/>
    );
  }
}
export default preloadScript(App);
With configurations
class App extends Component {
  render () {
    return (
        <SpeedOfMe
            account=''
            domainName=''
            segments={2}
            textColor='#FFF'
            startColor='#F4552C'
            endColor='#F9F9F9'
            needleColor='#989898'
            needleTransitionDuration={4000}
            needleTransition='easeElastic'
            currentValueText='50'
            textdownloadexcellent='Velocidade de download execelente.'
            textdownloadacceptable='Velocidade de download aceitável.'
            textuploadexcellent='Velocidade de upload execelente.'
            textuploadacceptable='Velocidade de upload aceitável.'
            loadingTextDownload='Rodando teste de Download, por favor, aguarde...'
            loadingTextUpload='Rodando teste de Upload, por favor, aguarde...'
        />
    );
  }
}
export default preloadScript(App);

Credits:

react-d3-speedometer react-d3-speedometer opentok-react opentok-react

License:

MIT