51 lines
1.3 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
Парус 8 - Панели мониторинга - Редактор запросов
Компоненты: Сущность запроса
*/
//---------------------
//Подключение библиотек
//---------------------
import React from "react"; //Классы React
import PropTypes from "prop-types"; //Контроль свойств компонента
import "./entity.css"; //Стили компомнента
//---------
//Константы
//---------
//Структура данных о сущности запроса
const ENTITY_DATA_SHAPE = PropTypes.shape({
name: PropTypes.string.isRequired,
title: PropTypes.string.isRequired
});
//-----------
//Тело модуля
//-----------
//Сущность запроса
const Entity = ({ data, selected }) => {
return (
<div className="entity__wrapper" data-selected={selected}>
<div className="entity__title">
<span>{data.title}</span>
<div className="entity__name">{data.name}</div>
</div>
</div>
);
};
//Контроль свойств компонента - Сущность запроса
Entity.propTypes = {
data: ENTITY_DATA_SHAPE,
selected: PropTypes.bool.isRequired
};
//----------------
//Интерфейс модуля
//----------------
export { Entity };