Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added width and height to images #2412

Merged
merged 2 commits into from
Oct 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/components-v2/TokenLogo/TokenLogo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,16 @@ const TokenLogo = ({ token, ...imageProps }: Props): JSX.Element => {
currentTarget.src = '/assets/icons/token-logo-fallback.svg';
currentTarget.onerror = null;
};
return <img {...imageProps} src={getTokenIconPath(token)} onError={handleError} alt={`${token.symbol} logo`} />;
return (
<img
width="32"
height="32"
{...imageProps}
src={getTokenIconPath(token)}
onError={handleError}
alt={`${token.symbol} logo`}
/>
);
};

export default TokenLogo;
2 changes: 1 addition & 1 deletion src/components-v2/VaultApyInformation/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ const VaultApyInformation = ({
<Box display="flex" justifyContent="flex-end" alignItems="center">
{isNewVault && (
<>
<img width="12" src="assets/icons/new-vault.svg" alt="New Vault" />
<img width="12" height="12" src="assets/icons/new-vault.svg" alt="New Vault" />
<Typography component="span">New Vault</Typography>
</>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const useStyles = makeStyles((theme: Theme) => ({
},
video: {
display: 'flex',
background: '#CCCCCC',
background: '#121212',
width: '100%',
height: 320,
},
Expand Down
2 changes: 2 additions & 0 deletions src/components-v2/common/NetworkGasWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ const NetworkGasWidget = (): JSX.Element => {
className={classes.selectedNetworkIcon}
src={getNetworkIconPath(networkStore.network)}
alt="selected network icon"
width="17"
height="17"
/>
</Button>
<Popper
Expand Down
2 changes: 1 addition & 1 deletion src/components-v2/common/WalletTokenBalance.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const WalletTokenBalance = ({ balance }: Props): JSX.Element => {
<Grid container className={classes.tokenBalance}>
<Grid item container justifyContent="space-between" alignItems="center">
<div className={classes.tokenNameAndIcon}>
<TokenLogo className={classes.icon} token={token} />
<TokenLogo className={classes.icon} token={token} width="25" height="25" />
<Typography variant="body1" display="inline" className={classes.tokenName}>
{balance.token.symbol}
</Typography>
Expand Down
1 change: 1 addition & 0 deletions src/components-v2/common/dialogs/VaultDeposit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ const useStyles = makeStyles((theme) => ({
height: '100%',
'& img': {
maxWidth: 24,
maxHeight: 24,
},
'& .token-name': {
paddingLeft: 5,
Expand Down
1 change: 1 addition & 0 deletions src/components-v2/common/dialogs/VaultWithdraw.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ const useStyles = makeStyles((theme) => ({
height: '100%',
'& img': {
maxWidth: 24,
maxHeight: 24,
},
'& .token-name': {
paddingLeft: 5,
Expand Down
9 changes: 5 additions & 4 deletions src/components-v2/landing/VaultItemApr.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const useStyles = makeStyles((theme: Theme) => ({
},
aprDisplay: {
justifyContent: 'flex-end',
alignItems: 'center',
[theme.breakpoints.down('sm')]: {
justifyContent: 'flex-start',
},
Expand Down Expand Up @@ -106,7 +107,7 @@ const VaultItemApr = ({ vault }: Props): JSX.Element => {
const isNewVault = vault.state === VaultState.Experimental || vault.state === VaultState.Guarded;
const aprDisplay = isNewVault ? (
<>
<img src={'assets/icons/new-vault.svg'} alt="New Vault" /> New Vault
<img src={'assets/icons/new-vault.svg'} alt="New Vault" width="12" height="12" /> New Vault
</>
) : !useHistoricAPY ? (
`${numberWithCommas(projectedVaultBoost.toFixed(2))}%`
Expand All @@ -126,13 +127,13 @@ const VaultItemApr = ({ vault }: Props): JSX.Element => {
<Typography variant={isNewVault ? 'subtitle1' : 'body1'} color={'textPrimary'} display="inline">
{aprDisplay}
</Typography>
<img src="/assets/icons/apy-info.svg" className={classes.apyInfo} alt="apy info icon" />
<img src="/assets/icons/apy-info.svg" className={classes.apyInfo} alt="apy info icon" width="12" height="24" />
</Box>
{yieldSourcesAprTotal > 0 && (
<Box className={classes.yieldBearingRewards}>
<Link color="primary" onClick={handleYieldBearingRewardsClick}>
<img width="9" src="assets/icons/yield-bearing-rewards.svg" alt="Yield-Bearing Rewards" /> Yield-Bearing
Rewards:
<img width="9" height="15" src="assets/icons/yield-bearing-rewards.svg" alt="Yield-Bearing Rewards" />{' '}
Yield-Bearing Rewards:
</Link>
<Typography onClick={handleApyInfoClick} variant="inherit">
Rewards earn up to {yieldSourcesAprTotal.toFixed(2)}%
Expand Down
3 changes: 3 additions & 0 deletions src/components-v2/landing/VaultListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ const useStyles = makeStyles((theme) => ({
padding: 2,
},
},
'& img': {
width: 'fit-content',
},
},
vaultName: {
fontSize: 16,
Expand Down
7 changes: 6 additions & 1 deletion src/components-v2/landing/VaultListItemMobile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ const useStyles = makeStyles(() => ({
name: {
marginLeft: 8,
},
logoContainer: {
'& img': {
width: 'fit-content',
},
},
}));

interface Props {
Expand Down Expand Up @@ -48,7 +53,7 @@ const VaultListItemMobile = ({ vault }: Props): JSX.Element => {

return (
<Grid container direction="column" component={Card} onClick={goToVaultDetail} className={classes.root}>
<Grid item container>
<Grid item container className={classes.logoContainer}>
<VaultLogo tokens={vault.tokens} />
<Typography variant="subtitle1" display="inline" className={classes.name}>
{vault.name}
Expand Down
2 changes: 1 addition & 1 deletion src/components-v2/navbar/NavbarMobileRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const NavbarMobileRow = observer((): JSX.Element => {
<Grid container justifyContent="space-between">
<Grid item xs container alignItems="center">
<IconButton className={classes.menuIcon} onClick={() => uiState.openSidebar()}>
<img src="/assets/icons/mobile-drawer-icon.svg" alt="open menu" />
<img src="/assets/icons/mobile-drawer-icon.svg" alt="open menu" width="22" height="19" />
</IconButton>
<img className={classes.badgerIcon} alt="Badger Logo" src="/assets/icons/badger_head.svg" />
</Grid>
Expand Down
9 changes: 8 additions & 1 deletion src/components-v2/vault-detail/specs/VaultMetrics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ const useStyles = makeStyles((theme) => ({
},
aprDisplay: {
justifyContent: 'flex-end',
alignItems: 'center',
[theme.breakpoints.down('sm')]: {
justifyContent: 'flex-start',
},
Expand Down Expand Up @@ -111,7 +112,13 @@ const VaultMetrics = observer(({ vault }: Props): JSX.Element => {
<Typography variant={'body1'} color={'textPrimary'} display="inline">
{aprDisplay}
</Typography>
<img src="/assets/icons/apy-info.svg" className={classes.apyInfo} alt="apy info icon" />
<img
src="/assets/icons/apy-info.svg"
className={classes.apyInfo}
alt="apy info icon"
width="12"
height="24"
/>
</Box>
</Grid>
</Grid>
Expand Down
8 changes: 6 additions & 2 deletions src/components/Boost/BadgerBoostImage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,18 @@ const useStyles = (signatureColor: string) => {

interface Props extends BoxProps {
signatureColor: string;
imageProps: {
width: string;
height: string;
};
}

export const BadgerBoostImage = ({ signatureColor, className, ...boxProps }: Props): JSX.Element => {
export const BadgerBoostImage = ({ signatureColor, className, imageProps, ...boxProps }: Props): JSX.Element => {
const classes = useStyles(signatureColor)();

return (
<div className={clsx(className, classes.container)} {...boxProps}>
<img alt="Badger Logo" src={'assets/badger-transparent.png'} className={classes.boostImage} />
<img alt="Badger Logo" src={'assets/badger-transparent.png'} className={classes.boostImage} {...imageProps} />
</div>
);
};
16 changes: 14 additions & 2 deletions src/components/Boost/HoldingAssetInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,24 @@ export const HoldingAssetInput = ({
...InputProps,
startAdornment: (
<Button className={buttonClasses.actionButton} onClick={onReduction}>
<img className={buttonClasses.actionImage} src="/assets/icons/boost-down.svg" alt={decreaseAlt} />
<img
width="12"
height="7"
className={buttonClasses.actionImage}
src="/assets/icons/boost-down.svg"
alt={decreaseAlt}
/>
</Button>
),
endAdornment: (
<Button className={buttonClasses.actionButton} onClick={onIncrement}>
<img className={buttonClasses.actionImage} src="/assets/icons/boost-up.svg" alt={increaseAlt} />
<img
width="12"
height="7"
className={buttonClasses.actionImage}
src="/assets/icons/boost-up.svg"
alt={increaseAlt}
/>
</Button>
),
classes: inputClasses,
Expand Down
1 change: 1 addition & 0 deletions src/components/Boost/RankLevel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export const RankLevel = ({ name, signatureColor, obtained = false, hasBeenReach
<BadgerBoostImage
className={clsx(classes.softBorder, obtained && classes.obtained)}
signatureColor={signatureColor}
imageProps={{ width: '28', height: '31.4' }}
/>
</div>
<div className={classes.badgerLevelInfoContainer}>
Expand Down
13 changes: 11 additions & 2 deletions src/components/Boost/ScoreAnimation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const useStyles = makeStyles((theme) => ({
},
boostImage: {
width: '60%',
height: 'auto',
},
boostEye: {
width: '30px',
Expand Down Expand Up @@ -97,11 +98,19 @@ const useAnimatedStyles = (stakeRatio: number) => {
export const BoostBadgerAnimation = ({ stakeRatio }: BoostBadgeProps): JSX.Element => {
const classes = useStyles();
const animatedClasses = useAnimatedStyles(stakeRatio)();
const eyesImage = <img src={'assets/badger-eyes.png'} alt="Badger Eyes" className={classes.boostEyeStar} />;
const eyesImage = (
<img width="6" height="6" src={'assets/badger-eyes.png'} alt="Badger Eyes" className={classes.boostEyeStar} />
);
return (
<Box className={[classes.root, animatedClasses.container].join(' ')}>
<div className={[classes.boostEye, classes.boostLeft, animatedClasses.eyes].join(' ')}>{eyesImage}</div>
<img alt="Badger Logo" src={'assets/badger-transparent.png'} className={classes.boostImage} />
<img
alt="Badger Logo"
src={'assets/badger-transparent.png'}
className={classes.boostImage}
width="144"
height="161"
/>
<div className={[classes.boostEye, classes.boostRight, animatedClasses.eyes].join(' ')}>{eyesImage}</div>
</Box>
);
Expand Down
5 changes: 4 additions & 1 deletion src/components/Boost/StakeInformationHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@ export const StakeInformationHeader = ({
<Grid container>
<Grid container alignItems="center">
<div className={classes.currentLevelImgContainer}>
<BadgerBoostImage signatureColor={currentRank.signatureColor} />
<BadgerBoostImage
signatureColor={currentRank.signatureColor}
imageProps={{ width: '16.6', height: '18.8' }}
/>
</div>
<Typography display="inline" className={classes.rankName}>
{currentRank.name}
Expand Down
2 changes: 1 addition & 1 deletion src/components/IbBTC/OptionToken.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const OptionToken = ({ token }: TokenProps): JSX.Element => {
const classes = useStyles();
return (
<div className={classes.tokenContainer} aria-label={symbol}>
<TokenLogo token={token} className={classes.tokenIcon} />
<TokenLogo token={token} className={classes.tokenIcon} width="24" height="24" />
<Typography variant="body1" component="div">
{symbol}
</Typography>
Expand Down
Loading