spacehub

surshar / claude-code

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

Built by Anthropic · github.com/anthropics

claude-code / mods / diff / hooks / views / sections / list-row / list-row.tsx
40 lines · 975 BRaw
1/* @jsxRuntime classic */
2/* @jsx h */
3/* @jsxFrag Fragment */
4import type { RenderElement } from 'claude-code'
5
6import type { Kit } from '../../kit'
7import type { KeyedPressable } from '../keyed-pressable'
8
9/**
10 * One list row: a plain Button as wide as its label, a spacer, then the
11 * tail at the right edge (the counts, or a note).
12 *
13 * @param kit the elements
14 * @param row the Button's key, label, press, rest style and ring start
15 * @param tail what sits at the row's right edge
16 * @returns the row element
17 */
18export function listRow(
19 kit: Kit,
20 row: KeyedPressable,
21 tail: RenderElement,
22): RenderElement {
23 const { Box, Button } = kit.ui
24
25 return (
26 <Box flexDirection="row">
27 <Button
28 key={row.key}
29 plain
30 dimColor={row.isDim}
31 {...(row.isAutoFocus ? ({ autoFocus: true } as const) : {})}
32 onPress={row.onPress}
33 >
34 {row.label}
35 </Button>
36 <Box flexGrow={1} />
37 {tail}
38 </Box>
39 )
40}