1502shivam-singh commented on a change in pull request #758:
URL: https://github.com/apache/apisix-website/pull/758#discussion_r753676013



##########
File path: website/src/pages/contribute/ContributeCard.js
##########
@@ -0,0 +1,119 @@
+import React, { useState, useEffect } from "react";
+import styled from "styled-components";
+import IconComment from "../../assets/icons/comment.svg";
+
+const Card = styled.div`
+    @media (max-width: 700px) {
+        width: 100%;
+    }
+    width: 80%;
+    border: 1px solid rgb(232, 67, 62);
+    border-radius: 5px;
+    margin-bottom: 1rem;
+    padding: 0.75rem 1.25rem;
+
+    &:hover {
+        background-color: rgb(255,241,240,0.2);
+        cursor: pointer;
+        p{
+            color: rgb(232, 67, 62);
+        }
+    }
+    background-color: ${(props) => (props.isShow ? "rgb(255,241,240,0.2)" : 
"")}
+`;
+
+const ProjectTitle = styled.div`
+    display:flex;
+    justify-content: space-between;
+    align-items: center;
+    margin-left: 1.25 rem;
+    margin-right: 1.25 rem;
+`;
+const Title = styled.p`
+  margin: 0;
+  font-size: 1.5rem;
+  color: ${(props) => (props.isShow ? "rgb(232, 67, 62)" : "")}
+`;
+
+const Issue = styled.div`
+    @media (max-width: 700px) {
+        min-width: 5rem;
+    }
+    border: 1px solid rgb(232, 67, 62);
+    border-radius: 0.5rem;
+    padding: 0.25rem 0.5rem;
+    font-size: .875rem;
+`;
+
+const ProjectDesc = styled.div`
+    display: flex;
+    color: ${(props) => (props.isShow ? "rgb(232, 67, 62)" : "")}
+`;
+const List = styled.div`
+    display: ${(props) => (props.isShow ? "block" : "none")};
+`;
+const ListItem = styled.li`
+    list-style: none;
+    display: flex;
+`;
+
+
+const ContributeCard = (props) => {
+    const { repoName } = props;
+    const [isShow, setisShow] = useState(false);
+    const [repoInfo, setRepoInfo] = useState({ description: '', lang: '', 
stars: '' });
+    const [issues, setIssues] = useState([]);
+
+    useEffect(() => {
+        getGitHubIssuesInfo(repoName).then((result) => {
+            setIssues(result);
+        });
+        getGitHubRepoInfo(repoName).then((result) => {
+            setRepoInfo({ description: result.description, lang: 
result.language, stars: result.stargazers_count })
+        })
+    }, []);
+    return (
+        <Card onClick={() => setisShow(!isShow)} isShow={isShow}>
+            <ProjectTitle>
+                <Title isShow={isShow}>{repoName}</Title>
+                <Issue isShow={isShow}>{issues.length} issues</Issue>
+            </ProjectTitle>
+            <div>{repoInfo.description}</div>
+            <ProjectDesc isShow={isShow}>
+                <div style={{ marginRight: '1rem' }}>lang: 
{repoInfo.lang}</div>
+                <div style={{ marginRight: '1rem' }}>stars: 
{repoInfo.stars}</div>
+            </ProjectDesc>
+            <List isShow={isShow}>
+                <ul style={{ paddingLeft: 0 }}>
+                    {issues.map(item => (
+                        <ListItem key={item.number}>
+                            <div style={{ minWidth: '4rem' 
}}>#{item.number}</div>
+                            <a target="_blank" href={item.html_url} style={{ 
flex: '1 1 auto', textDecoration: 'none',overflow: 'hidden' }}>{item.title} </a>
+                            {item.comments > 0 ? <div style={{display: "flex", 
justifyContent: 'center',alignItems: 'center'}}><IconComment></IconComment><div 
style={{marginLeft:'0.25rem', fontSize:'0.5rem', 
color:'#333'}}>{item.comments}</div></div> : ''}
+                        </ListItem>
+                    ))}
+                </ul></List>
+        </Card>
+    );
+};
+
+const getGitHubIssuesInfo = (repo) => {
+    return 
fetch(`https://api.github.com/repos/${repo}/issues?state=open&labels=good%20first%20issue`,
 {
+        headers: {
+            "content-type": "application/json",
+            Accept: "application / vnd.github.v3 + json",
+        },
+    }).then((response) => response.json()
+    );
+};
+
+const getGitHubRepoInfo = (repo) => {
+    return fetch(`https://api.github.com/repos/${repo}`, {
+        headers: {
+            "content-type": "application/json",
+            Accept: "application / vnd.github.v3 + json",
+        },
+    }).then((response) => response.json());
+};
+
+export default ContributeCard;

