chore: adds schema path to useFieldPath provider, more passing tests

This commit is contained in:
Jarrod Flesch
2024-02-20 15:56:11 -05:00
parent 726596d568
commit a5e2fa80e8
58 changed files with 483 additions and 316 deletions

View File

@@ -1,15 +1,32 @@
'use client'
import React from 'react'
const FieldPathContext = React.createContext<string>('')
type FieldPathContextType = {
path: string
schemaPath: string
}
const FieldPathContext = React.createContext<FieldPathContextType>({
path: '',
schemaPath: '',
})
export const FieldPathProvider: React.FC<{
path: string
schemaPath: string
children: React.ReactNode
}> = (props) => {
const { children, path } = props
const { children, path, schemaPath } = props
return <FieldPathContext.Provider value={path}>{children}</FieldPathContext.Provider>
return (
<FieldPathContext.Provider
value={{
path,
schemaPath,
}}
>
{children}
</FieldPathContext.Provider>
)
}
export const useFieldPath = () => {