This repository has been archived by the owner on May 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 72
/
propTypes.js
61 lines (54 loc) · 1.54 KB
/
propTypes.js
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import PropTypes from 'prop-types';
import { UtilityUtils } from 'terra-application-utility';
/**
* Shape for the `layoutConfig` prop provided to components within the ApplicationLayout.
*/
const layoutConfigPropType = PropTypes.shape({
size: PropTypes.string,
toggleMenu: PropTypes.func,
menuIsOpen: PropTypes.bool,
togglePin: PropTypes.bool,
menuIsPinned: PropTypes.bool,
});
/**
* Shape for ApplicationLayout's `nameConfig` prop.
*/
const nameConfigPropType = PropTypes.shape({
accessory: PropTypes.element,
title: PropTypes.string,
});
/**
* Alignment of the navigational tabs.
*/
const navigationAlignmentPropType = PropTypes.oneOf(['start', 'center', 'end']);
/**
* Shape for ApplicationLayout's `navigationItems` prop.
*/
const navigationItemsPropType = PropTypes.arrayOf(PropTypes.shape({
path: PropTypes.string.isRequired,
text: PropTypes.string.isRequired,
hasSubMenu: PropTypes.bool,
icon: PropTypes.node,
}));
/**
* Shape for ApplicationLayout's `utilityConfig` prop.
*/
const utilityConfigPropType = PropTypes.shape({
title: PropTypes.string,
accessory: PropTypes.element,
onChange: PropTypes.func.isRequired,
menuItems: PropTypes.arrayOf(UtilityUtils.itemShape).isRequired,
initialSelectedKey: PropTypes.string.isRequired,
});
/**
* Shape for utilityConfig's menuItem.
*/
const utilityMenuItemPropType = UtilityUtils.itemShape;
export default {
utilityConfigPropType,
utilityMenuItemPropType,
layoutConfigPropType,
nameConfigPropType,
navigationAlignmentPropType,
navigationItemsPropType,
};