UNPKG

@react-md/app-bar

Version:

This small package implments the AppBar spec in material design.

41 lines 1.41 kB
import { createContext, useContext } from "react"; /** * Boolean if the child components should inherit the color of the app bar. * @internal */ export var InheritContext = createContext(false); /** * This is probably a bit overkill... but this is used so that all the AppBar * child components can automatically inherit the base color as needed within an * AppBar. If the `inheritColor` prop was provided to the component, that value * will be used instead. * * @param inheritColor - The prop inheritColor for the component * @returns true if the color should be inherited. * @internal */ export function useInheritContext(inheritColor) { var inheritContext = useContext(InheritContext); return typeof inheritColor === "boolean" ? inheritColor : inheritContext; } /** * Boolean if there is a parent app bar. The theme colors will be inherited from * the parent app bar instead of the current app bar for these cases since * nested app bars usually happen with prominent toolbars and the root app bar * defines the theme. * * @internal */ export var ParentContext = createContext(false); /** * * @internal */ export function useParentContext() { return useContext(ParentContext); } if (process.env.NODE_ENV !== "production") { InheritContext.displayName = "InheritColorContext"; ParentContext.displayName = "ParentContext"; } //# sourceMappingURL=useInheritContext.js.map