|
2 | 2 |
|
3 | 3 | Web components which display profile information from various websites |
4 | 4 |
|
5 | | -## @todo |
6 | 5 |
|
7 | | -- [ ] docs for unpkg usage |
8 | | -- [ ] add stackblitz demo |
9 | | -- [ ] typescript types output from JSDoc |
| 6 | +* install via npm: `npm i profile-components` |
| 7 | +* play with the components in [Storybook](https://scottnath.github.io/profile-components) |
| 8 | +* [See demos on stackblitz](https://stackblitz.com/edit/profile-components) |
10 | 9 |
|
11 | | -## Other profile sources |
| 10 | +## Components |
12 | 11 |
|
13 | | -* Reddit: https://www.reddit.com/user/scottnath/about/.json |
14 | | -* LinkedIn: (3rd party) https://help.lix-it.com/en/articles/6674073-what-data-can-i-export-from-linkedin |
| 12 | +## Modules |
| 13 | + |
| 14 | +<dl> |
| 15 | +<dt><a href="#module_GitHubUser">GitHubUser</a></dt> |
| 16 | +<dd><p>GitHub user profile web component</p> |
| 17 | +</dd> |
| 18 | +<dt><a href="#module_GitHubRepository">GitHubRepository</a></dt> |
| 19 | +<dd><p>GitHub repository web component</p> |
| 20 | +</dd> |
| 21 | +<dt><a href="#module_DevtoUser">DevtoUser</a></dt> |
| 22 | +<dd><p>dev.to user profile web component</p> |
| 23 | +</dd> |
| 24 | +<dt><a href="#module_DevtoPost">DevtoPost</a></dt> |
| 25 | +<dd><p>dev.to post web component</p> |
| 26 | +</dd> |
| 27 | +</dl> |
| 28 | + |
| 29 | +<a name="module_GitHubUser"></a> |
| 30 | + |
| 31 | +## GitHubUser |
| 32 | +GitHub user profile web component |
| 33 | + |
| 34 | +**Summary**: Native web component which shows a GitHub user's profile content. Can use local data, |
| 35 | + fetch data from the GitHub rest API, or use a combination of both. |
| 36 | +**Element**: github-user |
| 37 | +**Properties** |
| 38 | + |
| 39 | +| Name | Type | Description | |
| 40 | +| --- | --- | --- | |
| 41 | +| login | <code>string</code> | User's GitHub login | |
| 42 | +| avatar_url | <code>string</code> | URL to user's avatar | |
| 43 | +| name | <code>string</code> | User's name | |
| 44 | +| [fetch] | <code>boolean</code> | when true, fetches user from [GitHub api](https://docs.github.com/en/rest/users/users#get-a-user) | |
| 45 | +| [username] | <code>string</code> | alias for `login` | |
| 46 | +| [bio] | <code>string</code> | User's biography content | |
| 47 | +| [following] | <code>string</code> | number of people user is following | |
| 48 | +| [followers] | <code>string</code> | number of followers | |
| 49 | +| [repos] | <code>string</code> | JSON stringified array of repositories | |
| 50 | + |
| 51 | +**Example** |
| 52 | +```js |
| 53 | +<!-- import the web component --> |
| 54 | +<script type="module" src="https://unpkg.com/profile-components/dist/github-user.js"></script> |
| 55 | + |
| 56 | +<!-- use the custom element --> |
| 57 | +<github-user login="scottnath" fetch="true"></github-user> |
| 58 | +``` |
| 59 | +<a name="module_GitHubRepository"></a> |
| 60 | + |
| 61 | +## GitHubRepository |
| 62 | +GitHub repository web component |
| 63 | + |
| 64 | +**Summary**: Native web component which shows a GitHub repository's content. Can use local data, |
| 65 | + fetch data from the GitHub rest API, or use a combination of both. |
| 66 | +**Element**: github-repository |
| 67 | +**Properties** |
| 68 | + |
| 69 | +| Name | Type | Description | |
| 70 | +| --- | --- | --- | |
| 71 | +| full_name | <code>string</code> | repository org and name, as in `scottnath/profile-components` | |
| 72 | +| [name] | <code>string</code> | repo name | |
| 73 | +| [org] | <code>string</code> | repo owner organization's login, found at `<REST_RESPONSE>.organization.login` | |
| 74 | +| [description] | <code>string</code> | repo description | |
| 75 | +| [language] | <code>string</code> | programming language used in repo | |
| 76 | +| [stargazers_count] | <code>string</code> | number of stars | |
| 77 | +| [forks_count] | <code>string</code> | number of forks | |
| 78 | +| [subscribers_count] | <code>string</code> | number of watchers | |
| 79 | +| [fetch] | <code>boolean</code> | when true, fetches repo from [GitHub api](https://docs.github.com/en/rest/repos/repos#get-a-repository) | |
| 80 | +| [itemprop] | <code>string</code> | Itemprop content to go with a containing component's itemscope | |
| 81 | +| [no_org] | <code>string</code> | Do not include the repo owner or organization | |
| 82 | + |
| 83 | +**Example** |
| 84 | +```js |
| 85 | +<!-- import the web component --> |
| 86 | +<script type="module" src="https://unpkg.com/profile-components/dist/github-repository.js"></script> |
| 87 | + |
| 88 | +<!-- use the custom element --> |
| 89 | +<github-repository full_name="scottnath/profile-components" fetch="true"></github-repository> |
| 90 | +``` |
| 91 | +<a name="module_DevtoUser"></a> |
| 92 | + |
| 93 | +## DevtoUser |
| 94 | +dev.to user profile web component |
| 95 | + |
| 96 | +**Summary**: Native web component which shows a dev.to user's profile content. |
| 97 | + Can use local data, or fetch data from the dev.to API, or use a combination of both. |
| 98 | +**Element**: devto-user |
| 99 | +**Properties** |
| 100 | + |
| 101 | +| Name | Type | Description | |
| 102 | +| --- | --- | --- | |
| 103 | +| username | <code>string</code> | User's dev.to username | |
| 104 | +| [name] | <code>string</code> | The name of the user | |
| 105 | +| [summary] | <code>string</code> | The user's bio | |
| 106 | +| [joined_at] | <code>string</code> | The date the user joined | |
| 107 | +| [profile_image] | <code>string</code> | The URL of the user's profile image | |
| 108 | +| [fetch] | <code>boolean</code> | when true, fetches user and posts from api | |
| 109 | +| [post_count] | <code>number</code> | The number of posts the user has published | |
| 110 | +| [latest_post] | <code>string</code> | User's latest post content, JSON stringified | |
| 111 | +| [popular_post] | <code>string</code> | User's most popular post content, JSON stringified | |
| 112 | + |
| 113 | +**Example** |
| 114 | +```js |
| 115 | +<!-- import the web component --> |
| 116 | +<script type="module" src="https://unpkg.com/profile-components/dist/devto-user.js"></script> |
| 117 | + |
| 118 | +<!-- use the custom element --> |
| 119 | +<devto-user username="scottnath" fetch="true"></devto-user> |
| 120 | +``` |
| 121 | +<a name="module_DevtoPost"></a> |
| 122 | + |
| 123 | +## DevtoPost |
| 124 | +dev.to post web component |
| 125 | + |
| 126 | +**Summary**: Native web component which shows a dev.to (or forem.dev) post. Can use local data, |
| 127 | + fetch data from the dev.to API, or use a combination of both. |
| 128 | +**Element**: devto-post |
| 129 | +**Properties** |
| 130 | + |
| 131 | +| Name | Type | Description | |
| 132 | +| --- | --- | --- | |
| 133 | +| id | <code>number</code> | Post ID | |
| 134 | +| title | <code>string</code> | Post title | |
| 135 | +| url | <code>string</code> | Post URL | |
| 136 | +| cover_image | <code>string</code> | Post cover image URL | |
| 137 | +| social_image | <code>string</code> | Post social image URL | |
| 138 | +| [fetch] | <code>boolean</code> | when true, fetches post from api | |
| 139 | + |
| 140 | +**Example** |
| 141 | +```js |
| 142 | +<!-- import the web component --> |
| 143 | +<script type="module" src="https://unpkg.com/profile-components/dist/devto-post.js"></script> |
| 144 | + |
| 145 | +<!-- use the custom element --> |
| 146 | +<devto-post id="123456" fetch="true"></devto-post> |
| 147 | +``` |
0 commit comments