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

components.widgets.Table.cells.IconCell.IconCell.tsx Maven / Gradle / Ivy

There is a newer version: 7.28.2
Show newest version
import React from 'react'
import classNames from 'classnames'
import isUndefined from 'lodash/isUndefined'
import get from 'lodash/get'

import { Text } from '../../../../snippets/Text/Text'
import { Icon } from '../../../../snippets/Icon/Icon'
import { withTooltip } from '../../withTooltip'

import { type Props, ICON_POSITION } from './types'

/**
 * Ячейка таблицы с иконкой
 * @reactProps {string} id - id ячейки
 * @reactProps {object} model - модель строки
 * @reactProps {string} icon - класс иконки
 * @reactProps {string} iconPosition - расположение кнопки относительно текста
 * @reactProps {string | undefined} className - дополнительный класс для ячейки
 */
function IconCellBody({
    id,
    model,
    icon,
    forwardedRef,
    style,
    className,
    iconPosition = ICON_POSITION.LEFT,
    visible = true,
}: Props) {
    if (!visible) { return null }
    const text = get(model, id) as string

    return (
        
{icon && } {text &&
}
) } export const IconCell = withTooltip(IconCellBody) export default IconCell




© 2015 - 2025 Weber Informatics LLC | Privacy Policy