UNPKG

@react-md/app-bar

Version:

This small package implments the AppBar spec in material design.

46 lines 1.74 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.useParentContext = exports.ParentContext = exports.useInheritContext = exports.InheritContext = void 0; var react_1 = require("react"); /** * Boolean if the child components should inherit the color of the app bar. * @internal */ exports.InheritContext = (0, react_1.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 */ function useInheritContext(inheritColor) { var inheritContext = (0, react_1.useContext)(exports.InheritContext); return typeof inheritColor === "boolean" ? inheritColor : inheritContext; } exports.useInheritContext = useInheritContext; /** * 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 */ exports.ParentContext = (0, react_1.createContext)(false); /** * * @internal */ function useParentContext() { return (0, react_1.useContext)(exports.ParentContext); } exports.useParentContext = useParentContext; if (process.env.NODE_ENV !== "production") { exports.InheritContext.displayName = "InheritColorContext"; exports.ParentContext.displayName = "ParentContext"; } //# sourceMappingURL=useInheritContext.js.map