-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* timelinePage_edit * media-query * timeline_feedback_edit
- Loading branch information
1 parent
cc9383a
commit f03ebee
Showing
4 changed files
with
163 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,47 @@ | ||
import React from 'react'; | ||
import jsonData from '../Data/memberData23_24.json'; | ||
import style from '../components/Style/timeline.module.css'; // 스타일 모듈 불러오기 | ||
import React, { useState, useEffect } from 'react'; | ||
import style from "../components/Style/timeline.module.css"; | ||
|
||
const TimelineItem = ({ name, githubLink }) => ( | ||
<div className={style['timeline__Data']}> | ||
<div className={style['timeline__Individual']}> • | ||
<span className={style['nameData']}>{name}</span>님은{' '} | ||
<span className={style['repositoryData']}> | ||
<a href={githubLink} target="_blank" rel="noopener noreferrer"> | ||
repository | ||
</a> | ||
</span> | ||
를 작업 중입니다. | ||
</div> | ||
</div> | ||
); | ||
function TimelinePage() { | ||
const [recentCommits, setRecentCommits] = useState([]); | ||
|
||
const Timeline = ({ data }) => ( | ||
<div> | ||
<div className={style['timeline']}>TimeLines</div> | ||
{data.map((userData, index) => ( | ||
<TimelineItem key={index} name={userData.Name} githubLink={userData.GitHubLink} /> | ||
))} | ||
</div> | ||
); | ||
useEffect(() => { | ||
fetch('https://raw.githubusercontent.com/Google-DSC-Kookmin/Google-DSC-Kookmin.github.io/master/data/data.json') | ||
.then(response => response.json()) | ||
.then(data => { | ||
const uniqueUsers = {}; | ||
const recentCommitsData = []; | ||
|
||
const TimelinePage = () => { | ||
return ( | ||
<div> | ||
<Timeline data={jsonData} /> | ||
</div> | ||
); | ||
}; | ||
// 각 사용자의 최신 커밋 데이터를 추출하고 날짜를 형식화하여 저장 | ||
data.forEach(userCommits => { | ||
userCommits.forEach(commit => { | ||
if (!uniqueUsers[commit.userName] && recentCommitsData.length < 10) { | ||
uniqueUsers[commit.userName] = true; | ||
const formattedDate = new Date(commit.commitTime).toISOString().split('T')[0]; | ||
const repositoryName = commit.commitLink.split("/repos/")[1].split("/commits")[0]; | ||
const repositoryUrl = `https://github.com/${repositoryName}`; | ||
recentCommitsData.push({ ...commit, commitTime: formattedDate, repositoryUrl }); | ||
} | ||
}); | ||
}); | ||
|
||
setRecentCommits(recentCommitsData); | ||
}) | ||
.catch(error => console.error('Error fetching data:', error)); | ||
}, []); | ||
|
||
return ( | ||
<div> | ||
<div className={style.timeline}>Timelines</div> | ||
<ul> | ||
{recentCommits.map((commit, index) => ( | ||
<li className={style.commit_list} key={index}> | ||
<p className={style.commit_time}>{commit.commitTime}</p> | ||
<p className={style.commit}>🔥{commit.userName}님은 <a className={style.commit_link} href={commit.repositoryUrl} target="_blank" rel="noopener noreferrer">Repository</a>를 작업중입니다. </p> | ||
</li> | ||
))} | ||
</ul> | ||
</div> | ||
); | ||
} | ||
|
||
export default TimelinePage; |