chore: adds schema path to useFieldPath provider, more passing tests
This commit is contained in:
@@ -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 = () => {
|
||||
|
||||
Reference in New Issue
Block a user