chore: SideMenu accept className

This commit is contained in:
Roman Hotsiy 2018-07-26 18:00:30 +03:00
parent d74578dc9b
commit 873fe05a5d
No known key found for this signature in database
GPG Key ID: 5CB7B3ACABA57CB0
2 changed files with 7 additions and 3 deletions

View File

@ -12,15 +12,18 @@ export interface MenuItemsProps {
onActivate?: (item: IMenuItem) => void;
style?: React.CSSProperties;
root?: boolean;
className?: string;
}
@observer
export class MenuItems extends React.Component<MenuItemsProps> {
render() {
const { items, root } = this.props;
const { items, root, className } = this.props;
const active = this.props.active == null ? true : this.props.active;
return (
<MenuItemUl
className={className}
style={this.props.style}
active={active}
{...(root ? { role: 'navigation' } : {})}

View File

@ -9,7 +9,7 @@ import { PerfectScrollbar } from '../../common-elements/perfect-scrollbar';
import { RedocAttribution } from './styled.elements';
@observer
export class SideMenu extends React.Component<{ menu: MenuStore }> {
export class SideMenu extends React.Component<{ menu: MenuStore; className?: string }> {
private _updateScroll?: () => void;
render() {
@ -19,6 +19,7 @@ export class SideMenu extends React.Component<{ menu: MenuStore }> {
{options =>
options.nativeScrollbars ? (
<MenuItems
className={this.props.className}
style={{
overflow: 'auto',
msOverflowStyle: '-ms-autohiding-scrollbar',
@ -28,7 +29,7 @@ export class SideMenu extends React.Component<{ menu: MenuStore }> {
root={true}
/>
) : (
<PerfectScrollbar updateFn={this.saveScrollUpdate}>
<PerfectScrollbar updateFn={this.saveScrollUpdate} className={this.props.className}>
<MenuItems items={store.items} onActivate={this.activate} root={true} />
<RedocAttribution>
<a target="_blank" href="https://github.com/Rebilly/ReDoc">