Skip to content

Commit

Permalink
fix: some style fixes (#1746)
Browse files Browse the repository at this point in the history
* fix: some style fixes

* fix: best buing option remove loader

* fix: best buying option tests

* fix: description
  • Loading branch information
flobarreto authored and juanmahidalgo committed Jun 1, 2023
1 parent 75c74a3 commit 4a8c877
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 43 deletions.
1 change: 1 addition & 0 deletions webapp/src/components/AssetImage/AssetImage.css
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@
width: 100%;
bottom: -110px;
padding-top: 20px;
height: 84px;
}
.AssetImage .rarity-background,
.AssetImage .WearablePreview {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,7 @@ describe('Best Buying Option', () => {
<BestBuyingOption asset={asset} tableRef={reference} />
)

const loader = await findByTestId('loader')

await waitFor(() => {
expect(loader).not.toBeInTheDocument()
})
await findByTestId('best-buying-option-container')

expect(
getByText(t('best_buying_option.buy_listing.title'), { exact: false })
Expand All @@ -160,11 +156,7 @@ describe('Best Buying Option', () => {
<BestBuyingOption asset={asset} tableRef={reference} />
)

const loader = await findByTestId('loader')

await waitFor(() => {
expect(loader).not.toBeInTheDocument()
})
await findByTestId('best-buying-option-container')

const price = formatWeiMANA(orderResponse.price)

Expand Down Expand Up @@ -194,11 +186,7 @@ describe('Best Buying Option', () => {
<BestBuyingOption asset={asset} tableRef={reference} />
)

const loader = await findByTestId('loader')

await waitFor(() => {
expect(loader).not.toBeInTheDocument()
})
await findByTestId('best-buying-option-container')

expect(getByText(t('best_buying_option.empty.title'))).toBeInTheDocument()
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
OrderSortBy,
Rarity
} from '@dcl/schemas'
import { Button, Loader, Popup } from 'decentraland-ui'
import { Button, Popup } from 'decentraland-ui'
import { formatDistanceToNow } from '../../../lib/date'
import { locations } from '../../../modules/routing/locations'
import { isNFT } from '../../../modules/asset/utils'
Expand Down Expand Up @@ -116,19 +116,16 @@ const BestBuyingOption = ({ asset, tableRef }: Props) => {
buyWithCardClassName: styles.buyWithCardClassName
}

return (
return isLoading ? null : (
<div
data-testid="best-buying-option-container"
className={
buyOption === BuyOptions.MINT || buyOption === BuyOptions.BUY_LISTING
? `${styles.BestBuyingOption} ${styles.AlignEnd}`
: styles.BestBuyingOption
}
>
{isLoading ? (
<div className={styles.emptyContainer}>
<Loader active data-testid="loader" />
</div>
) : buyOption === BuyOptions.MINT && asset && !isNFT(asset) ? (
{buyOption === BuyOptions.MINT && asset && !isNFT(asset) ? (
<div className={`${styles.containerColumn} ${styles.fullWidth}`}>
<span className={styles.cardTitle}>
{t('best_buying_option.minting.title')}&nbsp;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@
font-size: 14px;
line-height: 26px;
letter-spacing: 0.2px;
}

.Description .descriptionContained {
font-size: 14px;
line-height: 26px;
letter-spacing: 0.2px;
word-wrap: break-word;
}

.Description .readMore {
Expand Down
21 changes: 10 additions & 11 deletions webapp/src/components/AssetPage/Description/Description.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { t } from 'decentraland-dapps/dist/modules/translation/utils'
import { Props } from './Description.types'
import styles from './Description.module.css'

const MAX_LENGTH = 81
const MAX_LENGTH = 148

const Description = (props: Props) => {
const { text } = props
Expand All @@ -14,22 +14,21 @@ const Description = (props: Props) => {
return (
<div className={styles.Description}>
<Header sub>{t('asset_page.description')}</Header>
<div
className={
hasMoreLines && showMore
? styles.descriptionText
: styles.descriptionContained
}
id="text-container"
>
{text ? text : t('asset_page.no_description')}
<div className={styles.descriptionText} id="text-container">
{text
? hasMoreLines && !showMore
? `${text.substring(0, MAX_LENGTH)}...`
: text
: t('asset_page.no_description')}
</div>
{hasMoreLines ? (
<span
onClick={() => setShowMore(prevState => !prevState)}
className={styles.readMore}
>
{t('asset_page.read_more').toLocaleUpperCase()}
{showMore
? t('asset_page.read_less').toLocaleUpperCase()
: t('asset_page.read_more').toLocaleUpperCase()}
</span>
) : null}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
margin-left: 0px;
}

@media (max-width: 800px) {
@media (max-width: 1000px) {
.ItemDetail .information {
width: 100%;
}
Expand All @@ -66,9 +66,6 @@
.ItemDetail .assetImageContainer {
width: 100%;
}
.ItemDetail .basicRow {
flex-direction: column;
}

.ItemDetail :global(.dcl.stats + .dcl.stats) {
width: 100%;
Expand All @@ -93,6 +90,9 @@
.ItemDetail .basicRow :global(.dcl.stats) {
width: 100%;
}
.ItemDetail .basicRow {
flex-direction: column;
}

.ItemDetail :global(.dcl.tabs) {
justify-content: space-evenly;
Expand Down
1 change: 1 addition & 0 deletions webapp/src/modules/translation/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,7 @@
"description": "Description",
"no_description": "No description",
"read_more": "Read more",
"read_less": "Read less",
"owner": "Owner",
"creator": "Creator",
"price": "Price",
Expand Down
1 change: 1 addition & 0 deletions webapp/src/modules/translation/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,7 @@
"description": "Descripción",
"no_description": "Sin descripción",
"read_more": "Leer más",
"read_less": "Leer menos",
"owner": "Dueño",
"creator": "Creador",
"price": "Precio",
Expand Down
1 change: 1 addition & 0 deletions webapp/src/modules/translation/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,7 @@
"description": "描述",
"no_description": "沒有說明",
"read_more": "閱讀更多",
"read_less": "少讀",
"owner": "持有者",
"creator": "创造者",
"price": "价格",
Expand Down

0 comments on commit 4a8c877

Please sign in to comment.