Skip to content

Commit

Permalink
fix(singletons): fix build issues and move CalendarContext interface …
Browse files Browse the repository at this point in the history
…back
  • Loading branch information
binoy14 committed Apr 29, 2024
1 parent 548952e commit b3de008
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import {createContext} from 'react'
import type {PortableTextMemberItem} from 'sanity'

/**
* @internal
*/
export const PortableTextMemberItemsContext = createContext<PortableTextMemberItem[]>([])
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import {createContext} from 'react'
import type {FormNodePresence} from 'sanity'

/**
* @internal
*/
export const PresenceContext = createContext<FormNodePresence[]>([])
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
import {createContext} from 'react'

export interface CalendarContextValue {
date?: Date
endDate?: Date
focusedDate: Date
selectRange?: boolean
selectTime?: boolean

/**
* An integer indicating the first day of the week.
* Can be either 1 (Monday) or 7 (Sunday).
*/
firstWeekDay: 1 | 7
}
import type {CalendarContextValue} from '../../../../../../../../../../../../core/studio/components/navbar/search/components/filters/filter/inputs/date/datePicker/calendar/contexts/CalendarContext'

/**
* @internal
*/
export const CalendarContext = createContext<CalendarContextValue | undefined>(undefined)
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import {createContext} from 'react'
import type {UserColorManager} from 'sanity'

/**
* @internal
*/
export const UserColorManagerContext = createContext<UserColorManager | null>(null)
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export interface CalendarContextValue {
date?: Date
endDate?: Date
focusedDate: Date
selectRange?: boolean
selectTime?: boolean

/**
* An integer indicating the first day of the week.
* Can be either 1 (Monday) or 7 (Sunday).
*/
firstWeekDay: 1 | 7
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import {useContext} from 'react'
import {CalendarContext, type CalendarContextValue} from 'sanity/_singletons'
import {CalendarContext} from 'sanity/_singletons'

import {type CalendarContextValue} from './CalendarContext'

export function useCalendar(): CalendarContextValue {
const context = useContext(CalendarContext)
Expand Down

0 comments on commit b3de008

Please sign in to comment.