mirror of
https://github.com/prymitive/karma
synced 2026-05-21 04:33:07 +00:00
Merge into a single function since both className & style are tied together and as such are better of if selected using a single logic. Fixes some minor UI glitches like ellipsis color on truncated labels with custom color
41 lines
1.0 KiB
JavaScript
41 lines
1.0 KiB
JavaScript
import React from "react";
|
|
import PropTypes from "prop-types";
|
|
|
|
import { observer } from "mobx-react";
|
|
|
|
import { QueryOperators } from "Common/Query";
|
|
import { AlertStore } from "Stores/AlertStore";
|
|
import { BaseLabel } from "Components/Labels/BaseLabel";
|
|
|
|
import "./index.css";
|
|
|
|
const HistoryLabel = observer(
|
|
class HistoryLabel extends BaseLabel {
|
|
static propTypes = {
|
|
alertStore: PropTypes.instanceOf(AlertStore).isRequired,
|
|
name: PropTypes.string.isRequired,
|
|
value: PropTypes.string.isRequired,
|
|
matcher: PropTypes.string.isRequired
|
|
};
|
|
|
|
render() {
|
|
const { name, matcher, value } = this.props;
|
|
|
|
let cs = this.getClassAndStyle(
|
|
matcher === QueryOperators.Equal ? name : "",
|
|
matcher === QueryOperators.Equal ? value : "",
|
|
"components-label-history components-label-value"
|
|
);
|
|
|
|
return (
|
|
<span className={cs.className} style={cs.style}>
|
|
{name ? `${name}${matcher}` : null}
|
|
{value}
|
|
</span>
|
|
);
|
|
}
|
|
}
|
|
);
|
|
|
|
export { HistoryLabel };
|