Skip to content

Commit

Permalink
Improve responsivness of desktop gallery
Browse files Browse the repository at this point in the history
  • Loading branch information
buberdds committed Dec 11, 2023
1 parent 02fd8f8 commit 6efb046
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 12 deletions.
1 change: 1 addition & 0 deletions src/app/components/NoPreview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const NoPreview: FC<NoPreviewProps> = ({ placeholderSize }) => {
height: placeholderSize,
width: placeholderSize,
display: 'flex',
flex: 1,
justifyContent: 'center',
flexDirection: 'column',
alignItems: 'center',
Expand Down
14 changes: 7 additions & 7 deletions src/app/pages/TokenDashboardPage/ImageListItemImage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ import { useScreenSize } from 'app/hooks/useScreensize'
import { COLORS } from 'styles/theme/colors'

const minMobileSize = '150px'
const mobileSize = '100%'
const imageSize = '210px'
const minSize = '210px'

const StyledImage = styled('img', {
shouldForwardProp: prop => prop !== 'isMobile',
})<{ isMobile: boolean }>(({ isMobile }) => ({
minWidth: isMobile ? minMobileSize : imageSize,
minHeight: isMobile ? minMobileSize : imageSize,
width: isMobile ? mobileSize : imageSize,
height: isMobile ? mobileSize : imageSize,
minWidth: isMobile ? minMobileSize : minSize,
minHeight: isMobile ? minMobileSize : minSize,
width: '100%',
height: '100%',
maxHeight: minSize,
objectFit: 'cover',
transition: 'opacity 250ms ease-in-out',
'&:hover, &:focus-visible': {
Expand Down Expand Up @@ -68,7 +68,7 @@ export const ImageListItemImage: FC<ImageListItemImageProps> = ({ instance, to }
isMobile={isMobile}
/>
) : (
<NoPreview placeholderSize={imageSize} />
<NoPreview placeholderSize={isMobile ? minMobileSize : minSize} />
)}
<StyledBox gap={3}>
<OpenInBrowserIcon sx={{ fontSize: '40px' }} />
Expand Down
15 changes: 11 additions & 4 deletions src/app/pages/TokenDashboardPage/NFTLinks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Link as RouterLink } from 'react-router-dom'
import { EvmNft } from 'oasis-nexus/api'
import Link from '@mui/material/Link'
import Typography from '@mui/material/Typography'
import { styled } from '@mui/material/styles'
import { RouteUtils } from '../../utils/route-utils'
import { SearchScope } from '../../../types/searchScope'
import { trimLongString } from '../../utils/trimLongString'
Expand All @@ -13,12 +14,18 @@ type NFTLinkProps = {
instance: EvmNft
}

const StyledTypography = styled(Typography)({
whiteSpace: 'nowrap',
overflow: 'hidden',
textOverflow: 'ellipsis',
})

export const NFTCollectionLink: FC<NFTLinkProps> = ({ scope, instance }) => {
const { t } = useTranslation()
const to = RouteUtils.getTokenRoute(scope, instance.token?.contract_addr)

return (
<Typography>
<StyledTypography>
<Trans
i18nKey="nft.collectionLink"
t={t}
Expand All @@ -30,7 +37,7 @@ export const NFTCollectionLink: FC<NFTLinkProps> = ({ scope, instance }) => {
),
}}
/>
</Typography>
</StyledTypography>
)
}

Expand All @@ -39,7 +46,7 @@ export const NFTInstanceLink: FC<NFTLinkProps> = ({ scope, instance }) => {
const to = RouteUtils.getNFTInstanceRoute(scope, instance.token?.eth_contract_addr, instance.id)

return (
<Typography>
<StyledTypography>
<Trans
i18nKey="nft.instanceIdLink"
t={t}
Expand All @@ -51,6 +58,6 @@ export const NFTInstanceLink: FC<NFTLinkProps> = ({ scope, instance }) => {
),
}}
/>
</Typography>
</StyledTypography>
)
}
2 changes: 1 addition & 1 deletion src/styles/theme/defaultTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ export const defaultTheme = createTheme({
[theme.breakpoints.up('sm')]: {
// default gridTemplateColumns is set by cols prop default number via inline styles
// and cannot be overridden without !important statement
gridTemplateColumns: `repeat(auto-fill, minmax(210px, 210px))!important`,
gridTemplateColumns: `repeat(auto-fill, minmax(210px, auto))!important`,
},
}),
},
Expand Down

0 comments on commit 6efb046

Please sign in to comment.