import * as React from 'react'; import _ from 'lodash'; import styles from './styles.module.scss'; import { If } from 'react-if'; import contrast from 'contrast'; import { computed, makeObservable } from 'mobx'; export interface IPillTagProps { content: JSX.Element | string; backgroundColor: string; infoSection?: JSX.Element | null; onDelete?: () => void; } export class PillTag extends React.Component { constructor(props: IPillTagProps) { super(props); makeObservable(this); } @computed get contentColor() { let _contrast = contrast(this.props.backgroundColor); if (_contrast === 'light') { return '#000'; } else { return '#fff'; } } render() { return (
{this.props.content} {this.props.infoSection}
); } }