import React from 'react';
import { childrenInsertProps } from '../utils/Utils';

class WizardFooter extends React.Component{
    _dom = null;
    _propsWithoutChildren = {};
    constructor(props){
        super(props);

        if(this.props.registerFooter){
            this.props.registerFooter(this);
        }

        this._propsWithoutChildren = {...this.props};
        delete this._propsWithoutChildren.children;
        delete this._propsWithoutChildren.registerFooter;
    }

    get dom(){
        return this._dom
    }

    render(){
        return (
            <div ref={el => {this._dom = el}}>
                {childrenInsertProps(this.props.children, this._propsWithoutChildren)}
            </div>
        );
    }
}

export default WizardFooter;
