-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#2713 started division info comopnent
- Loading branch information
1 parent
7d57ae7
commit 87b2b1d
Showing
6 changed files
with
88 additions
and
22 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
36 changes: 36 additions & 0 deletions
36
src/frontend/src/pages/HomePage/components/TeamTypeSection.tsx
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,36 @@ | ||
import { Box, Grid, Typography } from '@mui/material'; | ||
import { TeamType } from 'shared'; | ||
import { getImageUrl } from '../../../utils/image.utils'; | ||
import { useState, useEffect } from 'react'; | ||
|
||
interface TeamTypeSectionProps { | ||
teamType: TeamType; | ||
} | ||
|
||
const TeamTypeSection = ({ teamType }: TeamTypeSectionProps) => { | ||
const [imageUrl, setImageUrl] = useState<string>(''); | ||
|
||
useEffect(() => { | ||
const fetchImageUrl = async () => { | ||
if (teamType.imageFileId) { | ||
const url = await getImageUrl(teamType.imageFileId); | ||
setImageUrl(url); | ||
} | ||
}; | ||
|
||
fetchImageUrl(); | ||
}, [teamType.imageFileId]); | ||
|
||
return ( | ||
<Grid container spacing={5}> | ||
<Grid item xs={4}> | ||
<Box component="img" src={imageUrl} alt="Image Preview" sx={{ maxWidth: '400px', mt: 1, mb: 1 }} /> | ||
</Grid> | ||
<Grid item xs={8}> | ||
<Typography>{teamType.description}</Typography> | ||
</Grid> | ||
</Grid> | ||
); | ||
}; | ||
|
||
export default TeamTypeSection; |
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,6 @@ | ||
import { downloadGoogleImage } from '../apis/finance.api'; | ||
|
||
export const getImageUrl = async (imageFileId: string) => { | ||
const imageBlob = await downloadGoogleImage(imageFileId); | ||
return URL.createObjectURL(imageBlob); | ||
}; |