File size: 649 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
import { createContext, useContext } from 'react';
import { PatternTypeFilter } from 'calypso/my-sites/patterns/types';
type PatternsContextProps = {
searchTerm: string;
category: string;
isGridView: boolean;
section: string | null;
patternPermalinkId?: number;
patternTypeFilter: PatternTypeFilter;
referrer?: string;
};
export const PatternsContext = createContext< PatternsContextProps >( {
searchTerm: '',
category: '',
isGridView: false,
section: null,
patternPermalinkId: undefined,
patternTypeFilter: PatternTypeFilter.REGULAR,
referrer: undefined,
} );
export const usePatternsContext = () => useContext( PatternsContext );
|