UNPKG

@nexusui/components

Version:

These are custom components specially-developed for NexusUI applications. They will make your life easier by giving you out-of-the-box implementations for various high-level UI elements that you can drop directly into your application.

2 lines (1 loc) 334 B
import{jsxs as e,Fragment as t,jsx as r}from"react/jsx-runtime";const i=({text:i,highlight:n=""})=>{if(!n)return i;const o=n.toLowerCase(),c=i.toLowerCase().indexOf(o);if(-1===c)return i;const s=i.slice(0,c),l=i.slice(c,c+n.length),h=i.slice(c+n.length);return e(t,{children:[s,r("b",{children:l}),h]})};export{i as TextHighlighter};