Skip to content

Commit

Permalink
Fix preview pane overflows when text cannot wrap (#538)
Browse files Browse the repository at this point in the history
  • Loading branch information
neoxelox authored Nov 4, 2024
1 parent 050197f commit c3314bd
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/web-ui/src/ds/atoms/Alert/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export function Alert({
/>
)}
<div className='flex flex-row items-center gap-4 lg:gap-8 justify-between'>
<div className='flex flex-col gap-2'>
<div className='flex flex-col gap-2 whitespace-pre-wrap break-all'>
{title && <AlertTitle>{title}</AlertTitle>}
{description && <AlertDescription>{description}</AlertDescription>}
</div>
Expand Down
3 changes: 3 additions & 0 deletions packages/web-ui/src/ds/atoms/Text/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ namespace Text {
size?: FontSize
textTransform?: 'none' | 'uppercase' | 'lowercase'
whiteSpace?: WhiteSpace
wordBreak?: WordBreak
}

export const Mono = forwardRef<HTMLSpanElement, MonoProps>(function MonoFont(
Expand All @@ -290,6 +291,7 @@ namespace Text {
color = 'foreground',
overflow = 'auto',
whiteSpace = 'pre',
wordBreak = 'normal',
underline = false,
lineThrough = false,
size = 'h6',
Expand All @@ -312,6 +314,7 @@ namespace Text {
font.weight[weight],
colors.textColors[color],
overflowOptions[overflow],
wordBreakOptions[wordBreak],
{
[display]: !ellipsis,
[whiteSpaceOptions[whiteSpace]]: !!whiteSpace,
Expand Down
8 changes: 7 additions & 1 deletion packages/web-ui/src/ds/molecules/Chat/ErrorMessage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@ export function ErrorMessage({ error }: { error: Error }) {
.split('\n')
.map((line, index) => (
<div key={index} className='inline-block leading-none'>
<Text.Mono color='destructive'>{line}</Text.Mono>
<Text.Mono
color='destructive'
whiteSpace='preWrap'
wordBreak='breakAll'
>
{line}
</Text.Mono>
</div>
))}
</div>
Expand Down
1 change: 1 addition & 0 deletions packages/web-ui/src/ds/molecules/Chat/Message/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ const ContentValue = ({
<TextComponent
color={color}
whiteSpace='preWrap'
wordBreak='breakAll'
key={`${index}-${lineIndex}`}
>
{line}
Expand Down

0 comments on commit c3314bd

Please sign in to comment.