@awsui/components-react
Version:
On July 19th, 2022, we launched [Cloudscape Design System](https://cloudscape.design). Cloudscape is an evolution of AWS-UI. It consists of user interface guidelines, front-end components, design resources, and development tools for building intuitive, en
39 lines • 1.47 kB
JavaScript
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { getAppLayoutInitialMessages, getAppLayoutMessageHandler, pushInitialMessage } from './core';
/**
* Registers a new left runtime drawer to app layout
* @param drawer
*/
export function registerLeftDrawer(drawer) {
var _a;
const message = { type: 'registerLeftDrawer', payload: drawer };
pushInitialMessage(message);
(_a = getAppLayoutMessageHandler()) === null || _a === void 0 ? void 0 : _a(message);
}
/**
* Registers a new bottom runtime drawer to app layout
* @param drawer
*/
export function registerBottomDrawer(drawer) {
var _a;
const message = { type: 'registerBottomDrawer', payload: { ...drawer, position: 'bottom' } };
pushInitialMessage(message);
(_a = getAppLayoutMessageHandler()) === null || _a === void 0 ? void 0 : _a(message);
}
/**
* Interact with already registered app layout drawers
* @param message
*/
export function updateDrawer(message) {
var _a;
if (message.type === 'updateDrawerConfig') {
getAppLayoutInitialMessages().forEach(initialMessage => {
if (initialMessage.payload.id === message.payload.id) {
initialMessage.payload = { ...initialMessage.payload, ...message.payload };
}
});
}
(_a = getAppLayoutMessageHandler()) === null || _a === void 0 ? void 0 : _a(message);
}
//# sourceMappingURL=index.js.map