@uiw/react-shields
Advanced tools
Comparing version 1.3.1 to 1.3.2
@@ -16,4 +16,5 @@ import React, { Component } from 'react'; | ||
constructor(props: BaseProps & T, defaultState: BaseProps & T, forceState?: BaseProps & T); | ||
componentDidUpdate(prevProps: Readonly<BaseProps & T>, prevState: Readonly<BaseState & T>, snapshot?: any): void; | ||
getUrl: () => string; | ||
render(): import("react/jsx-runtime").JSX.Element; | ||
} |
@@ -32,2 +32,9 @@ "use strict"; | ||
(0, _createClass2["default"])(Base, [{ | ||
key: "componentDidUpdate", | ||
value: function componentDidUpdate(prevProps, prevState, snapshot) { | ||
if (prevProps !== this.props) { | ||
this.setState((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, this.state), this.props)); | ||
} | ||
} | ||
}, { | ||
key: "render", | ||
@@ -34,0 +41,0 @@ value: function render() { |
@@ -16,4 +16,5 @@ import Base, { BaseProps } from '../common/Base'; | ||
export default class Codacy extends Base<CodacyProps> { | ||
static defaultProps: BaseProps; | ||
constructor(props: CodacyProps); | ||
getUrl: () => string; | ||
} |
@@ -39,2 +39,6 @@ "use strict"; | ||
exports["default"] = Codacy; | ||
(0, _defineProperty2["default"])(Codacy, "defaultProps", { | ||
platform: 'coveralls', | ||
base: 'https://img.shields.io' | ||
}); | ||
module.exports = exports.default; |
@@ -22,4 +22,5 @@ import Base, { BaseProps } from '../common/Base'; | ||
export default class Coverages extends Base<CoveragesProps> { | ||
static defaultProps: BaseProps; | ||
constructor(props: CoveragesProps); | ||
getUrl: () => string; | ||
} |
@@ -41,2 +41,6 @@ "use strict"; | ||
exports["default"] = Coverages; | ||
(0, _defineProperty2["default"])(Coverages, "defaultProps", { | ||
platform: 'coveralls', | ||
base: 'https://img.shields.io' | ||
}); | ||
module.exports = exports.default; |
@@ -18,4 +18,5 @@ import Base, { BaseProps } from '../common/Base'; | ||
export default class Downloads extends Base<DownloadProps> { | ||
static defaultProps: BaseProps; | ||
constructor(props: DownloadProps); | ||
getUrl: () => string; | ||
} |
@@ -56,2 +56,6 @@ "use strict"; | ||
exports["default"] = Downloads; | ||
(0, _defineProperty2["default"])(Downloads, "defaultProps", { | ||
platform: 'npm', | ||
base: 'https://img.shields.io' | ||
}); | ||
module.exports = exports.default; |
@@ -25,4 +25,5 @@ import Base, { BaseProps } from '../common/Base'; | ||
export default class Size extends Base<SizeProps> { | ||
static defaultProps: BaseProps; | ||
constructor(props: SizeProps); | ||
getUrl: () => string; | ||
} |
@@ -72,2 +72,6 @@ "use strict"; | ||
exports["default"] = Size; | ||
(0, _defineProperty2["default"])(Size, "defaultProps", { | ||
platform: 'npm', | ||
base: 'https://img.shields.io' | ||
}); | ||
module.exports = exports.default; |
@@ -51,4 +51,5 @@ import Base, { BaseProps } from '../common/Base'; | ||
export default class Version extends Base<VersionProps> { | ||
static defaultProps: BaseProps; | ||
constructor(props: VersionProps); | ||
getUrl: () => string; | ||
} |
@@ -120,2 +120,6 @@ "use strict"; | ||
exports["default"] = Version; | ||
(0, _defineProperty2["default"])(Version, "defaultProps", { | ||
platform: 'npm', | ||
base: 'https://img.shields.io' | ||
}); | ||
module.exports = exports.default; |
@@ -16,4 +16,5 @@ import React, { Component } from 'react'; | ||
constructor(props: BaseProps & T, defaultState: BaseProps & T, forceState?: BaseProps & T); | ||
componentDidUpdate(prevProps: Readonly<BaseProps & T>, prevState: Readonly<BaseState & T>, snapshot?: any): void; | ||
getUrl: () => string; | ||
render(): import("react/jsx-runtime").JSX.Element; | ||
} |
@@ -11,2 +11,7 @@ import _extends from "@babel/runtime/helpers/extends"; | ||
} | ||
componentDidUpdate(prevProps, prevState, snapshot) { | ||
if (prevProps !== this.props) { | ||
this.setState(_extends({}, this.state, this.props)); | ||
} | ||
} | ||
render() { | ||
@@ -13,0 +18,0 @@ var { |
@@ -16,4 +16,5 @@ import Base, { BaseProps } from '../common/Base'; | ||
export default class Codacy extends Base<CodacyProps> { | ||
static defaultProps: BaseProps; | ||
constructor(props: CodacyProps); | ||
getUrl: () => string; | ||
} |
@@ -19,2 +19,6 @@ import Base from '../common/Base'; | ||
} | ||
} | ||
} | ||
Codacy.defaultProps = { | ||
platform: 'coveralls', | ||
base: 'https://img.shields.io' | ||
}; |
@@ -22,4 +22,5 @@ import Base, { BaseProps } from '../common/Base'; | ||
export default class Coverages extends Base<CoveragesProps> { | ||
static defaultProps: BaseProps; | ||
constructor(props: CoveragesProps); | ||
getUrl: () => string; | ||
} |
@@ -21,2 +21,6 @@ import Base from '../common/Base'; | ||
} | ||
} | ||
} | ||
Coverages.defaultProps = { | ||
platform: 'coveralls', | ||
base: 'https://img.shields.io' | ||
}; |
@@ -18,4 +18,5 @@ import Base, { BaseProps } from '../common/Base'; | ||
export default class Downloads extends Base<DownloadProps> { | ||
static defaultProps: BaseProps; | ||
constructor(props: DownloadProps); | ||
getUrl: () => string; | ||
} |
@@ -36,2 +36,6 @@ import Base from '../common/Base'; | ||
} | ||
} | ||
} | ||
Downloads.defaultProps = { | ||
platform: 'npm', | ||
base: 'https://img.shields.io' | ||
}; |
@@ -25,4 +25,5 @@ import Base, { BaseProps } from '../common/Base'; | ||
export default class Size extends Base<SizeProps> { | ||
static defaultProps: BaseProps; | ||
constructor(props: SizeProps); | ||
getUrl: () => string; | ||
} |
@@ -52,2 +52,6 @@ import Base from '../common/Base'; | ||
} | ||
} | ||
} | ||
Size.defaultProps = { | ||
platform: 'npm', | ||
base: 'https://img.shields.io' | ||
}; |
@@ -51,4 +51,5 @@ import Base, { BaseProps } from '../common/Base'; | ||
export default class Version extends Base<VersionProps> { | ||
static defaultProps: BaseProps; | ||
constructor(props: VersionProps); | ||
getUrl: () => string; | ||
} |
@@ -102,2 +102,6 @@ import Base from '../common/Base'; | ||
} | ||
} | ||
} | ||
Version.defaultProps = { | ||
platform: 'npm', | ||
base: 'https://img.shields.io' | ||
}; |
{ | ||
"name": "@uiw/react-shields", | ||
"version": "1.3.1", | ||
"version": "1.3.2", | ||
"description": "Shields.io for react component, Quality metadata badges for open source projects.", | ||
@@ -5,0 +5,0 @@ "author": "Kenny Wong <wowohoo@qq.com>", |
@@ -126,2 +126,21 @@ react-shields | ||
```jsx mdx:preview | ||
import React from 'react'; | ||
import Npm from '@uiw/react-shields/npm'; | ||
export default function Demo() { | ||
const [scope, setScope] = React.useState('@uiw'); | ||
const [packageName, setPackageName] = React.useState('react-shields'); | ||
return ( | ||
<> | ||
<Npm.Size scope={scope} packageName={packageName} /> | ||
<div> | ||
<button onClick={() => setPackageName('react-shields')}>react-shields</button> | ||
<button onClick={() => setPackageName('react-codemirror')}>react-codemirror</button> | ||
</div> | ||
</> | ||
); | ||
} | ||
``` | ||
### Npm.Downloads | ||
@@ -128,0 +147,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
131719
3371
369