Skip to content

Commit

Permalink
Add logo support in GamePage and GamePicture
Browse files Browse the repository at this point in the history
In GamePage component, add logo variable and pass it to GamePicture component.
In GamePicture component, add logo parameter; add logo element (same as
the CachedImage logo element in GameCard)

There was no need to add CSS, since there was  already CSS for logo in
GamePicture  that positions it at the bottom center.
  • Loading branch information
hashkar123 committed Nov 19, 2023
1 parent f79f9e0 commit 72a8dc8
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 10 deletions.
13 changes: 11 additions & 2 deletions src/frontend/screens/Game/GamePage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ export default React.memo(function GamePage(): JSX.Element | null {
art_square,
art_cover,
art_background,
art_logo: logo = undefined,
install: { platform: installPlatform },
is_installed
} = gameInfo
Expand Down Expand Up @@ -325,7 +326,11 @@ export default React.memo(function GamePage(): JSX.Element | null {
{/* OLD DESIGN */}
{!experimentalFeatures.enableNewDesign && (
<>
<GamePicture art_square={art_square} store={runner} />
<GamePicture
art_square={art_square}
logo={logo}
store={runner}
/>
<NavLink
className="backButton"
to={backRoute}
Expand Down Expand Up @@ -394,7 +399,11 @@ export default React.memo(function GamePage(): JSX.Element | null {
<DotsMenu gameInfo={gameInfo} handleUpdate={handleUpdate} />
{!isBrowserGame && <SettingsButton gameInfo={gameInfo} />}
<div className="mainInfo">
<GamePicture art_square={art_cover} store={runner} />
<GamePicture
art_square={art_cover}
logo={logo}
store={runner}
/>
<div className="store-icon">
<StoreLogos runner={runner} />
</div>
Expand Down
32 changes: 24 additions & 8 deletions src/frontend/screens/Game/GamePicture/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,17 @@ import fallbackImage from 'frontend/assets/heroic_card.jpg'

interface Props extends React.ImgHTMLAttributes<HTMLImageElement> {
art_square: string
logo?: string | undefined
store: string
}

function GamePicture({ art_square, store, className, ...props }: Props) {
function GamePicture({
art_square,
logo = undefined,
store,
className,
...props
}: Props) {
function getImageFormatting() {
if (art_square === 'fallback' || !art_square)
return { src: fallbackImage, fallback: fallbackImage }
Expand All @@ -27,13 +34,22 @@ function GamePicture({ art_square, store, className, ...props }: Props) {

return (
<div className="gamePicture">
<CachedImage
alt="cover-art"
className={`gameImg ${className}`}
src={src}
fallback={fallback}
{...props}
/>
{
<CachedImage
alt="cover-art"
className={`gameImg ${className}`}
src={src}
fallback={fallback}
{...props}
/>
}
{logo && (
<CachedImage
alt="logo"
src={`${logo}?h=400&resize=1&w=300`}
className={`gameLogo`}
/>
)}
</div>
)
}
Expand Down

0 comments on commit 72a8dc8

Please sign in to comment.