Skip to content

Commit

Permalink
feat: adjust team logo size
Browse files Browse the repository at this point in the history
Also allow the team logo to be sized differently.
  • Loading branch information
smoak committed Nov 8, 2023
1 parent 741ec61 commit 4954c80
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/components/TeamInfo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const TeamInfo = ({
teamRecord,
}: TeamInfoProps) => (
<div className="flex w-1/3 w-16 flex-col items-center text-center">
<TeamLogo teamAbbreviation={teamAbbrev} teamName={teamName} />
<TeamLogo teamAbbreviation={teamAbbrev} teamName={teamName} size="lg" />
<TeamName
isGameInProgress={isGameInProgress}
isGoaliePulled={isGoaliePulled}
Expand Down
21 changes: 19 additions & 2 deletions app/components/TeamLogo/index.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,32 @@
import type { Sizes } from "../sizes";

export type TeamLogoProps = {
readonly teamAbbreviation: string;
readonly teamName: string;
readonly size?: Sizes;
};

type SizeMap = {
[key in Sizes]: string;
};

export const TeamLogo = ({ teamAbbreviation, teamName }: TeamLogoProps) => {
export const TeamLogo = ({
teamAbbreviation,
teamName,
size = "sm",
}: TeamLogoProps) => {
const sizeVariants: SizeMap = {
lg: "h-16 w-16",
md: "h-12 w-12",
sm: "h-8 w-8",
};

return (
<img
alt={`${teamName} logo`}
role="presentation"
src={`https://assets.nhle.com/logos/nhl/svg/${teamAbbreviation}_light.svg`}
className="h-12 w-12"
className={`${sizeVariants[size]}`}
/>
);
};
1 change: 1 addition & 0 deletions app/components/sizes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type Sizes = "sm" | "md" | "lg";
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"test:watch": "TZ=UTC jest --watch --maxWorkers=25%",
"test:ci": "TZ=UTC jest --runInBand",
"typecheck": "tsc -b",
"storybook": "storybook dev -p 6006",
"storybook": "run-p -s 'dev:css' 'storybook:run'",
"storybook:run": "storybook dev -p 6006",
"build-storybook": "storybook build"
},
"dependencies": {
Expand Down

1 comment on commit 4954c80

@vercel
Copy link

@vercel vercel bot commented on 4954c80 Nov 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nhl-remix – ./

nhl-remix.vercel.app
nhl-remix-git-main-smoak.vercel.app
nhl-remix-smoak.vercel.app

Please sign in to comment.