Skip to content

Commit 2c9e1ef

Browse files
committed
Improve the build mode buttons
1 parent 0113925 commit 2c9e1ef

File tree

1 file changed

+26
-13
lines changed

1 file changed

+26
-13
lines changed

cli/src/components/build-mode-buttons.tsx

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { useState } from 'react'
22
import type { ChatTheme } from '../types/theme-system'
3-
3+
import { BORDER_CHARS } from '../utils/ui-constants'
4+
import { useTerminalDimensions } from '../hooks/use-terminal-dimensions'
45
export const BuildModeButtons = ({
56
theme,
67
onBuildFast,
@@ -10,20 +11,28 @@ export const BuildModeButtons = ({
1011
onBuildFast: () => void
1112
onBuildMax: () => void
1213
}) => {
13-
const [hoveredButton, setHoveredButton] = useState<'fast' | 'max' | null>(null)
14+
const [hoveredButton, setHoveredButton] = useState<'fast' | 'max' | null>(
15+
null,
16+
)
17+
const { terminalWidth } = useTerminalDimensions()
18+
const isNarrow = terminalWidth < 55
1419
return (
1520
<box
1621
style={{
17-
flexDirection: 'column',
18-
gap: 0,
19-
paddingTop: 1,
20-
paddingBottom: 1,
22+
flexDirection: 'row',
23+
gap: 1,
24+
paddingTop: 0,
25+
paddingBottom: 0,
2126
paddingLeft: 1,
27+
alignItems: 'center',
28+
justifyContent: 'space-between',
2229
}}
2330
>
24-
<text style={{ wrapMode: 'none', marginBottom: 1 }}>
25-
<span fg={theme.secondary}>Ready to build? Choose your mode:</span>
26-
</text>
31+
{isNarrow ? null : (
32+
<text style={{ wrapMode: 'none' }}>
33+
<span fg={theme.secondary}>Ready to build?</span>
34+
</text>
35+
)}
2736
<box
2837
style={{
2938
flexDirection: 'row',
@@ -37,14 +46,16 @@ export const BuildModeButtons = ({
3746
paddingLeft: 2,
3847
paddingRight: 2,
3948
borderStyle: 'single',
40-
borderColor: hoveredButton === 'fast' ? '#ffffff' : theme.secondary,
49+
borderColor:
50+
hoveredButton === 'fast' ? theme.foreground : theme.secondary,
51+
customBorderChars: BORDER_CHARS,
4152
}}
4253
onMouseDown={onBuildFast}
4354
onMouseOver={() => setHoveredButton('fast')}
4455
onMouseOut={() => setHoveredButton(null)}
4556
>
4657
<text wrapMode="none">
47-
<span fg="#ffffff">Build FAST</span>
58+
<span fg={theme.foreground}>Build FAST</span>
4859
</text>
4960
</box>
5061
<box
@@ -54,14 +65,16 @@ export const BuildModeButtons = ({
5465
paddingLeft: 2,
5566
paddingRight: 2,
5667
borderStyle: 'single',
57-
borderColor: hoveredButton === 'max' ? '#ffffff' : theme.secondary,
68+
borderColor:
69+
hoveredButton === 'max' ? theme.foreground : theme.secondary,
70+
customBorderChars: BORDER_CHARS,
5871
}}
5972
onMouseDown={onBuildMax}
6073
onMouseOver={() => setHoveredButton('max')}
6174
onMouseOut={() => setHoveredButton(null)}
6275
>
6376
<text wrapMode="none">
64-
<span fg="#ffffff">Build MAX</span>
77+
<span fg={theme.foreground}>Build MAX</span>
6578
</text>
6679
</box>
6780
</box>

0 commit comments

Comments
 (0)