Skip to content

Commit

Permalink
Breaking: rename context to SchedulerContext
Browse files Browse the repository at this point in the history
  • Loading branch information
forabi committed Mar 22, 2019
1 parent 102cd05 commit 4ee74c5
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions demo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import ReactDOM from 'react-dom';
import 'resize-observer-polyfill/dist/ResizeObserver.global';
import useUndo from 'use-undo';
import { TimeGridScheduler } from '../src/components/TimeGridScheduler';
import { dateFnsContext } from '../src/context';
import { SchedulerContext } from '../src/context';
import { useMousetrap } from '../src/hooks/useMousetrap';
import { classes as defaultClasses } from '../src/styles';
import { EventRootProps, ScheduleType } from '../src/types';
Expand Down Expand Up @@ -266,7 +266,7 @@ function App() {
}}
>
<Fragment key={`${cellHeight},${cellWidth}`}>
<dateFnsContext.Provider value={{ locale: locales[locale] }}>
<SchedulerContext.Provider value={{ locale: locales[locale] }}>
<TimeGridScheduler
key={originDate.toString()}
classes={classes}
Expand All @@ -278,7 +278,7 @@ function App() {
eventRootComponent={EventRoot}
disabled={disabled}
/>
</dateFnsContext.Provider>
</SchedulerContext.Provider>
</Fragment>
</CustomProperties>
</>
Expand Down
4 changes: 2 additions & 2 deletions src/components/EventContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import VisuallyHidden from '@reach/visually-hidden';
import format from 'date-fns/format';
import React, { useContext } from 'react';
import { dateFnsContext } from '../context';
import { SchedulerContext } from '../context';
import { ClassNames } from '../types';
import { getTextForDateRange } from '../utils/getTextForDateRange';

Expand All @@ -23,7 +23,7 @@ export const EventContent = React.memo(function EventContent({
isStart,
isEnd,
}: EventContentProps) {
const { locale } = useContext(dateFnsContext);
const { locale } = useContext(SchedulerContext);

return (
<div
Expand Down
2 changes: 1 addition & 1 deletion src/context.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import en from 'date-fns/locale/en';
import { createContext } from 'react';

export const dateFnsContext = createContext({ locale: en });
export const SchedulerContext = createContext({ locale: en });
4 changes: 2 additions & 2 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { TimeGridScheduler } from './components/TimeGridScheduler';
import { dateFnsContext } from './context';
import { SchedulerContext } from './context';
import { useMousetrap } from './hooks/useMousetrap';
import { classes } from './styles';

export { TimeGridScheduler, classes, useMousetrap, dateFnsContext };
export { TimeGridScheduler, classes, useMousetrap, SchedulerContext };

0 comments on commit 4ee74c5

Please sign in to comment.