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 / toggle-row.tsx
32 lines · 819 BRaw
1/* @jsxRuntime classic */
2/* @jsx h */
3/* @jsxFrag Fragment */
4import type { RenderElement } from 'claude-code'
5
6import type { Kit } from '../kit'
7import type { Pressable } from './pressable'
8
9/**
10 * A clickable line that shows or hides a group (ReplDiffSidebar's
11 * NoiseFilterToggle and pre-session header), as a plain Button.
12 *
13 * @param kit the drawing's kit; its elements draw the row
14 * @param key the Button's address
15 * @param pressable the line's text, `(show)` or `(hide)` in it, and its press
16 * @returns the row
17 */
18export function toggleRow(
19 kit: Kit,
20 key: string,
21 pressable: Pressable,
22): RenderElement {
23 const { Box, Button } = kit.ui
24
25 return (
26 <Box flexDirection="row">
27 <Button key={key} plain onPress={pressable.onPress}>
28 {pressable.label}
29 </Button>
30 </Box>
31 )
32}