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

View File

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