File tree Expand file tree Collapse file tree 3 files changed +11
-9
lines changed
Expand file tree Collapse file tree 3 files changed +11
-9
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " react-github-stats-card-v2" ,
3- "version" : " 0.1.1 " ,
3+ "version" : " 0.1.2 " ,
44 "description" : " GitHub Stats card component for React applications." ,
55 "main" : " index.js" ,
66 "scripts" : {
Original file line number Diff line number Diff line change 11import React from 'react'
22import Card from './index.js'
3- import { withKnobs , text } from '@storybook/addon-knobs'
3+ import { withKnobs , text , boolean } from '@storybook/addon-knobs'
44
55export default { title : 'Card component' , decorators : [ withKnobs ] }
66export const card = ( ) => {
7- const username = text ( 'Text' , 'cnocon' )
8- return < Card username = { username } theme = { true } > </ Card >
7+ const username = text ( 'username' , 'cnocon' )
8+ const accessToken = text ( 'access token' , '' )
9+ const theme = boolean ( 'theme' , true )
10+ return < Card username = { username } theme = { theme } accessToken = { accessToken } > </ Card >
911}
Original file line number Diff line number Diff line change @@ -15,15 +15,15 @@ function Card({...props}) {
1515 return newString ;
1616 }
1717
18- const getUserReposData = ( username , accessToken = null ) => {
18+ const getUserReposData = ( username , accessToken = '' ) => {
1919 let options ;
2020
21- if ( accessToken ) {
21+ if ( accessToken && accessToken . length > 0 ) {
2222 options = {
2323 'method' : 'GET' ,
2424 'headers' : {
2525 'Accept' : 'application/vnd.github.v3+json' ,
26- 'User-Agent' : `@cnocon/ github-stats-card-v2` ,
26+ 'User-Agent' : `react- github-stats-card-v2` ,
2727 'Authorization' : `token ${ accessToken } `
2828 }
2929 }
@@ -32,7 +32,7 @@ function Card({...props}) {
3232 'method' : 'GET' ,
3333 'headers' : {
3434 'Accept' : 'application/vnd.github.v3+json' ,
35- 'User-Agent' : `@cnocon/ github-stats-card-v2`
35+ 'User-Agent' : `react- github-stats-card-v2`
3636 }
3737 }
3838 } ;
@@ -73,7 +73,7 @@ function Card({...props}) {
7373 const getUserData = ( username , accessToken = null ) => {
7474 let options ;
7575
76- if ( accessToken ) {
76+ if ( accessToken && accessToken . length > 0 ) {
7777 options = {
7878 'method' : 'GET' ,
7979 'headers' : {
You can’t perform that action at this time.
0 commit comments