29 lines
669 B
TypeScript
29 lines
669 B
TypeScript
import * as React from 'react';
|
|
|
|
interface IMenuFirstLevelNav {
|
|
updateMenu(id: number): void;
|
|
|
|
items: any[];
|
|
activeId?: Number;
|
|
}
|
|
|
|
export function FirstLevelNav(props: IMenuFirstLevelNav) {
|
|
|
|
const rawResult = props.items.slice(0, 3);
|
|
const items: any[] = [];
|
|
rawResult.forEach((item) => {
|
|
items.push(
|
|
<a className={props.activeId == item.id ? 'sections-responsive-tabitem active' : 'sections-responsive-tabitem'} key={item.id}
|
|
onClick={() => props.updateMenu(item.id)}>
|
|
{item.name}
|
|
</a>
|
|
);
|
|
});
|
|
|
|
return (
|
|
<div className="sections-responsive-tabs">
|
|
{items}
|
|
</div>
|
|
);
|
|
}
|