({ mode, width }: ModeDividerProps)
| 11 | } |
| 12 | |
| 13 | export 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 | } |
nothing calls this directly
no test coverage detected