Commit 8e9a20a6 authored by Mike Grabowski's avatar Mike Grabowski Committed by GitHub

chore: various responsive tweaks to carousel (#5377)

* feat: resposive tweaks

* feat: display inline badge

* make animation slightly faster

* chore: change color
parent 1a315603
...@@ -38,7 +38,7 @@ const CarouselItemCard = styled(a.div)` ...@@ -38,7 +38,7 @@ const CarouselItemCard = styled(a.div)`
const CarouselItemIcon = styled.div` const CarouselItemIcon = styled.div`
align-items: center; align-items: center;
color: ${({ theme }) => theme.accentAction}; color: ${({ theme }) => theme.textPrimary};
cursor: pointer; cursor: pointer;
display: none; display: none;
user-select: none; user-select: none;
...@@ -84,7 +84,7 @@ export const Carousel = ({ children, activeIndex, toggleNextSlide }: CarouselPro ...@@ -84,7 +84,7 @@ export const Carousel = ({ children, activeIndex, toggleNextSlide }: CarouselPro
return { return {
x: (-y % (MAX_CARD_WIDTH * children.length)) + MAX_CARD_WIDTH * rank, x: (-y % (MAX_CARD_WIDTH * children.length)) + MAX_CARD_WIDTH * rank,
immediate: vy < 0 ? prevPosition > position : prevPosition < position, immediate: vy < 0 ? prevPosition > position : prevPosition < position,
config: { tension: 250, friction: 35 }, config: { tension: 250, friction: 30 },
} }
}) })
prev.current = [firstVis, firstVisIdx] prev.current = [firstVis, firstVisIdx]
......
...@@ -8,16 +8,6 @@ import { formatWeiToDecimal } from 'nft/utils' ...@@ -8,16 +8,6 @@ import { formatWeiToDecimal } from 'nft/utils'
import styled, { useTheme } from 'styled-components/macro' import styled, { useTheme } from 'styled-components/macro'
import { ThemedText } from 'theme/components/text' import { ThemedText } from 'theme/components/text'
const CarouselCardContainer = styled.div`
display: flex;
flex-direction: column;
background-color: ${({ theme }) => theme.backgroundSurface};
border: 1px solid ${({ theme }) => theme.backgroundOutline};
border-radius: 20px;
overflow: hidden;
height: 100%;
`
const CarouselCardBorder = styled.div` const CarouselCardBorder = styled.div`
width: 100%; width: 100%;
position: relative; position: relative;
...@@ -86,17 +76,11 @@ const CardHeaderColumn = styled.div` ...@@ -86,17 +76,11 @@ const CardHeaderColumn = styled.div`
padding: 0 40px; padding: 0 40px;
z-index: 1; z-index: 1;
` `
const CardNameRow = styled.div`
display: flex;
gap: 2px;
`
const IconContainer = styled.div` const IconContainer = styled.div`
display: flex; display: inline;
flex-shrink: 0; vertical-align: text-bottom;
align-items: center; margin-left: 2px;
` `
const CollectionNameContainer = styled.div` const CollectionNameContainer = styled.div`
display: -webkit-box; display: -webkit-box;
overflow: hidden; overflow: hidden;
...@@ -155,12 +139,7 @@ const TableElement = styled.div` ...@@ -155,12 +139,7 @@ const TableElement = styled.div`
gap: 6px; gap: 6px;
` `
const FirstColumnTextWrapper = styled.div` const FirstColumnTextWrapper = styled.div``
@media (min-width: ${({ theme }) => theme.breakpoint.sm}px) and (max-width: ${({ theme }) => theme.breakpoint.lg}px) {
display: none;
}
}
`
const CardBottomContainer = styled.div` const CardBottomContainer = styled.div`
display: grid; display: grid;
...@@ -168,6 +147,21 @@ const CardBottomContainer = styled.div` ...@@ -168,6 +147,21 @@ const CardBottomContainer = styled.div`
gap: 8px; gap: 8px;
grid-template-columns: auto auto auto; grid-template-columns: auto auto auto;
padding: 16px 16px 20px; padding: 16px 16px 20px;
`
const MarketplaceIcon = styled.img`
width: 20px;
height: 20px;
`
const CarouselCardContainer = styled.div`
display: flex;
flex-direction: column;
background-color: ${({ theme }) => theme.backgroundSurface};
border: 1px solid ${({ theme }) => theme.backgroundOutline};
border-radius: 20px;
overflow: hidden;
height: 100%;
${TableElement}:nth-child(3n-1), ${LoadingTableElement}:nth-child(3n-1) { ${TableElement}:nth-child(3n-1), ${LoadingTableElement}:nth-child(3n-1) {
justify-self: center; justify-self: center;
...@@ -176,11 +170,18 @@ const CardBottomContainer = styled.div` ...@@ -176,11 +170,18 @@ const CardBottomContainer = styled.div`
${TableElement}:nth-child(3n), ${LoadingTableElement}:nth-child(3n) { ${TableElement}:nth-child(3n), ${LoadingTableElement}:nth-child(3n) {
justify-self: right; justify-self: right;
} }
`
const MarketplaceIcon = styled.img` @media (max-width: 396px) or ((min-width: ${({ theme }) => theme.breakpoint.sm}px) and (max-width: 880px)) {
width: 20px; ${FirstColumnTextWrapper} {
height: 20px; display: none;
}
${TableElement} {
justify-self: left !important;
}
${CardHeaderColumn} {
padding: 0 20px;
}
}
` `
interface MarketplaceRowProps { interface MarketplaceRowProps {
...@@ -288,29 +289,28 @@ export const LoadingTable = () => { ...@@ -288,29 +289,28 @@ export const LoadingTable = () => {
) )
} }
const CollectionName = styled(ThemedText.MediumHeader)`
display: inline;
vertical-align: text-bottom;
line-height: 28px;
`
const CarouselCardHeader = ({ collection }: { collection: TrendingCollection }) => { const CarouselCardHeader = ({ collection }: { collection: TrendingCollection }) => {
const theme = useTheme() const theme = useTheme()
return ( return (
<CardHeaderContainer src={collection.bannerImageUrl}> <CardHeaderContainer src={collection.bannerImageUrl}>
<CardHeaderColumn> <CardHeaderColumn>
<CollectionImage src={collection.imageUrl} /> <CollectionImage src={collection.imageUrl} />
<CardNameRow> <CollectionNameContainer>
<CollectionNameContainer> <CollectionName color={theme.accentTextLightPrimary} fontWeight="500">
<ThemedText.MediumHeader {collection.name}
color={theme.accentTextLightPrimary} </CollectionName>
fontWeight="500"
lineHeight="28px"
display="inline"
>
{collection.name}
</ThemedText.MediumHeader>
</CollectionNameContainer>
{collection.isVerified && ( {collection.isVerified && (
<IconContainer> <IconContainer>
<VerifiedIcon width="24px" height="24px" /> <VerifiedIcon width="24px" height="24px" />
</IconContainer> </IconContainer>
)} )}
</CardNameRow> </CollectionNameContainer>
</CardHeaderColumn> </CardHeaderColumn>
<HeaderOverlay /> <HeaderOverlay />
</CardHeaderContainer> </CardHeaderContainer>
......
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