Skip to content

Commit

Permalink
Merge pull request #362 from Alt-Org/madina/feature/302-create-a-cust…
Browse files Browse the repository at this point in the history
…om-component-to-display-basic-information-about-a-clan

Madina/feature/302 create a custom component to display basic information about a clan
  • Loading branch information
Jonroi authored Jan 23, 2025
2 parents ee0adae + f316a10 commit 8e49623
Show file tree
Hide file tree
Showing 3 changed files with 189 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@

.clanInfo {
padding: 1rem;
margin-top: 20px;
background-color: #1a1a1a;
border-radius: 0.75rem;
width: 18rem;
transition: transform 0.2s ease;

&:hover {
transform: scale(1.02);
cursor: pointer;
}

}


.points {
display: flex;
p {
margin-top: 30px;
font-weight: 600;
}
}
.crown {
color: #fbbf24;
font-size: 3rem;
}

.labels {
display: grid;
grid-template-columns: 60px 60px;



}
.titleContainer {
display: flex;
justify-content: center;
align-items: center;

}

.title {
text-align: center;
max-width: 100%;
overflow: hidden;
text-overflow: ellipsis;

}
.header {
display: grid;
grid-template-columns: auto 1fr;
align-items: center;
gap: 2rem;
}
.footer {
display: flex;
justify-content: space-between;
align-items: center;
border-top: 1px solid #e5e7eb;
background-color: rgb(239, 233, 233);
color: black;
margin-top: 1rem;
border-radius: 0.70rem;
height: 60px;
}

.members {
color: black;
font-size: 0.975rem;
font-weight: bold;
margin-left: 30px;
font-family: Arial, Helvetica, sans-serif;
}


.play{
margin-left: 10px;
}
.label{
width: 50px;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
'use client';
import Image from 'next/image';
import clanLogo from '@/shared/assets/images/clanLogos/temp-clanlogo.png';
import label from '@/shared/assets/images/labels.svg';
import cls from './ClanInfoTile.module.scss';
import { useRouter } from 'next/navigation';

interface ClanInfoTileProps {
id: string;
name: string;
ageRange: string;
playerCount: number;
points: number;
labels: string[];
logo: string;
}

/**
* ClanInfoTile component displays information about a clan and navigates to the clan's page when clicked.
*
* @param {Object} props - The properties object.
* @param {string} props.id - The unique identifier of the clan.
* @param {string} props.name - The name of the clan.
* @param {string} props.ageRange - The age range of the clan members.
* @param {number} props.playerCount - The number of players in the clan.
* @param {number} props.points - The points scored by the clan.
* @param {string[]} props.labels - The labels associated with the clan.
* @param {string} props.logo - The logo of the clan.
* @returns {JSX.Element} The ClanInfoTile component.
*/
const ClanInfoTile = ({
id,
name,
ageRange,
playerCount,
points,
labels,
logo,
}: ClanInfoTileProps) => {
const router = useRouter();
const handleClanClick = () => {
router.push(`/clans/${id}`);
};
return (
<div
className={cls.clanInfo}
onClick={handleClanClick}
role="button"
>
<div className={cls.titleContainer}>
<h1 className={cls.title}>{name}</h1>
</div>
<div className={cls.header}>
<Image
src={logo || clanLogo}
alt={'clan logo'}
className={cls.logo}
/>
<div className={cls.labels}>
<div>
<Image
src={label}
alt={'labels'}
className={cls.label}
/>
</div>
<div>
<Image
src={label}
alt={'labels'}
className={cls.label}
/>
</div>
<div>
<Image
src={label}
alt={'labels'}
className={cls.label}
/>
</div>
<div>
<Image
src={label}
alt={'labels'}
className={cls.label}
/>
</div>
</div>
</div>
<div className={cls.footer}>
<div className={cls.members}>
Members
<div className={cls.play}>{playerCount} /10</div>
</div>

<div className={cls.points}>
<p>{points}</p>
<span className={cls.crown}></span>
</div>
</div>
</div>
);
};

export default ClanInfoTile;
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 8e49623

Please sign in to comment.