@intility/bifrost-react-select
Version:
React select component for Intility's design system, Bifrost.
31 lines (30 loc) • 1.25 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { components } from "react-select";
import { faSquare } from "@fortawesome/free-regular-svg-icons/faSquare";
import { faCheckSquare } from "@fortawesome/free-solid-svg-icons/faCheckSquare";
import { faCheck } from "@fortawesome/free-solid-svg-icons/faCheck";
import { Icon } from "@intility/bifrost-react";
const CustomOption = (props)=>{
return /*#__PURE__*/ _jsxs(components.Option, {
...props,
children: [
props.isMulti && /*#__PURE__*/ _jsx("div", {
children: /*#__PURE__*/ _jsx(Icon, {
icon: props.isSelected ? faCheckSquare : faSquare,
fixedWidth: true,
marginRight: true,
color: props.isSelected ? "var(--bfc-theme)" : "var(--bfc-base-c-2)"
})
}),
props.children,
!props.isMulti && props.isSelected && /*#__PURE__*/ _jsx("div", {
children: /*#__PURE__*/ _jsx(Icon, {
icon: faCheck,
fixedWidth: true,
className: "bf-select-selected-icon"
})
})
]
});
};
export default CustomOption;