Commit c5bed1c6 authored by Greg Bugyis's avatar Greg Bugyis Committed by GitHub

style: Font weight on Trending Collections table (#5121)

* Drop classnames on Trending Table TD cells (no longer used)

* Fix font-weight in Trending Collections table collection name to match Figma

* There was a newer Figma

* Fixes

* Extend maxWidth on collection name (mobile)

* Mobile/desktop tweak

* Fix mobile size and add constants

* Make truncatedText a styled component
parent 1411a921
import { formatEther } from '@ethersproject/units' import { formatEther } from '@ethersproject/units'
import { SquareArrowDownIcon, SquareArrowUpIcon, VerifiedIcon } from 'nft/components/icons' import { SquareArrowDownIcon, SquareArrowUpIcon, VerifiedIcon } from 'nft/components/icons'
import { useIsMobile } from 'nft/hooks'
import { Denomination } from 'nft/types' import { Denomination } from 'nft/types'
import { volumeFormatter } from 'nft/utils' import { volumeFormatter } from 'nft/utils'
import styled from 'styled-components/macro' import styled from 'styled-components/macro'
...@@ -11,23 +12,29 @@ import { Box } from '../../Box' ...@@ -11,23 +12,29 @@ import { Box } from '../../Box'
import { Column, Row } from '../../Flex' import { Column, Row } from '../../Flex'
import * as styles from './Cells.css' import * as styles from './Cells.css'
const CollectionNameContainer = styled.div` const TruncatedText = styled.div`
display: flex;
padding: 14px 0px 14px 8px;
align-items: center;
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
` `
const CollectionName = styled.div` const CollectionNameContainer = styled(TruncatedText)`
display: flex;
padding: 14px 0px 14px 8px;
align-items: center;
`
const CollectionName = styled(TruncatedText)`
margin-left: 8px; margin-left: 8px;
`
const TruncatedSubHeader = styled(ThemedText.SubHeader)`
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
` `
const TruncatedSubHeaderSmall = styled(ThemedText.SubHeaderSmall)`
const TruncatedSubHeader = styled(ThemedText.SubHeader)` color: ${({ theme }) => `${theme.textPrimary}`};
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
...@@ -68,11 +75,16 @@ interface CellProps { ...@@ -68,11 +75,16 @@ interface CellProps {
} }
export const CollectionTitleCell = ({ value }: CellProps) => { export const CollectionTitleCell = ({ value }: CellProps) => {
const isMobile = useIsMobile()
return ( return (
<CollectionNameContainer> <CollectionNameContainer>
<RoundedImage src={value.logo} /> <RoundedImage src={value.logo} />
<CollectionName> <CollectionName>
{isMobile ? (
<TruncatedSubHeaderSmall>{value.name}</TruncatedSubHeaderSmall>
) : (
<TruncatedSubHeader>{value.name}</TruncatedSubHeader> <TruncatedSubHeader>{value.name}</TruncatedSubHeader>
)}
</CollectionName> </CollectionName>
{value.isVerified && ( {value.isVerified && (
<span className={styles.verifiedBadge}> <span className={styles.verifiedBadge}>
......
import clsx from 'clsx'
import { LoadingBubble } from 'components/Tokens/loading' import { LoadingBubble } from 'components/Tokens/loading'
import { useWindowSize } from 'hooks/useWindowSize' import { useWindowSize } from 'hooks/useWindowSize'
import { useIsMobile } from 'nft/hooks' import { useIsMobile } from 'nft/hooks'
...@@ -14,6 +13,12 @@ import { ArrowRightIcon } from '../icons' ...@@ -14,6 +13,12 @@ import { ArrowRightIcon } from '../icons'
import { ColumnHeaders } from './CollectionTable' import { ColumnHeaders } from './CollectionTable'
import * as styles from './Explore.css' import * as styles from './Explore.css'
// Default table cell max width
const CELL_WIDTH = '160px'
// Collection Name cell max widths
const MOBILE_CELL_WIDTH = '240px'
const DESKTOP_CELL_WIDTH = '360px'
const RankCellContainer = styled.div` const RankCellContainer = styled.div`
display: flex; display: flex;
align-items: center; align-items: center;
...@@ -84,9 +89,6 @@ interface TableProps<D extends Record<string, unknown>> { ...@@ -84,9 +89,6 @@ interface TableProps<D extends Record<string, unknown>> {
smallHiddenColumns: IdType<D>[] smallHiddenColumns: IdType<D>[]
mediumHiddenColumns: IdType<D>[] mediumHiddenColumns: IdType<D>[]
largeHiddenColumns: IdType<D>[] largeHiddenColumns: IdType<D>[]
classNames?: {
td: string
}
} }
export function Table<D extends Record<string, unknown>>({ export function Table<D extends Record<string, unknown>>({
columns, columns,
...@@ -94,7 +96,6 @@ export function Table<D extends Record<string, unknown>>({ ...@@ -94,7 +96,6 @@ export function Table<D extends Record<string, unknown>>({
smallHiddenColumns, smallHiddenColumns,
mediumHiddenColumns, mediumHiddenColumns,
largeHiddenColumns, largeHiddenColumns,
classNames,
...props ...props
}: TableProps<D>) { }: TableProps<D>) {
const theme = useTheme() const theme = useTheme()
...@@ -188,7 +189,14 @@ export function Table<D extends Record<string, unknown>>({ ...@@ -188,7 +189,14 @@ export function Table<D extends Record<string, unknown>>({
> >
{row.cells.map((cell, cellIndex) => { {row.cells.map((cell, cellIndex) => {
return ( return (
<td className={clsx(styles.td, classNames?.td)} {...cell.getCellProps()} key={cellIndex}> <td
className={styles.td}
{...cell.getCellProps()}
key={cellIndex}
style={{
maxWidth: cellIndex === 0 ? (isMobile ? MOBILE_CELL_WIDTH : DESKTOP_CELL_WIDTH) : CELL_WIDTH,
}}
>
{cellIndex === 0 ? ( {cellIndex === 0 ? (
<RankCellContainer> <RankCellContainer>
{!isMobile && ( {!isMobile && (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment