/
bottom-nav-item.tsx
62 lines (49 loc) · 1.43 KB
/
bottom-nav-item.tsx
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
62
import { classNames, stateClassNames, States } from '../utils';
import { Icon } from '../icon';
const BOTTOM_NAV_ITEM_CLASSNAME = 'k-bottom-nav-item';
const states = [
States.focus,
States.selected,
States.disabled
];
const options = {};
export type KendoBottomNavItemProps = {
icon?: string;
text?: string;
link?: string;
};
export type KendoBottomNavItemState = { [K in (typeof states)[number]]?: boolean };
const defaultProps = {};
export const BottomNavItem = (
props: KendoBottomNavItemProps &
KendoBottomNavItemState &
React.HTMLAttributes<HTMLSpanElement>
) => {
const {
focus,
selected,
disabled,
icon,
text,
link
} = props;
return (
<span className={classNames(
BOTTOM_NAV_ITEM_CLASSNAME,
stateClassNames(BOTTOM_NAV_ITEM_CLASSNAME, {
focus,
selected,
disabled
})
)}>
{ icon && <Icon className="k-bottom-nav-item-icon" icon={icon} size="xlarge" /> }
{ text && <span className="k-bottom-nav-item-text">{text}</span> }
{ link && <div className="k-bottom-nav-link"><span>{link}</span></div> }
</span>
);
};
BottomNavItem.states = states;
BottomNavItem.options = options;
BottomNavItem.className = BOTTOM_NAV_ITEM_CLASSNAME;
BottomNavItem.defaultProps = defaultProps;
export default BottomNavItem;