-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e16a4d5
commit ab25e4d
Showing
8 changed files
with
162 additions
and
154 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import {useNavigate} from 'react-router-dom'; | ||
import {Fixture} from '../lib/api/fixtures'; | ||
|
||
interface FixtureRowProps { | ||
fixture?: Fixture; | ||
} | ||
|
||
function FixtureRow({fixture}: FixtureRowProps) { | ||
const navigate = useNavigate(); | ||
|
||
if (!fixture) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<> | ||
<button | ||
className="btn btn-secondary d-flex align-items-center border w-100 shadow-sm text-muted mb-2" | ||
key={fixture.id} | ||
onClick={() => navigate(`/fixtures/${fixture.id}`)} | ||
> | ||
<div className="d-flex justify-content-between h-100 w-100"> | ||
<div className="d-flex flex-column"> | ||
<div className="d-flex align-items-center"> | ||
<img | ||
className="me-2" | ||
src={fixture.teams.home.logo} | ||
alt="Home team logo" | ||
style={{maxWidth: '20px'}} | ||
></img> | ||
<div>{fixture.teams.home.name}</div> | ||
</div> | ||
<div className="d-flex align-items-center"> | ||
<img | ||
className="me-2" | ||
src={fixture.teams.away.logo} | ||
alt="Away team logo" | ||
style={{maxWidth: '20px'}} | ||
></img> | ||
<div>{fixture.teams.away.name}</div> | ||
</div> | ||
</div> | ||
<div className="d-flex flex-column align-items-start"> | ||
<div>{new Date(fixture.date).toDateString()}</div> | ||
<div>{new Date(fixture.date).toLocaleTimeString()}</div> | ||
</div> | ||
</div> | ||
</button> | ||
</> | ||
); | ||
} | ||
|
||
export default FixtureRow; |
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
Oops, something went wrong.