diff options
| author | Miguel Solorio <[email protected]> | 2025-06-13 00:59:45 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-06-13 07:59:45 +0000 |
| commit | f8a31f29aaeb31b2dfab4c18d750307308245a55 (patch) | |
| tree | 4f6d2ec09ad04d691ee5c102cd9accff57c7d1a2 /packages/cli/src/ui/components/Header.tsx | |
| parent | 95e4a60a83dd8e710ef69f78b3b57de4b4703344 (diff) | |
Replace logo with custom ASCII (#958)
Diffstat (limited to 'packages/cli/src/ui/components/Header.tsx')
| -rw-r--r-- | packages/cli/src/ui/components/Header.tsx | 55 |
1 files changed, 32 insertions, 23 deletions
diff --git a/packages/cli/src/ui/components/Header.tsx b/packages/cli/src/ui/components/Header.tsx index 207673ff..4a632142 100644 --- a/packages/cli/src/ui/components/Header.tsx +++ b/packages/cli/src/ui/components/Header.tsx @@ -8,30 +8,39 @@ import React from 'react'; import { Box, Text } from 'ink'; import Gradient from 'ink-gradient'; import { Colors } from '../colors.js'; - -const asciiArtLogo = ` - ██████╗ ███████╗███╗ ███╗██╗███╗ ██╗██╗ -██╔════╝ ██╔════╝████╗ ████║██║████╗ ██║██║ -██║ ███╗█████╗ ██╔████╔██║██║██╔██╗ ██║██║ -██║ ██║██╔══╝ ██║╚██╔╝██║██║██║╚██╗██║██║ -╚██████╔╝███████╗██║ ╚═╝ ██║██║██║ ╚████║██║ - ╚═════╝ ╚══════╝╚═╝ ╚═╝╚═╝╚═╝ ╚═══╝╚═╝ -`; +import { shortAsciiLogo, longAsciiLogo } from './AsciiArt.js'; +import { getAsciiArtWidth } from '../utils/textUtils.js'; interface HeaderProps { - title?: string; + customAsciiArt?: string; // For user-defined ASCII art + terminalWidth: number; // For responsive logo } -export const Header: React.FC<HeaderProps> = ({ title = asciiArtLogo }) => ( - <> - <Box marginBottom={1} alignItems="flex-start"> - {Colors.GradientColors ? ( - <Gradient colors={Colors.GradientColors}> - <Text>{title}</Text> - </Gradient> - ) : ( - <Text>{title}</Text> - )} - </Box> - </> -); +export const Header: React.FC<HeaderProps> = ({ + customAsciiArt, + terminalWidth, +}) => { + let displayTitle; + const widthOfLongLogo = getAsciiArtWidth(longAsciiLogo); + + if (customAsciiArt) { + displayTitle = customAsciiArt; + } else { + displayTitle = + terminalWidth >= widthOfLongLogo ? longAsciiLogo : shortAsciiLogo; + } + + return ( + <> + <Box marginBottom={1} alignItems="flex-start"> + {Colors.GradientColors ? ( + <Gradient colors={Colors.GradientColors}> + <Text>{displayTitle}</Text> + </Gradient> + ) : ( + <Text>{displayTitle}</Text> + )} + </Box> + </> + ); +}; |
