-
Notifications
You must be signed in to change notification settings - Fork 585
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into chore/palette
- Loading branch information
Showing
17 changed files
with
310 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { yupToFormErrors } from "formik" | ||
import { ArtworkFormValues } from "lib/Scenes/Consignments/v2/State/artworkModel" | ||
import * as Yup from "yup" | ||
|
||
export const artworkSchema = Yup.object().shape({ | ||
artist: Yup.string().test("artist", "Artist must be pablo picasso", value => value === "Pablo Picasso"), | ||
}) | ||
|
||
export function validateArtworkSchema(values: ArtworkFormValues) { | ||
let errors = {} | ||
try { | ||
artworkSchema.validateSync(values, { | ||
abortEarly: false, | ||
}) | ||
} catch (error) { | ||
errors = yupToFormErrors(error) | ||
} | ||
return errors | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { useFormikContext } from "formik" | ||
import { useEffect } from "react" | ||
import { ArtworkFormValues } from "../State/artworkModel" | ||
import { useStoreActions } from "../State/hooks" | ||
|
||
export function useFormikSync() { | ||
const artworkActions = useStoreActions(actions => actions.artwork) | ||
const formik = useFormikContext<ArtworkFormValues>() | ||
|
||
useEffect(() => { | ||
artworkActions.setFormValues(formik.values) | ||
}, [formik.values]) | ||
|
||
return formik | ||
} |
2 changes: 2 additions & 0 deletions
2
...onsignments/v2/Screens/MyCollectionAddArtwork/Mutations/MyCollectionAddArtworkMutation.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// TODO: Wire up real mutation | ||
export const MyCollectionAddArtworkMutation = `` |
2 changes: 2 additions & 0 deletions
2
...nsignments/v2/Screens/MyCollectionAddArtwork/Mutations/MyCollectionEditArtworkMutation.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// TODO: Wire up real mutation | ||
export const MyCollectionEditArtworkMutation = `` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 4 additions & 2 deletions
6
...ib/Scenes/Consignments/v2/Screens/MyCollectionArtworkDetail/MyCollectionArtworkDetail.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
import { Sans } from "@artsy/palette" | ||
import { Box, Sans } from "@artsy/palette" | ||
import { ScreenMargin } from "lib/Scenes/Consignments/v2/Components/ScreenMargin" | ||
import React from "react" | ||
|
||
export const MyCollectionArtworkDetail = () => { | ||
return ( | ||
<ScreenMargin> | ||
<Sans size="3">Artwork Detail</Sans> | ||
<Box m={4}> | ||
<Sans size="3">Artwork Detail</Sans> | ||
</Box> | ||
</ScreenMargin> | ||
) | ||
} |
6 changes: 4 additions & 2 deletions
6
src/lib/Scenes/Consignments/v2/Screens/MyCollectionArtworkList/MyCollectionArtworkList.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
import { Sans } from "@artsy/palette" | ||
import { Box, Sans } from "@artsy/palette" | ||
import { ScreenMargin } from "lib/Scenes/Consignments/v2/Components/ScreenMargin" | ||
import React from "react" | ||
|
||
export const MyCollectionArtworkList = () => { | ||
return ( | ||
<ScreenMargin> | ||
<Sans size="3">List View</Sans> | ||
<Box m={4}> | ||
<Sans size="3">List View</Sans> | ||
</Box> | ||
</ScreenMargin> | ||
) | ||
} |
Oops, something went wrong.