import React, { Component, createRef, HTMLAttributes } from 'react';
import { classNames } from '../../lib/classNames';
export interface SplitColContextProps {
colRef: React.RefObject;
animate: boolean;
}
export const SplitColContext = React.createContext({
colRef: null,
animate: true,
});
export interface SplitColProps extends HTMLAttributes {
width?: string;
maxWidth?: string;
minWidth?: string;
/**
* Если false, то переходы между Panel происходят без анимации
*/
animate?: boolean;
/**
* Если true, то добавляются боковые отступы фиксированной величины
*/
spaced?: boolean;
fixed?: boolean;
}
export class SplitCol extends Component {
static defaultProps = {
animate: false,
};
baseRef: React.RefObject = createRef();
getContext() {
return {
colRef: this.baseRef,
animate: this.props.animate,
};
}
render() {
const { children, width, maxWidth, minWidth, spaced, className, animate, fixed, style, ...restProps } = this.props;
return (
{fixed ? {children}
: children}
);
}
}