Skip to content

Commit f332918

Browse files
committed
Updated Storybook
1 parent 8390a36 commit f332918

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
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": {
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import React from 'react'
22
import Card from './index.js'
3-
import { withKnobs, text } from '@storybook/addon-knobs'
3+
import { withKnobs, text, boolean } from '@storybook/addon-knobs'
44

55
export default { title: 'Card component', decorators: [withKnobs]}
66
export 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
}

src/components/Card/index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff 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': {

0 commit comments

Comments
 (0)