Skip to content

Commit

Permalink
Merge pull request ProjectOpenSea#13 from ProjectOpenSea/taylor/fix/c…
Browse files Browse the repository at this point in the history
…ollection-name

Use collection name and adjust price styles
  • Loading branch information
dfinzer authored Jun 16, 2020
2 parents 89fbcad + 9860e45 commit 1700a4f
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 37 deletions.
43 changes: 25 additions & 18 deletions dist/nft-card.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/nft-card.min.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ <h3>Show users any crypto collectible and let them buy it straight from your sit
<div class="card-container">
<div style="padding-top: 5vh;"></div>
<nft-card
tokenAddress="0x5caebd3b32e210e85ce3e9d51638b9c445481567"
tokenId="2242579050293992223"
tokenAddress="0x2a46f2ffd99e19a89476e2f62270e0a35bbf0756"
tokenId="22371"
network="mainnet"
>
</nft-card>
Expand Down
39 changes: 23 additions & 16 deletions src/nft-card-front.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,20 +91,29 @@ export class NftCardFrontTemplate extends LitElement {
text-align: left;
}
.asset-detail-price {
text-align: right;
}
.asset-detail-price {
align-items: flex-end;
font-size: 18px;
font-weight: 400;
display: flex;
flex-flow: row;
justify-content: flex-end;
align-items: baseline;
line-height: 15px;
text-align: right;
padding: 6px 0;
}
.asset-detail-price img {
margin-left: 5px;
margin: 0 4px;
}
.asset-detail-price-current img {
width: 15px;
align-self: center;
}
.asset-detail-price-previous {
font-size: 14px;
color: rgb(130, 130, 130);
line-height: 10px;
}
.asset-detail-price-previous img {
width: 1ex;
}
.asset-detail-price .value {
margin-left: 5px;
Expand Down Expand Up @@ -173,11 +182,9 @@ export class NftCardFrontTemplate extends LitElement {
: null

return html`
<div class="asset-detail-price">
<a class="asset-link" href="${this.asset?.openseaLink}" target="_blank">
${currentPriceTemplate} ${prevPriceTemplate}
</a>
</div>
<a class="asset-link" href="${this.asset?.openseaLink}" target="_blank">
${currentPriceTemplate} ${prevPriceTemplate}
</a>
`
}

Expand All @@ -189,7 +196,7 @@ export class NftCardFrontTemplate extends LitElement {
return undefined // If there is no asset then we can't render
}

const { openseaLink, collection, assetContract, name } = this.asset
const { openseaLink, collection, name } = this.asset
const { network } = this.state

return html`
Expand All @@ -215,8 +222,8 @@ export class NftCardFrontTemplate extends LitElement {
target="_blank"
>
<pill-element
.imageUrl=${assetContract.imageUrl}
.label=${assetContract.name}
.imageUrl=${collection.imageUrl}
.label=${collection.name}
textColor="#828282"
border="1px solid #E2E6EF"
></pill-element>
Expand Down Expand Up @@ -265,7 +272,7 @@ export class NftCardFrontTemplate extends LitElement {
price: number
) {
return html`
<div class="asset-detail-price">
<div class="asset-detail-price asset-detail-price-${priceType}">
${priceType === PriceType.Previous
? html`
<div class="previous-value">Prev.&nbsp;</div>
Expand All @@ -278,7 +285,7 @@ export class NftCardFrontTemplate extends LitElement {
${paymentToken.symbol === 'ETH' ? 'Ξ' : paymentToken.symbol}
</div>
`}
<div class="asset-detail-price value ${priceType}-value">
<div class="asset-detail-price-value">
${toBaseDenomination(price, paymentToken.decimals)}
</div>
</div>
Expand Down

0 comments on commit 1700a4f

Please sign in to comment.