mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-13 04:16:34 +03:00
chore: SideMenu accept className
This commit is contained in:
parent
d74578dc9b
commit
873fe05a5d
|
@ -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' } : {})}
|
||||||
|
|
|
@ -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">
|
||||||
|
|
Loading…
Reference in New Issue
Block a user