@qixian.cs/github-contributors-list
Advanced tools
Comparing version 1.0.0 to 1.0.1
import React from 'react'; | ||
export interface AvatarListItem { | ||
username: string; | ||
url: string; | ||
username?: string; | ||
url?: string; | ||
} | ||
@@ -12,5 +12,5 @@ export interface ButtonProps { | ||
repo: string; | ||
renderItem?: (item: AvatarListItem) => React.ReactNode; | ||
renderItem?: (item?: AvatarListItem, loading?: boolean) => React.ReactNode; | ||
} | ||
declare const AvatarList: React.FC<ButtonProps>; | ||
export default AvatarList; |
@@ -191,2 +191,7 @@ import React, { useState, useEffect } from 'react'; | ||
var _useState3 = useState(true), | ||
_useState4 = _slicedToArray(_useState3, 2), | ||
loading = _useState4[0], | ||
setLoading = _useState4[1]; | ||
useEffect(function () { | ||
@@ -199,4 +204,12 @@ getAvatarList({ | ||
setList(data); | ||
setLoading(false); | ||
}).catch(function () { | ||
setLoading(false); | ||
}); | ||
}, []); | ||
if (loading) { | ||
return React.createElement("div", null, renderItem && renderItem({}, true) || React.createElement("span", null, "loading")); | ||
} | ||
return React.createElement(React.Fragment, null, React.createElement("ul", { | ||
@@ -212,3 +225,3 @@ className: className, | ||
if (renderItem) { | ||
return renderItem(item); | ||
return renderItem(item, loading); | ||
} | ||
@@ -215,0 +228,0 @@ |
@@ -196,2 +196,7 @@ 'use strict'; | ||
var _useState3 = React.useState(true), | ||
_useState4 = _slicedToArray(_useState3, 2), | ||
loading = _useState4[0], | ||
setLoading = _useState4[1]; | ||
React.useEffect(function () { | ||
@@ -204,4 +209,12 @@ getAvatarList({ | ||
setList(data); | ||
setLoading(false); | ||
}).catch(function () { | ||
setLoading(false); | ||
}); | ||
}, []); | ||
if (loading) { | ||
return React__default.createElement("div", null, renderItem && renderItem({}, true) || React__default.createElement("span", null, "loading")); | ||
} | ||
return React__default.createElement(React__default.Fragment, null, React__default.createElement("ul", { | ||
@@ -217,3 +230,3 @@ className: className, | ||
if (renderItem) { | ||
return renderItem(item); | ||
return renderItem(item, loading); | ||
} | ||
@@ -220,0 +233,0 @@ |
{ | ||
"name": "@qixian.cs/github-contributors-list", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "", | ||
@@ -14,3 +14,4 @@ "main": "dist/index.js", | ||
"build": "father build", | ||
"site": "father doc build && gh-pages -d ./.doc" | ||
"site": "father doc build && gh-pages -d ./.doc", | ||
"prepublishOnly": "npm run build && np --no-cleanup --yolo --no-publish" | ||
}, | ||
@@ -17,0 +18,0 @@ "homepage": "https://github.com/chenshuai2144/github-contributors-list", |
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
29750
888