UNPKG

azure-devops-ui

Version:

React components for building web UI in Azure DevOps

1 lines 960 B
import{__extends}from"tslib";import"../../CommonImports";import"../../Core/core.css";import"./ColorPip.css";import*as React from"react";import{getColorString}from"../../Utilities/Color";import{FocusZoneContext}from"../../FocusZone";import{css}from"../../Util";var ColorPip=function(o){function t(){var t=null!==o&&o.apply(this,arguments)||this;return t.rootRef=React.createRef(),t.onClick=function(o){t.props.onClick&&t.props.onClick(o,t.props.color)},t}return __extends(t,o),t.prototype.render=function(){var t=this,o=this.props,e=o.className,r=o.color,n=o.isSelected;return React.createElement(FocusZoneContext.Consumer,null,function(o){return React.createElement("div",{ref:t.rootRef,className:css(e,"bolt-colorpip"),onClick:t.onClick,"data-focuszone":o.focuszoneId,tabIndex:n?0:-1},React.createElement("div",{className:css("bolt-colorpip-content",n&&"selected"),style:r?{backgroundColor:getColorString(r)}:void 0}))})},t}(React.Component);export{ColorPip};