Review comment:
       Insert newline at end

##########
File path: website/src/pages/contribute/index.js
##########
@@ -0,0 +1,46 @@
+import React from "react";
+import styled from "styled-components";
+import Layout from "@theme/Layout";
+import ContributeCard from "./ContributeCard";
+
+const Page = styled.div`
+  max-width: var(--ifm-container-width);
+  margin: 0 auto;
+  padding: 2rem var(--ifm-spacing-horizontal);
+  width: 100%;
+`;
+
+const PageTitle = styled.h1`
+  margin-top: 2rem;
+  font-size: 3rem;
+  font-weight: 800;
+`;
+
+const PageTitleSpecial = styled.span`
+  color:rgb(232, 67, 62);
+`;
+
+const PageDesc = styled.div`
+  margin: 1.25rem auto;
+`;
+
+const Contribute = () => {
+  const repoList = [{ repoName: 'apache/apisix' }, { repoName: 
'apache/apisix-dashboard' }, { repoName: 'apache/apisix-website' }, { repoName: 
'apache/apisix-ingress-controller' }]
+
+  const repos = repoList.map((repo) => {
+    return <ContributeCard key={repo.repoName} {...repo} />;
+  });
+
+  return (
+    <Layout>
+      <Page>
+        <PageTitle>good <PageTitleSpecial>first</PageTitleSpecial> 
issue</PageTitle>
+        <PageDesc>Help new partners to Apache APISIX Community and make first 
contribution.</PageDesc>
+        {repos}
+      </Page>
+    </Layout>
+
+  );
+};
+
+export default Contribute;

Review comment:
       Same, insert newline at end
   

##########
File path: website/src/pages/contribute/ContributeCard.js
##########
@@ -0,0 +1,119 @@
+import React, { useState, useEffect } from "react";
+import styled from "styled-components";
+import IconComment from "../../assets/icons/comment.svg";
+
+const Card = styled.div`
+    @media (max-width: 700px) {
+        width: 100%;
+    }
+    width: 80%;
+    border: 1px solid rgb(232, 67, 62);
+    border-radius: 5px;
+    margin-bottom: 1rem;
+    padding: 0.75rem 1.25rem;
+
+    &:hover {
+        background-color: rgb(255,241,240,0.2);
+        cursor: pointer;
+        p{
+            color: rgb(232, 67, 62);
+        }
+    }
+    background-color: ${(props) => (props.isShow ? "rgb(255,241,240,0.2)" : 
"")}
+`;
+
+const ProjectTitle = styled.div`
+    display:flex;
+    justify-content: space-between;
+    align-items: center;
+    margin-left: 1.25 rem;
+    margin-right: 1.25 rem;
+`;
+const Title = styled.p`
+  margin: 0;
+  font-size: 1.5rem;
+  color: ${(props) => (props.isShow ? "rgb(232, 67, 62)" : "")}
+`;
+
+const Issue = styled.div`
+    @media (max-width: 700px) {
+        min-width: 5rem;
+    }
+    border: 1px solid rgb(232, 67, 62);
+    border-radius: 0.5rem;
+    padding: 0.25rem 0.5rem;
+    font-size: .875rem;
+`;
+
+const ProjectDesc = styled.div`
+    display: flex;
+    color: ${(props) => (props.isShow ? "rgb(232, 67, 62)" : "")}
+`;
+const List = styled.div`
+    display: ${(props) => (props.isShow ? "block" : "none")};
+`;
+const ListItem = styled.li`
+    list-style: none;
+    display: flex;
+`;
+
+
+const ContributeCard = (props) => {
+    const { repoName } = props;
+    const [isShow, setisShow] = useState(false);
+    const [repoInfo, setRepoInfo] = useState({ description: '', lang: '', 
stars: '' });

Review comment:
       I feel adding the `lang` attribute here isn't necessary because we can't 
keep the most used language in a project as a representative of it. What I mean 
is, one can contribute in the `apisix-dashboard` project even if they are not 
familiar with Golang, putting the `lang` attribute upfront feels like it is a 
prerequisite to contribute in that project.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to