MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / ModeDivider

Function ModeDivider

cli/src/components/mode-divider.tsx:13–43  ·  view source on GitHub ↗
({ mode, width }: ModeDividerProps)

Source from the content-addressed store, hash-verified

11}
12
13export const ModeDivider = ({ mode, width }: ModeDividerProps) => {
14 if (IS_FREEBUFF) return null
15
16 const theme = useTheme()
17
18 const label = ` ${mode} `
19 const labelWidth = stringWidth(label)
20 const lineWidth = Math.max(0, Math.floor((width - labelWidth) / 2))
21 const leftLine = '─'.repeat(lineWidth)
22 const rightLine = '─'.repeat(Math.max(0, width - lineWidth - labelWidth))
23
24 return (
25 <box
26 style={{
27 width: '100%',
28 flexDirection: 'row',
29 justifyContent: 'center',
30 paddingTop: 1,
31 paddingBottom: 1,
32 }}
33 >
34 <text style={{ wrapMode: 'none' }}>
35 <span fg={theme.border}>{leftLine}</span>
36 <span fg={theme.foreground} attributes={TextAttributes.BOLD}>
37 {label}
38 </span>
39 <span fg={theme.border}>{rightLine}</span>
40 </text>
41 </box>
42 )
43}

Callers

nothing calls this directly

Calls 1

useThemeFunction · 0.90

Tested by

no test coverage detected