import {FunctionComponent} from 'react';
import {renderForeground} from '@core0/utils';
import {SnackbarRef} from './snackbar-ref';
import cn from './snackbar.module.styl';

export interface SnackbarProps {
    refList: SnackbarRef[];
}

export const Snackbar: FunctionComponent<SnackbarProps> = props => {
    const {refList} = props;

    return renderForeground(
        <div className={cn.snackbar}>
            {refList.map((elm) => (
                <elm.SnackbarComponent key={elm.reactKey} />
            ))}
        </div>
    );
};
