Skip to content

Commit

Permalink
SMA-33: refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
MatejFrnka committed Feb 6, 2024
1 parent 3c6e697 commit a838c3f
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 48 deletions.
4 changes: 4 additions & 0 deletions frontend/sportsmatch-app/src/App.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
body{
font-family: 'Inter', sans-serif;
}

.App {
text-align: center;
}
Expand Down
15 changes: 6 additions & 9 deletions frontend/sportsmatch-app/src/components/Avatar.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@

import '../styles/Avatar.css'

interface AvatarProps {
src: string;
alt: string;
src: string
}

const Avatar: React.FC<AvatarProps> = ({src, alt}) => (
<div className="avatar">
<img src={src} alt={alt} className="avatar-image" />
</div>
);
const Avatar: React.FC<AvatarProps> = ({ src }) => (
<div className="avatar" style={{ backgroundImage: `url(${src}` }}></div>
)

export default Avatar;
export default Avatar
18 changes: 10 additions & 8 deletions frontend/sportsmatch-app/src/components/EventHistoryItem.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {EventHistoryDTO} from '../generated/api'
import { EventHistoryDTO } from '../generated/api'
import '../styles/EventHistoryItem.css'
import Avatar from './Avatar'

interface EventHistoryProps {
eventHistoryDTO: EventHistoryDTO
}

function EventHistoryItem({eventHistoryDTO}: EventHistoryProps) {
function EventHistoryItem({ eventHistoryDTO }: EventHistoryProps) {
return (
<>
<div className="container-sm">
Expand All @@ -15,23 +15,25 @@ function EventHistoryItem({eventHistoryDTO}: EventHistoryProps) {
<div className="user-side">
<div className="user-profile">
<div className="user-avatar">
<Avatar src="" alt="User"/>
<Avatar src="pictures/michael-dam-mEZ3PoFGs_k-unsplash.jpg" />
</div>
<div className="user-name">You</div>
</div>
<div className="user-score">{eventHistoryDTO.userScore}</div>
<div className="user-score score">
<span>{eventHistoryDTO.userScore}</span>
</div>
</div>

<div className="colon">
<p>:</p>
<span>:</span>
</div>
<div className="opponent-side">
<div className="opponent-score">
{eventHistoryDTO.opponentScore}
<div className="opponent-score score">
<span>{eventHistoryDTO.opponentScore}</span>
</div>
<div className="opponent-profile">
<div className="opponent-avatar">
<Avatar src="" alt="Opponent" />
<Avatar src="pictures/jeffrey-keenan-pUhxoSapPFA-unsplash.jpg" />
</div>
<div className="opponent-name">
{eventHistoryDTO.opponent?.name}
Expand Down
9 changes: 9 additions & 0 deletions frontend/sportsmatch-app/src/styles/Avatar.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.avatar {
width: 100%;
height: 100%;
border: 2px solid #FC4C02;
border-radius: 50%;
background-size: cover;
background-position: center center;
object-fit: cover;
}
51 changes: 21 additions & 30 deletions frontend/sportsmatch-app/src/styles/EventHistoryItem.css
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;900&display=swap');




.colon {
display: block;
display: grid;
color: #FC4C02;
font-weight: bold;
font-size: 16px;
text-align: center;
grid-column: 2;
padding: 9px;
padding: 9px 9px 0 9px;
height: 41px;
}

.colon span {
margin: auto;
}

.event-history-item {
Expand All @@ -21,12 +24,11 @@
margin: 16px;
font-size: 10px;
background-color: #F7F7F7;
font-family: 'Inter', sans-serif;
box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.05);
border: 2px solid #FC4C02;
border-radius: 10px;
}

.user-side {
grid-column: 1;
display: grid;
Expand All @@ -53,28 +55,28 @@
grid-column: 2;
}

.user-score {
align-items: center;
display: flex;

.score {
height: 35px;
text-align: right;
color: #FC4C02;
font-weight: bold;
font-size: 16px;
grid-column: 3;
grid-row: 1;
display: grid;
}

.score span {
margin: auto 0;
}

.user-score {
grid-column: 3;
text-align: right;
}

.opponent-score {
align-items: center;
display: flex;
height: 35px;
text-align: left;
color: #FC4C02;
font-weight: bold;
font-size: 16px;
grid-column: 1;
grid-row: 1;
text-align: left;
}

.user-name {
Expand All @@ -92,26 +94,15 @@


.user-avatar {
border: 2px solid #FC4C02;
width: 35px;
height: 35px;
border-radius: 50%;
background-image: url("pictures\jeffrey-keenan-pUhxoSapPFA-unsplash.jpg");
background-size: cover;
background-position: center center;
grid-row: 1;
margin: auto;
}

.opponent-avatar {
border: 2px solid #FC4C02;
width: 35px;
height: 35px;
border-radius: 50%;
background-image: url("pictures\michael-dam-mEZ3PoFGs_k-unsplash.jpg");
background-size: cover;
background-position: center center;
object-fit: cover;
grid-row: 1;
margin: auto;
}
Expand Down
1 change: 0 additions & 1 deletion frontend/sportsmatch-app/src/styles/SportEvent.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
min-height: 106px;
margin: 16px;
font-size: 10px;
font-family: 'Inter', sans-serif;
box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.05);
border-radius: 2px;
}
Expand Down

0 comments on commit a838c3f

Please sign in to comment.