mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-22 16:25:51 +00:00
This reverts commit c445f43f8d.
This commit is contained in:
@@ -1,71 +0,0 @@
|
||||
import React from 'react'
|
||||
import { Box, Text } from '../index.js'
|
||||
|
||||
type Props = {
|
||||
query: string
|
||||
placeholder?: string
|
||||
isFocused: boolean
|
||||
isTerminalFocused: boolean
|
||||
prefix?: string
|
||||
width?: number | string
|
||||
cursorOffset?: number
|
||||
borderless?: boolean
|
||||
}
|
||||
|
||||
export function SearchBox({
|
||||
query,
|
||||
placeholder = 'Search…',
|
||||
isFocused,
|
||||
isTerminalFocused,
|
||||
prefix = '\u2315',
|
||||
width,
|
||||
cursorOffset,
|
||||
borderless = false,
|
||||
}: Props): React.ReactNode {
|
||||
const offset = cursorOffset ?? query.length
|
||||
|
||||
return (
|
||||
<Box
|
||||
flexShrink={0}
|
||||
borderStyle={borderless ? undefined : 'round'}
|
||||
borderColor={isFocused ? 'suggestion' : undefined}
|
||||
borderDimColor={!isFocused}
|
||||
paddingX={borderless ? 0 : 1}
|
||||
width={width}
|
||||
>
|
||||
<Text dimColor={!isFocused}>
|
||||
{prefix}{' '}
|
||||
{isFocused ? (
|
||||
<>
|
||||
{query ? (
|
||||
isTerminalFocused ? (
|
||||
<>
|
||||
<Text>{query.slice(0, offset)}</Text>
|
||||
<Text inverse>
|
||||
{offset < query.length ? query[offset] : ' '}
|
||||
</Text>
|
||||
{offset < query.length && (
|
||||
<Text>{query.slice(offset + 1)}</Text>
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
<Text>{query}</Text>
|
||||
)
|
||||
) : isTerminalFocused ? (
|
||||
<>
|
||||
<Text inverse>{placeholder.charAt(0)}</Text>
|
||||
<Text dimColor>{placeholder.slice(1)}</Text>
|
||||
</>
|
||||
) : (
|
||||
<Text dimColor>{placeholder}</Text>
|
||||
)}
|
||||
</>
|
||||
) : query ? (
|
||||
<Text>{query}</Text>
|
||||
) : (
|
||||
<Text>{placeholder}</Text>
|
||||
)}
|
||||
</Text>
|
||||
</Box>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user