Skip to content

Commit 09086d9

Browse files
committed
refactor(generalfiles): add more JSdoc, change background stacksIcons, component StackText css
1 parent 446699c commit 09086d9

File tree

9 files changed

+64
-37
lines changed

9 files changed

+64
-37
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "github-automated-repos",
33
"version": "1.0.25",
44
"description": "Github-automated-repos is the lib that gives you the power to manage the view of your projects on your website in one place!",
5-
"main": "src/index.ts",
5+
"main": "index.js",
66
"scripts": {
77
"commit": "git-cz",
88
"clean": "rm -rf dist",

src/components/ProjectIcons.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ type Props = {
77
className?: string;
88
};
99

10+
/**
11+
* @param {string} iconItem - Mandatory: ex.: item.topics.map(topics)... iconItem={topics}
12+
* @param {string} className - Optional: style className.
13+
* @returns {<img/>} - Return tag img, project svg icon.
14+
*/
15+
1016
export function ProjectIcons({ iconItem, className }: Props) {
1117
const { projectIcons } = IconsData();
1218
return (

src/components/StackIcons.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,20 @@ import React from 'react';
33
import { IconsData } from '../hooks/useGithubAutomatedRepos';
44

55
type Props = {
6-
iconItem: string;
6+
itemTopics: string;
77
className?: string;
88
};
9-
export function StackIcons({ iconItem, className }: Props) {
9+
10+
/**
11+
* @param {string} itemTopics - Mandatory: ex.: item.topics.map(itemTopics) ... iconStack={itemTopics}
12+
* @param {string} className - Optional: style className.
13+
* @returns {<img/>} - Return tag img, stack svg icon.
14+
*/
15+
export function StackIcons({ itemTopics, className }: Props) {
1016
const { stackIcons, projectIcons } = IconsData();
11-
return iconItem === 'deploy' || projectIcons[iconItem as never] ? (
17+
return itemTopics === 'deploy' || projectIcons[itemTopics as never] ? (
1218
<> </>
1319
) : (
14-
<img className={className} alt={stackIcons[iconItem as never]} src={stackIcons[iconItem as never]} />
20+
<img className={className} alt={stackIcons[itemTopics as never]} src={stackIcons[itemTopics as never]} />
1521
);
1622
}

src/components/StackText.tsx

Lines changed: 0 additions & 19 deletions
This file was deleted.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import React from 'react';
2+
3+
import { IconsData } from '../../hooks/useGithubAutomatedRepos';
4+
import { css } from './styles.js';
5+
6+
type Props = {
7+
itemTopics: string;
8+
className?: string;
9+
};
10+
11+
/**
12+
* @param {string} itemTopics - Mandatory: ex.: item.topics.map(itemTopics)... iconText={itemTopics}
13+
* @param {string} className - Optional: style className.
14+
* @returns {<p/>} - Return tag p, stack text.
15+
*/
16+
export function StackText({ itemTopics, className = 'styleStackText' }: Props) {
17+
const { projectIcons, stackIcons } = IconsData();
18+
19+
if (projectIcons[itemTopics as never]) {
20+
return <> </>;
21+
}
22+
if (stackIcons[itemTopics as never]) {
23+
return (
24+
<>
25+
<style>{css}</style>
26+
<p className={className}>{itemTopics}</p>
27+
</>
28+
);
29+
}
30+
}

src/components/StackText/styles.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export const css = `
2+
.styleStackText {
3+
font-weight: 500;
4+
color: white;
5+
width: 85px;
6+
padding: 1px;
7+
border-radius: 10px;
8+
background-color: #646cff;
9+
}`;

src/components/styles/StackText.css

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/hooks/useGithubAutomatedRepos.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ export interface IGithubRepos {
2929

3030
/**
3131
* @param {string} usernameGitHub - Insert your username GitHub Ex.: https://github.com/USERNAME
32-
* @param {string} keyWordDeploy - Insert a keyword chosen by you. - This key is responsible for managing your projects on GitHub.
32+
* @param {string} keyWordDeploy - Insert a keyword chosen by you. - This key is responsible for managing your projects on GitHub in topics field Ex.: https://github.com/DIGOARTHUR/github-automated-repos#--about-library-.
33+
* @returns {(IGithubRepos[])} - Returns an array with the properties: name, topics, html_url, description, id, homepage.
3334
*/
3435
export function useGithubAutomatedRepos(usernameGitHub: string, keyWordDeploy: string) {
3536
const [repository, setRepository] = useState<IGithubRepos[]>([]);
@@ -66,7 +67,7 @@ export function IconsData() {
6667
blender: 'https://github-production-user-asset-6210df.s3.amazonaws.com/59892368/285182560-49ae39de-ad6b-4b96-be9f-cddb58b2406c.svg',
6768
bootstrap: 'https://user-images.githubusercontent.com/59892368/218274368-89a94705-c5b1-42a6-813d-4aaa2a1334e3.svg',
6869
c: 'https://user-images.githubusercontent.com/59892368/215260535-be3713a8-d075-4c85-88ca-4b3703f9e7b3.svg',
69-
canva: 'https://github-production-user-asset-6210df.s3.amazonaws.com/59892368/285175681-645bdd86-62ef-4254-a0e7-7806d4566192.svg',
70+
canva: 'https://github-production-user-asset-6210df.s3.amazonaws.com/59892368/287774022-8ae44b49-fbef-4868-b441-24a37490be36.svg',
7071
clion: 'https://user-images.githubusercontent.com/59892368/216813068-bc05f852-f006-4ff6-85e2-d8988f6afbf9.svg',
7172
cpp: 'https://user-images.githubusercontent.com/59892368/215260533-1ede6b38-7c51-4c89-ac2c-a1195c2b912b.svg',
7273
csharp: 'https://user-images.githubusercontent.com/59892368/215260532-33106206-6ca4-4d11-bdc3-9171491979a5.svg',
@@ -75,7 +76,7 @@ export function IconsData() {
7576
denojs: 'https://github-production-user-asset-6210df.s3.amazonaws.com/59892368/287532091-b11ecf66-5fb2-4158-b48a-99afc85c6a2b.svg',
7677
django: 'https://user-images.githubusercontent.com/59892368/215260529-5fb18a51-b2bc-4092-8a87-f051f89dd30e.svg',
7778
docker: 'https://user-images.githubusercontent.com/59892368/215260528-b50b803d-a037-4572-812b-95801f48c2bd.svg',
78-
dotnetcore: 'https://github-production-user-asset-6210df.s3.amazonaws.com/59892368/285176407-82aa67aa-5724-464a-bb1a-afd76c5d702a.svg',
79+
dotnetcore: 'https://github-production-user-asset-6210df.s3.amazonaws.com/59892368/287774015-b4e62d28-bb35-4eb0-b10a-580db7ea0fed.svg',
7980
eclipse: 'https://user-images.githubusercontent.com/59892368/216813192-3088dc66-c68e-4e06-b7d0-c7443e3230ed.svg',
8081
elixir: 'https://github-production-user-asset-6210df.s3.amazonaws.com/59892368/285177064-e7a06c1c-26a2-4d1c-8bde-59ec2c954d5f.svg',
8182
eslint: 'https://user-images.githubusercontent.com/59892368/215260527-373e10c7-04d3-45c5-98b4-74bf586de7f6.svg',
@@ -92,7 +93,7 @@ export function IconsData() {
9293
googlecloud: 'https://github-production-user-asset-6210df.s3.amazonaws.com/59892368/285177670-cebc6b57-79e3-48df-b896-6d20f19073f0.svg',
9394
graphql: 'https://github-production-user-asset-6210df.s3.amazonaws.com/59892368/279800785-18c9f9d5-f09d-49ab-ab4d-5ca358a967d4.svg',
9495
grunt: 'https://github-production-user-asset-6210df.s3.amazonaws.com/59892368/285177779-acc162d2-85f3-412f-9399-f9573eb83942.svg',
95-
gulpjs: 'https://github-production-user-asset-6210df.s3.amazonaws.com/59892368/285179192-5cacd575-c16c-4cf9-9c1a-bc2b00f70210.svg',
96+
gulpjs: 'https://github-production-user-asset-6210df.s3.amazonaws.com/59892368/287774029-c2eb189c-a8a1-4d02-8824-b185e176242a.svg',
9697
haskell: 'https://github-production-user-asset-6210df.s3.amazonaws.com/59892368/285179295-4b4ca6ff-f290-4bfb-bb93-a6b8f35baee9.svg',
9798
heroku: 'https://github-production-user-asset-6210df.s3.amazonaws.com/59892368/285179420-bd38fb43-1f35-408b-94d1-25de832db6e4.svg',
9899
html5: 'https://github-production-user-asset-6210df.s3.amazonaws.com/59892368/287469126-74b9f4a1-6862-40a4-bd56-311ce688db46.svg',
@@ -106,7 +107,7 @@ export function IconsData() {
106107
jquery: 'https://github-production-user-asset-6210df.s3.amazonaws.com/59892368/285180200-2545ece8-ef19-4b0f-a2e5-b548eb20abd7.svg',
107108
jupyter: 'https://github-production-user-asset-6210df.s3.amazonaws.com/59892368/285180478-c04f5231-ffcc-498b-9f21-8f95ce165263.svg',
108109
kotlin: 'https://user-images.githubusercontent.com/59892368/215260517-8904a569-d2ec-48c4-8adc-660e929db93e.svg',
109-
kubernetes: 'https://github-production-user-asset-6210df.s3.amazonaws.com/59892368/285179579-4ef47737-a0d3-48cc-bcd3-db088eaf2654.svg',
110+
kubernetes: 'https://github-production-user-asset-6210df.s3.amazonaws.com/59892368/287774027-6a7ef271-a387-464b-a622-c92ae83985e3.svg',
110111
laravel: 'https://user-images.githubusercontent.com/59892368/215260515-4f3075d5-ce25-4824-87ff-736ccaf42311.svg',
111112
linux: 'https://user-images.githubusercontent.com/59892368/215260512-04a0d227-c913-4946-9ff4-b3fb691df5ff.svg',
112113
lua: 'https://github-production-user-asset-6210df.s3.amazonaws.com/59892368/285180569-c8f60987-7e27-4c96-aef5-51059342747b.svg',
@@ -151,7 +152,7 @@ export function IconsData() {
151152
visualstudiocode: 'https://user-images.githubusercontent.com/59892368/216786258-69130dda-076f-4811-8ce9-e9d9bb37e603.svg',
152153
vitejs: 'https://user-images.githubusercontent.com/59892368/218274365-3eae86f7-7953-4209-b5e7-466c8335caa2.svg',
153154
vuejs: 'https://user-images.githubusercontent.com/59892368/215260542-defd6142-e8a8-44f5-8c8a-c6dfaf3d114a.svg',
154-
yarn: 'https://github-production-user-asset-6210df.s3.amazonaws.com/59892368/285182397-b0f9ef29-ee7e-4943-aed7-c7c0e5845cae.svg',
155+
yarn: 'https://github-production-user-asset-6210df.s3.amazonaws.com/59892368/287774024-f3af28e4-40c9-4b02-b5e4-c33702c2fca0.svg',
155156
};
156157

157158
// 64px

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
export { ProjectIcons } from './components/ProjectIcons';
22
export { StackIcons } from './components/StackIcons';
3-
export { StackText } from './components/StackText';
3+
export { StackText } from './components/StackText/StackText';
44
export { IGithubRepos, useGithubAutomatedRepos, IconsData } from './hooks/useGithubAutomatedRepos';

0 commit comments

Comments
 (0)