From 329822bf2d95af9b43c86d6886850cc491ed45a0 Mon Sep 17 00:00:00 2001 From: Scott Nath Date: Wed, 11 Oct 2023 11:51:35 -0400 Subject: [PATCH] :clown_face: more examples, update fixtures --- .../fixtures/generated/user--scottnath.json | 2 +- .../repo--freeCodeCamp-freeCodeCamp.json | 24 +++++++++---------- .../repo--scottnath-profile-components.json | 12 +++++----- .../repo--scottnath-scottnath.com.json | 14 +++++------ .../repo--storydocker-storydocker.json | 8 +++---- .../generated/user--sindresorhus.json | 4 ++-- src/github/repository/index.js | 4 ++++ src/github/repository/repository.stories.js | 16 ++++++++++++- 8 files changed, 51 insertions(+), 33 deletions(-) diff --git a/src/devto/fixtures/generated/user--scottnath.json b/src/devto/fixtures/generated/user--scottnath.json index f525249..704e065 100644 --- a/src/devto/fixtures/generated/user--scottnath.json +++ b/src/devto/fixtures/generated/user--scottnath.json @@ -5,7 +5,7 @@ "name": "Scott Nath", "twitter_username": null, "github_username": "scottnath", - "summary": "Front-end UI DevOps architect. Efficiency in all things and productivity will follow. former IBM, NBCUniversal", + "summary": "Front-end UI DevOps architect. Efficiency in all things and productivity will follow. \nformer IBM, NBCUniversal", "location": "New York, United States", "website_url": "https://scottnath.com", "joined_at": "Mar 30, 2023", diff --git a/src/github/fixtures/generated/repo--freeCodeCamp-freeCodeCamp.json b/src/github/fixtures/generated/repo--freeCodeCamp-freeCodeCamp.json index 220fbd8..7a749f4 100644 --- a/src/github/fixtures/generated/repo--freeCodeCamp-freeCodeCamp.json +++ b/src/github/fixtures/generated/repo--freeCodeCamp-freeCodeCamp.json @@ -65,16 +65,16 @@ "releases_url": "https://api.github.com/repos/freeCodeCamp/freeCodeCamp/releases{/id}", "deployments_url": "https://api.github.com/repos/freeCodeCamp/freeCodeCamp/deployments", "created_at": "2014-12-24T17:49:19Z", - "updated_at": "2023-09-13T23:27:20Z", - "pushed_at": "2023-09-13T16:20:11Z", + "updated_at": "2023-10-11T15:18:50Z", + "pushed_at": "2023-10-11T15:19:05Z", "git_url": "git://github.com/freeCodeCamp/freeCodeCamp.git", "ssh_url": "git@github.com:freeCodeCamp/freeCodeCamp.git", "clone_url": "https://github.com/freeCodeCamp/freeCodeCamp.git", "svn_url": "https://github.com/freeCodeCamp/freeCodeCamp", "homepage": "http://contribute.freecodecamp.org/", - "size": 387674, - "stargazers_count": 373581, - "watchers_count": 373581, + "size": 380060, + "stargazers_count": 375781, + "watchers_count": 375781, "language": "TypeScript", "has_issues": true, "has_projects": true, @@ -82,11 +82,11 @@ "has_wiki": false, "has_pages": true, "has_discussions": false, - "forks_count": 33500, + "forks_count": 34217, "mirror_url": null, "archived": false, "disabled": false, - "open_issues_count": 251, + "open_issues_count": 284, "license": { "key": "bsd-3-clause", "name": "BSD 3-Clause \"New\" or \"Revised\" License", @@ -116,9 +116,9 @@ "teachers" ], "visibility": "public", - "forks": 33500, - "open_issues": 251, - "watchers": 373581, + "forks": 34217, + "open_issues": 284, + "watchers": 375781, "default_branch": "main", "temp_clone_token": null, "organization": { @@ -141,6 +141,6 @@ "type": "Organization", "site_admin": false }, - "network_count": 33500, - "subscribers_count": 8467 + "network_count": 34217, + "subscribers_count": 8461 } \ No newline at end of file diff --git a/src/github/fixtures/generated/repo--scottnath-profile-components.json b/src/github/fixtures/generated/repo--scottnath-profile-components.json index 7e745fd..f24324b 100644 --- a/src/github/fixtures/generated/repo--scottnath-profile-components.json +++ b/src/github/fixtures/generated/repo--scottnath-profile-components.json @@ -65,14 +65,14 @@ "releases_url": "https://api.github.com/repos/scottnath/profile-components/releases{/id}", "deployments_url": "https://api.github.com/repos/scottnath/profile-components/deployments", "created_at": "2023-08-16T13:36:29Z", - "updated_at": "2023-09-13T20:08:49Z", - "pushed_at": "2023-09-13T20:23:53Z", + "updated_at": "2023-09-22T17:21:21Z", + "pushed_at": "2023-10-11T15:09:13Z", "git_url": "git://github.com/scottnath/profile-components.git", "ssh_url": "git@github.com:scottnath/profile-components.git", "clone_url": "https://github.com/scottnath/profile-components.git", "svn_url": "https://github.com/scottnath/profile-components", - "homepage": null, - "size": 4329, + "homepage": "https://scottnath.com/profile-components/", + "size": 11164, "stargazers_count": 1, "watchers_count": 1, "language": "JavaScript", @@ -86,7 +86,7 @@ "mirror_url": null, "archived": false, "disabled": false, - "open_issues_count": 0, + "open_issues_count": 4, "license": { "key": "mit", "name": "MIT License", @@ -100,7 +100,7 @@ "topics": [], "visibility": "public", "forks": 0, - "open_issues": 0, + "open_issues": 4, "watchers": 1, "default_branch": "main", "temp_clone_token": null, diff --git a/src/github/fixtures/generated/repo--scottnath-scottnath.com.json b/src/github/fixtures/generated/repo--scottnath-scottnath.com.json index e8f1413..d389fdc 100644 --- a/src/github/fixtures/generated/repo--scottnath-scottnath.com.json +++ b/src/github/fixtures/generated/repo--scottnath-scottnath.com.json @@ -65,28 +65,28 @@ "releases_url": "https://api.github.com/repos/scottnath/scottnath.com/releases{/id}", "deployments_url": "https://api.github.com/repos/scottnath/scottnath.com/deployments", "created_at": "2023-07-03T16:45:49Z", - "updated_at": "2023-08-16T20:18:19Z", - "pushed_at": "2023-09-12T19:33:37Z", + "updated_at": "2023-09-15T19:56:25Z", + "pushed_at": "2023-10-10T19:51:09Z", "git_url": "git://github.com/scottnath/scottnath.com.git", "ssh_url": "git@github.com:scottnath/scottnath.com.git", "clone_url": "https://github.com/scottnath/scottnath.com.git", "svn_url": "https://github.com/scottnath/scottnath.com", "homepage": "https://scottnath.com", - "size": 3093, + "size": 5504, "stargazers_count": 0, "watchers_count": 0, "language": "HTML", "has_issues": true, - "has_projects": true, + "has_projects": false, "has_downloads": true, - "has_wiki": true, + "has_wiki": false, "has_pages": false, "has_discussions": false, "forks_count": 0, "mirror_url": null, "archived": false, "disabled": false, - "open_issues_count": 1, + "open_issues_count": 5, "license": { "key": "mit", "name": "MIT License", @@ -100,7 +100,7 @@ "topics": [], "visibility": "public", "forks": 0, - "open_issues": 1, + "open_issues": 5, "watchers": 0, "default_branch": "main", "temp_clone_token": null, diff --git a/src/github/fixtures/generated/repo--storydocker-storydocker.json b/src/github/fixtures/generated/repo--storydocker-storydocker.json index 49d902f..70eb60f 100644 --- a/src/github/fixtures/generated/repo--storydocker-storydocker.json +++ b/src/github/fixtures/generated/repo--storydocker-storydocker.json @@ -66,13 +66,13 @@ "deployments_url": "https://api.github.com/repos/storydocker/storydocker/deployments", "created_at": "2023-04-03T12:11:02Z", "updated_at": "2023-08-16T20:18:32Z", - "pushed_at": "2023-09-12T10:26:37Z", + "pushed_at": "2023-10-11T10:47:00Z", "git_url": "git://github.com/storydocker/storydocker.git", "ssh_url": "git@github.com:storydocker/storydocker.git", "clone_url": "https://github.com/storydocker/storydocker.git", "svn_url": "https://github.com/storydocker/storydocker", "homepage": "", - "size": 1599, + "size": 2419, "stargazers_count": 1, "watchers_count": 1, "language": "JavaScript", @@ -86,7 +86,7 @@ "mirror_url": null, "archived": false, "disabled": false, - "open_issues_count": 1, + "open_issues_count": 4, "license": { "key": "mit", "name": "MIT License", @@ -102,7 +102,7 @@ ], "visibility": "public", "forks": 0, - "open_issues": 1, + "open_issues": 4, "watchers": 1, "default_branch": "main", "temp_clone_token": null, diff --git a/src/github/fixtures/generated/user--sindresorhus.json b/src/github/fixtures/generated/user--sindresorhus.json index c511daf..1e8f05c 100644 --- a/src/github/fixtures/generated/user--sindresorhus.json +++ b/src/github/fixtures/generated/user--sindresorhus.json @@ -25,9 +25,9 @@ "hireable": null, "bio": "Full-Time Open-Sourcerer. Focuses on Swift & JavaScript. Makes macOS apps, CLI tools, npm packages. Likes unicorns.", "twitter_username": "sindresorhus", - "public_repos": 1071, + "public_repos": 1072, "public_gists": 96, - "followers": 58014, + "followers": 58419, "following": 53, "created_at": "2009-12-20T22:57:02Z", "updated_at": "2023-09-12T05:57:55Z" diff --git a/src/github/repository/index.js b/src/github/repository/index.js index 00a7d11..7823ae3 100644 --- a/src/github/repository/index.js +++ b/src/github/repository/index.js @@ -21,6 +21,7 @@ import { repository as styles } from '../styles/index.js'; * @property {boolean} [fetch] - when true, fetches repo from [GitHub api](https://docs.github.com/en/rest/repos/repos#get-a-repository) * @property {string} [itemprop] - Itemprop content to go with a containing component's itemscope * @property {string} [no_org] - Do not include the repo owner or organization + * @property {string} [theme] - color theme for the component * * @example * @@ -61,6 +62,9 @@ export class GitHubRepository extends HTMLElement { if (this.attrs.itemprop) { this.setAttribute('itemprop', this.attrs.itemprop); } + if (this.attrs.theme) { + this.setAttribute('data-theme', this.attrs.theme); + } } } diff --git a/src/github/repository/repository.stories.js b/src/github/repository/repository.stories.js index 61fd833..6afe1bb 100644 --- a/src/github/repository/repository.stories.js +++ b/src/github/repository/repository.stories.js @@ -32,7 +32,6 @@ export const Repository = { } } - export const FullNameOnly = { args: { full_name: repoProfileComponents.full_name, @@ -59,10 +58,25 @@ export const LanguageCircle = { args: { full_name: 'just-another/c-plus-plus-repo', language: 'C++', + stargazers_count: '123', + forks_count: '456', + subscribers_count: '789', + description: 'This is meow meow.' }, play: Repository.play, } +export const Theme = { + args: { + ...parseFetchedRepo(repoFreeCodeCamp), + theme: 'dark', + }, + play: async ({ args, canvasElement, step }) => { + const elements = await getElements(canvasElement); + await ensureElements(elements, args); + } +} + export const Fetch = { args: { full_name: repoProfileComponents.full_name,