Wrote color values component.
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
import { useContext } from "react";
|
||||
|
||||
import { MediaQueryContext } from "./MediaQueryProvider";
|
||||
import { SelectedColorContext } from "./SelectedColorProvider";
|
||||
|
||||
function useMediaQuery() {
|
||||
export function useMediaQuery() {
|
||||
const context = useContext(MediaQueryContext);
|
||||
if (context === undefined) {
|
||||
throw new Error("useMediaQuery must be used within a MediaQueryProvider");
|
||||
@@ -10,4 +11,10 @@ function useMediaQuery() {
|
||||
return context;
|
||||
}
|
||||
|
||||
export { useMediaQuery };
|
||||
export function useSelectedColor() {
|
||||
const context = useContext(SelectedColorContext);
|
||||
if (!context) {
|
||||
throw new Error("useColor must be used within a ColorProvider");
|
||||
}
|
||||
return context;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user