Skip to content

Commit

Permalink
fix: display nft image + style nft instance in mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
Tien Nam Dao committed Dec 8, 2022
1 parent 0471081 commit ea8bc52
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 24 deletions.
12 changes: 1 addition & 11 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,7 @@ const nextConfig = {
remotePatterns: [
{
protocol: 'https',
hostname: 'ipfs.io',
pathname: '/ipfs/**'
},
{
protocol: 'https',
hostname: 'astranaut.dev',
pathname: '/**'
},
{
protocol: 'https',
hostname: 'astranaut.io',
hostname: '*',
pathname: '/**'
}
]
Expand Down
36 changes: 23 additions & 13 deletions views/tokens/[instance]/NftOverview.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { useMobileLayout } from '@astraprotocol/astra-ui'
import clsx from 'clsx'
import BackgroundCard from 'components/Card/Background/BackgroundCard'
import Row from 'components/Grid/Row'
import Image from 'next/image'
Expand All @@ -9,29 +11,37 @@ interface Props {
}

const NftOverview = ({ token, tokenData, tokenId }: Props) => {
const { isMobile } = useMobileLayout()
const size = isMobile ? 200 : 800
const Layout = ({ children }) =>
isMobile ? (
<div style={{ display: 'flex', flexDirection: 'column-reverse' }}>{children}</div>
) : (
<Row>{children}</Row>
)
const tokenImage = tokenData?.image.replace('ipfs://', 'https://ipfs.io/ipfs/')
return (
<BackgroundCard classes="padding-top-lg padding-bottom-lg margin-top-2xl padding-left-2xl padding-right-2xl">
<Row>
<div className="col-6 margin-right-md">
<Layout>
<div className="margin-right-md">
<Row style={{ justifyContent: 'space-between' }}>
<span className="text text-base contrast-color-50">Token ID:</span>
<span className="text text-base">{tokenId}</span>
<div className="text text-base contrast-color-50">Token ID:</div>
<div className="text text-base">{tokenId}</div>
</Row>
<Row style={{ justifyContent: 'space-between' }}>
<span className="text text-base contrast-color-50">Name:</span>
<span className="text text-base">{tokenData.name}</span>
<div className="text text-base contrast-color-50">Name:</div>
<div className="text text-base">{tokenData.name}</div>
</Row>

<Row style={{ justifyContent: 'space-between' }}>
<span className="text text-base contrast-color-50">Description:</span>
<span className="text text-base">{tokenData.description}</span>
</Row>
{/* <Row style={{ justifyContent: 'space-between', alignItems: 'flex-start' }}> */}
<div className="text text-base contrast-color-50">Description:</div>
<div className="text text-base">&quot;{tokenData.description}&quot;</div>
{/* </Row> */}
</div>
<div className="col-6 flex flex-justify-end">
<Image src={tokenImage} alt={tokenData.name} height={100} width={120} layout="fixed" />
<div className={clsx(isMobile ? 'margin-bottom-md' : 'flex flex-justify-end')}>
<Image src={tokenImage} alt={tokenData.name} width={size} height={size} />
</div>
</Row>
</Layout>
</BackgroundCard>
)
}
Expand Down

0 comments on commit ea8bc52

Please sign in to comment.