Skip to content

Commit

Permalink
feat(gap): replace gap calls with our spacing tokens (#11043)
Browse files Browse the repository at this point in the history
* refactor: change gap values to spacing token

* feat: bump palette and fix 15px gap on artwork rail placeholder

* feat: adjust rebased changes
  • Loading branch information
araujobarret authored Oct 30, 2024
1 parent b1e8d3d commit ff385a9
Show file tree
Hide file tree
Showing 30 changed files with 76 additions and 123 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
},
"dependencies": {
"@artsy/cohesion": "4.214.0",
"@artsy/palette-mobile": "13.2.42",
"@artsy/palette-mobile": "13.2.43",
"@artsy/to-title-case": "1.1.0",
"@braze/react-native-sdk": "11.0.0",
"@expo/react-native-action-sheet": "4.0.1",
Expand Down
2 changes: 1 addition & 1 deletion src/app/Components/ArtworkRail/ArtworkRail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export const ArtworkRailPlaceholder: React.FC = () => {
const cards = !isTablet() ? 2 : 6

return (
<Flex gap={15} flexDirection="row">
<Flex gap={2} flexDirection="row">
{Array.from({ length: cards }).map((_, index) => (
<Flex key={index}>
{enableArtworkRailRedesignImageAspectRatio ? (
Expand Down
2 changes: 1 addition & 1 deletion src/app/Components/Bidding/Screens/CreditCardForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export const CreditCardForm: React.FC<CreditCardFormProps> = ({
keyboardDismissMode="on-drag"
keyboardShouldPersistTaps="handled"
>
<Flex gap={1}>
<Flex>
<>
<CreditCardField onCardChange={handleOnCardChange} />

Expand Down
2 changes: 1 addition & 1 deletion src/app/Components/Stack.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Spacer, SpacingUnit, Flex, Join } from "@artsy/palette-mobile"

/**
* @deprecated Please use `<Flex gap={space(1)}>` instead
* @deprecated Please use `<Flex gap={1}>` instead
*/
export const Stack: React.FC<
{ spacing?: SpacingUnit; horizontal?: boolean } & React.ComponentPropsWithoutRef<typeof Flex>
Expand Down
2 changes: 1 addition & 1 deletion src/app/Scenes/Activity/ActivityEmptyView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export const ActivityEmptyView: React.FC<ActivityEmptyViewProps> = ({ type, refr
{entity.message}
</Text>
<Spacer y={2} />
<Flex flexDirection="row" gap={10}>
<Flex flexDirection="row" gap={1}>
<Text variant="xs" color="black60">
{entity.geStartedMessage}
</Text>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ActionType, ContextModule, OwnerType, TappedViewWork } from "@artsy/cohesion"
import { Button, Flex, useSpace, Join, Spacer } from "@artsy/palette-mobile"
import { Button, Flex, Join, Spacer } from "@artsy/palette-mobile"
import { BuyNowButton_artwork$key } from "__generated__/BuyNowButton_artwork.graphql"
import { MyProfileEditModal_me$key } from "__generated__/MyProfileEditModal_me.graphql"
import { NotificationCommercialButtonsQuery } from "__generated__/NotificationCommercialButtonsQuery.graphql"
Expand Down Expand Up @@ -66,7 +66,6 @@ export const CommercialButtons: React.FC<{
const artworkData = useFragment(artworkFragment, artwork)

const [showCreateArtworkAlertModal, setShowCreateArtworkAlertModal] = useState(false)
const space = useSpace()

const { hasEnded } = getTimer(partnerOffer?.endAt || "")
const noLongerAvailable = !partnerOffer?.isAvailable
Expand Down Expand Up @@ -154,7 +153,7 @@ export const CommercialButtons: React.FC<{
}

return (
<Flex mx={2} gap={space(1)}>
<Flex mx={2} gap={1}>
{renderComponent}
</Flex>
)
Expand Down
7 changes: 3 additions & 4 deletions src/app/Scenes/Articles/News/ArticlesCards.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ActionType, ContextModule, OwnerType, TappedNewsSection } from "@artsy/cohesion"
import { Flex, Separator, Text, Touchable, useSpace } from "@artsy/palette-mobile"
import { Flex, Separator, Text, Touchable } from "@artsy/palette-mobile"
import { ArticlesCards_viewer$key } from "__generated__/ArticlesCards_viewer.graphql"
import { navigate } from "app/system/navigation/navigate"
import { graphql, useFragment } from "react-relay"
Expand All @@ -12,7 +12,6 @@ export interface ArticleNewsProps {
export const ArticlesCards: React.FC<ArticleNewsProps> = ({ viewer }) => {
const tracking = useTracking()
const data = useFragment(ArticlesNewsFragment, viewer)
const space = useSpace()

if (!data.articles) {
return null
Expand All @@ -24,13 +23,13 @@ export const ArticlesCards: React.FC<ArticleNewsProps> = ({ viewer }) => {
}

return (
<Flex m={2} p={2} border="1px solid" borderColor="black30" gap={space(2)}>
<Flex m={2} p={2} border="1px solid" borderColor="black30" gap={2}>
<Flex flexDirection="row" justifyContent="space-between" alignItems="center">
<Text variant="lg-display">News</Text>
<Text variant="lg-display">{date}</Text>
</Flex>
{data.articles.map((article, index) => (
<Flex key={index} gap={space(2)}>
<Flex key={index} gap={2}>
<Touchable onPress={() => handleOnPress(article.href ?? "")}>
<Flex flexDirection="row" alignItems="center">
<Text variant="sm-display" numberOfLines={3}>
Expand Down
13 changes: 5 additions & 8 deletions src/app/Scenes/CollectionsByCategory/Body.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Flex, Separator, Skeleton, SkeletonText, Text, useSpace } from "@artsy/palette-mobile"
import { Flex, Separator, Skeleton, SkeletonText, Text } from "@artsy/palette-mobile"
import { useRoute } from "@react-navigation/native"
import { FlashList } from "@shopify/flash-list"
import { BodyCollectionsByCategoryQuery } from "__generated__/BodyCollectionsByCategoryQuery.graphql"
Expand All @@ -20,7 +20,6 @@ interface BodyProps {
}

export const Body: React.FC<BodyProps> = ({ viewer }) => {
const space = useSpace()
const data = useFragment(fragment, viewer)
const { params } = useRoute<CollectionsByCategoriesRouteProp>()
const category = params.props.category
Expand All @@ -30,8 +29,8 @@ export const Body: React.FC<BodyProps> = ({ viewer }) => {
}

return (
<Flex gap={space(4)}>
<Flex gap={space(2)}>
<Flex gap={4}>
<Flex gap={2}>
<Text variant="xl" px={2}>
{category}
</Text>
Expand Down Expand Up @@ -73,12 +72,10 @@ const fragment = graphql`
`

const BodyPlaceholder: React.FC = () => {
const space = useSpace()

return (
<Skeleton>
<Flex gap={space(4)}>
<Flex gap={space(2)} px={2}>
<Flex gap={4}>
<Flex gap={2} px={2}>
<SkeletonText variant="xl">Category</SkeletonText>

<SkeletonText>Category description text</SkeletonText>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { OwnerType } from "@artsy/cohesion"
import { Flex, Screen, useSpace } from "@artsy/palette-mobile"
import { Flex, Screen } from "@artsy/palette-mobile"
import { RouteProp, useRoute } from "@react-navigation/native"
import { BodyWithSuspense } from "app/Scenes/CollectionsByCategory/Body"
import { FooterWithSuspense } from "app/Scenes/CollectionsByCategory/Footer"
Expand All @@ -25,7 +25,6 @@ export type CollectionsByCategoriesRouteProp = RouteProp<

export const CollectionsByCategory: FC = () => {
const { params } = useRoute<CollectionsByCategoriesRouteProp>()
const space = useSpace()

const category = params.props.category

Expand All @@ -40,7 +39,7 @@ export const CollectionsByCategory: FC = () => {
<Screen.Header onBack={goBack} title={category} animated />
<Screen.Body fullwidth flex={1}>
<Screen.ScrollView>
<Flex gap={space(4)}>
<Flex gap={4}>
<BodyWithSuspense />

<FooterWithSuspense homeViewSectionId={params.props.homeViewSectionId} />
Expand Down
2 changes: 1 addition & 1 deletion src/app/Scenes/CollectionsByCategory/CollectionsChips.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const CollectionsChips: React.FC<CollectionsChipsProps> = ({
contentContainerStyle={{ paddingRight: space(2) }}
keyExtractor={(item, index) => `item_${index}_${item[0]?.internalID}`}
renderItem={({ item }) => (
<Flex gap={space(1)}>
<Flex gap={1}>
{item.map((item, index) => {
return (
<Flex minWidth={CHIP_WIDTH} key={`collectionChips-row-${index}`}>
Expand Down
9 changes: 3 additions & 6 deletions src/app/Scenes/CollectionsByCategory/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Flex, Skeleton, SkeletonText, Text, Touchable, useSpace } from "@artsy/palette-mobile"
import { Flex, Skeleton, SkeletonText, Text, Touchable } from "@artsy/palette-mobile"
import { useRoute } from "@react-navigation/native"
import { FooterCollectionsByCategoryQuery } from "__generated__/FooterCollectionsByCategoryQuery.graphql"
import { Footer_homeViewSectionCards$key } from "__generated__/Footer_homeViewSectionCards.graphql"
Expand All @@ -17,7 +17,6 @@ interface FooterProps {
export const Footer: FC<FooterProps> = ({ cards, homeViewSectionId }) => {
const { params } = useRoute<CollectionsByCategoriesRouteProp>()
const data = useFragment(fragment, cards)
const space = useSpace()

const category = decodeURI(params.props.category)

Expand All @@ -34,7 +33,7 @@ export const Footer: FC<FooterProps> = ({ cards, homeViewSectionId }) => {
}

return (
<Flex backgroundColor="black100" p={2} gap={space(2)}>
<Flex backgroundColor="black100" p={2} gap={2}>
<Text color="white100">Explore more categories</Text>

{categories.map((c, index) => (
Expand Down Expand Up @@ -65,11 +64,9 @@ const fragment = graphql`
`

const FooterPlaceholder: FC = () => {
const space = useSpace()

return (
<Skeleton>
<Flex p={2} gap={space(2)}>
<Flex p={2} gap={2}>
<SkeletonText>Explore more categories</SkeletonText>

{Array.from({ length: 5 }).map((_, index) => (
Expand Down
14 changes: 6 additions & 8 deletions src/app/Scenes/CompleteMyProfile/ChangesSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
Screen,
Spacer,
Text,
useSpace,
CheckCircleFillIcon,
CheckCircleIcon,
} from "@artsy/palette-mobile"
Expand All @@ -14,7 +13,6 @@ import { navigate } from "app/system/navigation/navigate"
import { FC } from "react"

export const ChangesSummary: FC = () => {
const space = useSpace()
const { saveAndExit } = useCompleteProfile()
const isLoading = CompleteMyProfileStore.useStoreState((state) => state.isLoading)
const steps = CompleteMyProfileStore.useStoreState((state) => state.steps)
Expand All @@ -39,7 +37,7 @@ export const ChangesSummary: FC = () => {
return (
<Screen safeArea={false}>
<Screen.Body pt={2}>
<Flex py={2} gap={space(2)}>
<Flex py={2} gap={2}>
<Text variant="lg-display">
{isCompleted ? "Thank you for completing your profile." : "You’re almost there!"}
</Text>
Expand All @@ -62,9 +60,9 @@ export const ChangesSummary: FC = () => {
)}
</Text>

<Flex gap={space(1)}>
<Flex gap={1}>
{steps.includes("LocationStep") && (
<Flex flexDirection="row" alignItems="center" gap={space(1)}>
<Flex flexDirection="row" alignItems="center" gap={1}>
{hasLocation ? (
<CheckCircleFillIcon fill="green100" />
) : (
Expand All @@ -77,7 +75,7 @@ export const ChangesSummary: FC = () => {
)}

{steps.includes("ProfessionStep") && (
<Flex flexDirection="row" alignItems="center" gap={space(1)}>
<Flex flexDirection="row" alignItems="center" gap={1}>
{hasProfession ? (
<CheckCircleFillIcon fill="green100" />
) : (
Expand All @@ -90,7 +88,7 @@ export const ChangesSummary: FC = () => {
)}

{steps.includes("AvatarStep") && (
<Flex flexDirection="row" alignItems="center" gap={space(1)}>
<Flex flexDirection="row" alignItems="center" gap={1}>
{hasIconUrl ? (
<CheckCircleFillIcon fill="green100" />
) : (
Expand All @@ -103,7 +101,7 @@ export const ChangesSummary: FC = () => {
)}

{steps.includes("IdentityVerificationStep") && (
<Flex flexDirection="row" alignItems="center" gap={space(1)}>
<Flex flexDirection="row" alignItems="center" gap={1}>
{hasIsIdentityVerified ? (
<CheckCircleFillIcon fill="green100" />
) : (
Expand Down
10 changes: 2 additions & 8 deletions src/app/Scenes/CompleteMyProfile/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
Text,
Touchable,
useScreenDimensions,
useSpace,
} from "@artsy/palette-mobile"
import { RouteProp, useRoute } from "@react-navigation/native"
import {
Expand All @@ -18,7 +17,6 @@ import { useCompleteProfile } from "app/Scenes/CompleteMyProfile/hooks/useComple
import { FC } from "react"

export const Header: FC = () => {
const space = useSpace()
const { progress, currentStep, lastStep, saveAndExit, goBack } = useCompleteProfile()
const steps = CompleteMyProfileStore.useStoreState((state) => state.steps)
const progressStateWithoutUndefined = CompleteMyProfileStore.useStoreState(
Expand All @@ -32,11 +30,7 @@ export const Header: FC = () => {
const isCompleted = completedStepsLength === steps.length - 1

return (
<Flex
backgroundColor="white100"
pb={1}
style={{ paddingTop: safeAreaInsets.top, paddingHorizontal: space(2) }}
>
<Flex backgroundColor="white100" pb={1} px={2} style={{ paddingTop: safeAreaInsets.top }}>
<Flex py={1} justifyContent="space-between" flexDirection="row">
{!isChangesSummary ? (
<Text variant="xs">{`${currentStep} of ${lastStep}`}</Text>
Expand All @@ -53,7 +47,7 @@ export const Header: FC = () => {
)}
</Flex>

<Flex flexDirection="row" alignItems="center" gap={space(1)}>
<Flex flexDirection="row" alignItems="center" gap={1}>
<ProgressBar
height={4}
trackColor={!isCompleted && !isChangesSummary ? "blue100" : "green100"}
Expand Down
5 changes: 2 additions & 3 deletions src/app/Scenes/CompleteMyProfile/IdentityVerificationStep.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Text, Screen, Button, Spacer, Flex, useSpace, CheckIcon } from "@artsy/palette-mobile"
import { Text, Screen, Button, Spacer, Flex, CheckIcon } from "@artsy/palette-mobile"
import { IdentityVerificationStep_me$key } from "__generated__/IdentityVerificationStep_me.graphql"
import { CompleteMyProfileStore } from "app/Scenes/CompleteMyProfile/CompleteMyProfileProvider"
import { Footer } from "app/Scenes/CompleteMyProfile/Footer"
Expand All @@ -10,7 +10,6 @@ import { FC } from "react"
import { graphql, useFragment } from "react-relay"

export const IdentityVerificationStep: FC = () => {
const space = useSpace()
const { goNext } = useCompleteProfile()
const { me } = useCompleteMyProfileSteps()
const data = useFragment<IdentityVerificationStep_me$key>(fragment, me)
Expand Down Expand Up @@ -38,7 +37,7 @@ export const IdentityVerificationStep: FC = () => {

<Spacer y={1} />

<Flex gap={space(2)}>
<Flex gap={2}>
<Text color="black60">
Send an ID verification email and follow the link and instructions to verify your
account.
Expand Down
4 changes: 1 addition & 3 deletions src/app/Scenes/CompleteMyProfile/ImageSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
Button,
CheckCircleFillIcon,
AddCircleIcon,
useSpace,
Image,
Skeleton,
SkeletonBox,
Expand All @@ -26,7 +25,6 @@ interface ImageSelectorProps {

export const ImageSelector: FC<ImageSelectorProps> = ({ src, onImageSelect }) => {
const [isLoading, setIsLoading] = useState(false)
const space = useSpace()
const { showActionSheetWithOptions } = useActionSheet()
const { me } = useCompleteMyProfileSteps()
const data = useFragment<ImageSelector_me$key>(fragment, me)
Expand Down Expand Up @@ -61,7 +59,7 @@ export const ImageSelector: FC<ImageSelectorProps> = ({ src, onImageSelect }) =>

return (
<Touchable aria-label="Choose a photo" accessibilityRole="button" onPress={handleImagePress}>
<Flex alignItems="center" gap={space(2)}>
<Flex alignItems="center" gap={2}>
<Flex alignItems="center">
<Flex
alignItems="center"
Expand Down
4 changes: 1 addition & 3 deletions src/app/Scenes/Fair/Fair.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
SkeletonBox,
useScreenDimensions,
SkeletonText,
useSpace,
ShareIcon,
} from "@artsy/palette-mobile"
import { FairQuery } from "__generated__/FairQuery.graphql"
Expand Down Expand Up @@ -180,7 +179,6 @@ export const FairScreen: React.FC<FairQueryRendererProps> = ({ fairID }) => (

export const FairPlaceholder: React.FC = () => {
const { safeAreaInsets } = useScreenDimensions()
const space = useSpace()

return (
<Flex top={safeAreaInsets.top}>
Expand All @@ -189,7 +187,7 @@ export const FairPlaceholder: React.FC = () => {
<SkeletonBox width={18} height={18} />
</Flex>

<Flex gap={space(2)}>
<Flex gap={2}>
<SkeletonBox height={400} width="100%" />

<SkeletonText mx={2}>Fair Text Long Placeholder</SkeletonText>
Expand Down
2 changes: 1 addition & 1 deletion src/app/Scenes/Fair/FairOverview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const FairOverview: FC<FairOverviewProps> = ({ fair }) => {
return (
<Tabs.ScrollView style={{ paddingTop: space(2) }}>
{!isEmpty ? (
<Flex gap={space(2)}>
<Flex gap={2}>
{!!previewText && (
<ReadMore textStyle="new" content={previewText} maxChars={truncatedTextLimit()} />
)}
Expand Down
Loading

0 comments on commit ff385a9

Please sign in to comment.