Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: marketplace ui break in mobile view #1172

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion packages/components/sorts/SearchInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,14 @@ import { layout } from "../../utils/style/layout";
import { SVG } from "../SVG";
import { LegacyTertiaryBox } from "../boxes/LegacyTertiaryBox";

import { useIsMobile } from "@/hooks/useIsMobile";

export const SearchInput: React.FC<{
style?: StyleProp<ViewStyle>;
borderRadius?: number;
handleChangeText?: (e: string) => void;
}> = ({ handleChangeText, borderRadius, style }) => {
const isMobile = useIsMobile();
return (
<LegacyTertiaryBox
style={style}
Expand All @@ -31,7 +34,11 @@ export const SearchInput: React.FC<{
fullWidth
>
<SVG
style={{ marginRight: layout.spacing_x1, maxWidth: 22 }}
style={{
marginRight: layout.spacing_x1,
maxWidth: 22,
marginLeft: isMobile ? layout.spacing_x2 : 0,
}}
source={searchSVG}
/>
<TextInput
Expand Down
12 changes: 10 additions & 2 deletions packages/components/table/TableRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { fontSemibold12 } from "../../utils/style/fonts";
import { layout } from "../../utils/style/layout";
import { BrandText } from "../BrandText";

import { useIsMobile } from "@/hooks/useIsMobile";

export type TableRowHeading = { label: string; flex: number };

interface TableRowProps {
Expand All @@ -14,6 +16,8 @@ interface TableRowProps {
}

export const TableRow: React.FC<TableRowProps> = ({ headings, labelStyle }) => {
const isMobile = useIsMobile();

return (
<View style={styles.row}>
{headings.map(({ label, flex }, index) => (
Expand All @@ -24,7 +28,11 @@ export const TableRow: React.FC<TableRowProps> = ({ headings, labelStyle }) => {
{
flex,
paddingRight:
headings.length - 1 === index ? 0 : layout.spacing_x1,
headings.length - 1 === index
? isMobile
? 0
: layout.spacing_x1
: 0,
},
labelStyle,
]}
Expand All @@ -47,7 +55,7 @@ const styles = StyleSheet.create({
width: "100%",
backgroundColor: codGrayColor,
minHeight: layout.contentSpacing,
paddingHorizontal: layout.spacing_x2_5,
paddingHorizontal: layout.spacing_x1_25,
borderTopLeftRadius: layout.borderRadius,
borderTopRightRadius: layout.borderRadius,
},
Expand Down
31 changes: 19 additions & 12 deletions packages/screens/Marketplace/MarketplaceScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,23 +60,23 @@ import { arrayIncludes } from "@/utils/typescript";
const TABLE_COLUMNS = {
rank: {
label: "Rank",
flex: 0.5,
flex: 0.6,
},
collectionNameData: {
label: "Collection",
flex: 2.5,
flex: 2.4,
},
tradeVolume: {
label: "",
flex: 1.8,
flex: 1.9,
},
tradeVolumeDiff: {
label: "",
flex: 1,
},
sales: {
label: "",
flex: 1,
flex: 1.1,
},
floorPrice: {
label: "Floor Price",
Expand All @@ -88,11 +88,11 @@ const TABLE_COLUMNS = {
},
supply: {
label: "Supply",
flex: 1,
flex: 1.2,
},
mintVolume: {
label: "",
flex: 1.8,
flex: 1.5,
},
};

Expand Down Expand Up @@ -328,8 +328,11 @@ const PrettyPriceWithCurrency: React.FC<{
style={[
isMobile ? fontSemibold9 : fontSemibold11,
{
marginLeft: layout.spacing_x1,
marginLeft: isMobile
? layout.spacing_x0_5
: layout.spacing_x1,
color: neutral77,
width: isMobile ? layout.spacing_x3 : "auto",
},
]}
numberOfLines={1}
Expand Down Expand Up @@ -391,9 +394,7 @@ const CollectionRow: React.FC<{
params: { id: collection.id },
}}
>
<InnerCell style={{ flex: TABLE_COLUMNS.rank.flex }}>
{rowData.rank}
</InnerCell>
<InnerCell style={{ flex: 0.4 }}>{rowData.rank}</InnerCell>

<View
style={{
Expand All @@ -410,20 +411,26 @@ const CollectionRow: React.FC<{
style={{ marginRight: isMobile ? 8 : layout.spacing_x1_5 }}
/>
<BrandText
style={isMobile ? fontSemibold11 : fontSemibold13}
style={[
isMobile ? fontSemibold11 : fontSemibold13,
{ width: isMobile ? 80 : "auto" },
]}
numberOfLines={1}
>
{rowData.collectionNameData.collectionName}
</BrandText>
</View>
<PrettyPriceWithCurrency
data={rowData["tradeVolume"]}
style={{ flex: TABLE_COLUMNS.tradeVolume.flex }}
style={{
flex: TABLE_COLUMNS.tradeVolume.flex,
}}
/>
<InnerCell
style={{ flex: TABLE_COLUMNS.tradeVolumeDiff.flex }}
textStyle={{
color: tradeDiffColor,
marginLeft: isMobile ? layout.spacing_x1_5 : 0,
}}
>
{tradeDiffText}
Expand Down
Loading