All Downloads are FREE. Search and download functionalities are using the official Maven repository.

components.snippets.Alerts.Alerts.jsx Maven / Gradle / Ivy

The newest version!
import React, { useContext } from 'react'
import PropTypes from 'prop-types'

import { FactoryContext } from '../../../core/factory/context'
import { SNIPPETS } from '../../../core/factory/factoryLevels'

/**
 * Маппер для Alert
 * supported placements ['topLeft', 'top', 'topRight', 'bottomLeft', 'bottom', 'bottomRight']
 */

function AlertsByPlacement({ alerts, placement }) {
    const { getComponent } = useContext(FactoryContext)

    return alerts.filter(({ placement: alertPlacement }) => alertPlacement === placement)
        .map((props) => {
            const Alert = getComponent('Alert', SNIPPETS)

            return 
        })
}

AlertsByPlacement.propTYpes = {
    alerts: PropTypes.array,
    placement: PropTypes.string,
}

export function Alerts({ alerts = [], placements }) {
    return (
        
{placements.map( placement => (
), )}
) } Alerts.propTypes = { alerts: PropTypes.array, placements: PropTypes.array, } export default Alerts




© 2015 - 2024 Weber Informatics LLC | Privacy Policy