Skip to content

Commit

Permalink
最低限のデザイン(?)はしました CSS初心者です ランキング機能の作成 #26
Browse files Browse the repository at this point in the history
  • Loading branch information
K-Yoshizawa authored and shun-shobon committed Nov 6, 2024
1 parent 93403dc commit b5d17ce
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 5 deletions.
59 changes: 56 additions & 3 deletions app/Ranking.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,63 @@
justify-content: space-between;
align-items: center;
padding: 10px;
margin: 5px 0;
margin: 15px auto;
width: 800px;
border-radius: 10px;
background-color: #525252;
background-color: #797878;
font-size: 24px;
border: 2px solid #333;
box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.2);
box-shadow: 3px 3px 5px rgba(0, 0, 0, 1);
text-shadow: 2px 2px 4px rgba(0, 0, 0, 1);
}

.ranking-title{
display: flex;
justify-content: center;
align-items: center;
margin: 5px auto;
width: 800px;
font-size: 36px;
text-shadow: 2px 2px 4px rgba(0, 0, 0, 1);
}

.rank-first{
color: #ffd700;
}

.rank-second{
color: #c0c0c0;
}

.rank-third{
color: #cd7f32;
}

.rank-default{

}

.name{
position: absolute;
left: 50%;
transform: translateX(-50%);
}

.score{

}

.ranking-load-button{
display: flex;
justify-content: center;
align-items: center;
padding: 5px;
margin: 15px auto;
width: 400px;
border-radius: 10px;
background-color: #797878;
font-size: 18px;
border: 2px solid #333;
box-shadow: 3px 3px 5px rgba(0, 0, 0, 1);
text-shadow: 2px 2px 4px rgba(0, 0, 0, 1);
}
12 changes: 10 additions & 2 deletions app/components/Ranking.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,16 @@ interface RankingData{
}

export function RankingItem({ rank, name, score }: RankingData){
const getRankClass = () => {
if (rank === 1) return 'rank-first';
if (rank === 2) return 'rank-second';
if (rank === 3) return 'rank-third';
return 'rank-default';
};

return (
<div className='ranking-item'>
<span className='rank'>{rank}</span>
<span className={`${getRankClass()}`}>{rank}</span>
<span className='name'>{name}</span>
<span className='score'>{score}</span>
</div>
Expand All @@ -30,6 +37,7 @@ export function RankingList(){

return (
<div className='ranking-list'>
<div className='ranking-title'>ランキング</div>
{ranking.map((item, index) => (
<RankingItem
key={item.user_id}
Expand All @@ -41,7 +49,7 @@ export function RankingList(){
{loading ? (
<p>Loading...</p>
) : (
<button onClick={loadMore}>Show More</button>
<button className='ranking-load-button' onClick={loadMore}>Show More</button>
)}
</div>
);
Expand Down

0 comments on commit b5d17ce

Please sign in to comment.