MCPcopy Index your code
hub / github.com/reactstrap/reactstrap / render

Method render

src/DropdownItem.js:61–113  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

59 }
60
61 render() {
62 const tabIndex = this.getTabIndex();
63 const role = tabIndex > -1 ? this.getRole() : undefined;
64 let {
65 className,
66 cssModule,
67 divider,
68 tag: Tag = 'button',
69 header,
70 active,
71 text,
72 ...props
73 } = omit(this.props, ['toggle']);
74
75 const classes = mapToCssModules(
76 classNames(className, {
77 disabled: props.disabled,
78 'dropdown-item': !divider && !header && !text,
79 active: active,
80 'dropdown-header': header,
81 'dropdown-divider': divider,
82 'dropdown-item-text': text,
83 }),
84 cssModule,
85 );
86
87 if (Tag === 'button') {
88 if (header) {
89 Tag = 'h6';
90 } else if (divider) {
91 Tag = 'div';
92 } else if (props.href) {
93 Tag = 'a';
94 } else if (text) {
95 Tag = 'span';
96 }
97 }
98
99 return (
100 <Tag
101 type={
102 Tag === 'button' && (props.onClick || this.props.toggle)
103 ? 'button'
104 : undefined
105 }
106 {...props}
107 tabIndex={tabIndex}
108 role={role}
109 className={classes}
110 onClick={this.onClick}
111 />
112 );
113 }
114}
115
116DropdownItem.propTypes = propTypes;

Callers

nothing calls this directly

Calls 4

getTabIndexMethod · 0.95
getRoleMethod · 0.95
omitFunction · 0.90
mapToCssModulesFunction · 0.90

Tested by

no test coverage detected