MCPcopy Create free account
hub / github.com/anus-dev/ANUS / PrepareLabel

Function PrepareLabel

packages/cli/src/ui/components/PrepareLabel.tsx:20–49  ·  view source on GitHub ↗
({
  label,
  matchedIndex,
  userInput,
  textColor,
  highlightColor = Colors.AccentYellow,
})

Source from the content-addressed store, hash-verified

18}
19
20export const PrepareLabel: React.FC<PrepareLabelProps> = ({
21 label,
22 matchedIndex,
23 userInput,
24 textColor,
25 highlightColor = Colors.AccentYellow,
26}) => {
27 if (
28 matchedIndex === undefined ||
29 matchedIndex < 0 ||
30 matchedIndex >= label.length ||
31 userInput.length === 0
32 ) {
33 return <Text color={textColor}>{label}</Text>;
34 }
35
36 const start = label.slice(0, matchedIndex);
37 const match = label.slice(matchedIndex, matchedIndex + userInput.length);
38 const end = label.slice(matchedIndex + userInput.length);
39
40 return (
41 <Text>
42 <Text color={textColor}>{start}</Text>
43 <Text color="black" bold backgroundColor={highlightColor}>
44 {match}
45 </Text>
46 <Text color={textColor}>{end}</Text>
47 </Text>
48 );
49};

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected