azure-devops-ui
Version:
React components for building web UI in Azure DevOps
17 lines (16 loc) • 988 B
JavaScript
import "../../CommonImports";
import "../../Core/core.css";
import "./ColorSwatchPicker.css";
import * as React from "react";
import { ColorPip } from "../ColorPip/ColorPip";
import { FocusZone, FocusZoneDirection } from '../../FocusZone';
import { css } from '../../Util';
import { Observer } from '../../Observer';
export const ColorSwatchPicker = props => {
const { colors, className, onPipClick, selectedIndex } = props;
return (React.createElement(FocusZone, { activateOnEnter: true, direction: FocusZoneDirection.Horizontal },
React.createElement("div", { className: css("bolt-colorswatchpicker flex-row", className) },
React.createElement(Observer, { selectedIndex: selectedIndex }, (props) => colors.map((value, index) => {
return (React.createElement(ColorPip, { key: index, color: value, isSelected: props.selectedIndex === index, onClick: (event, color) => onPipClick(event, color, index) }));
})))));
};