Keep suggested next steps inside their chips on a phone
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { renderToString } from "react-dom/server";
|
||||
import BotSuggestionChip from "./bot-suggestion-chip";
|
||||
|
||||
const longStep =
|
||||
"Write a full launch plan for next quarter with owners, deadlines and the review checkpoints for every team";
|
||||
|
||||
function render({ step }: { step: string }) {
|
||||
return renderToString(<BotSuggestionChip step={step} />);
|
||||
}
|
||||
|
||||
describe("BotSuggestionChip", () => {
|
||||
test("shows the step and keeps it inside the chip", () => {
|
||||
const html = render({ step: longStep });
|
||||
|
||||
expect(html).toContain(longStep);
|
||||
// The twui button's content wrapper is nowrap by default, which let a
|
||||
// long step spill out of the button's outline on a phone.
|
||||
expect(html).toContain("[&_.twui-button-content-wrapper]:whitespace-normal");
|
||||
expect(html).toContain("[&_.twui-button-content-wrapper]:min-w-0");
|
||||
expect(html).toContain("break-words");
|
||||
expect(html).toContain("max-w-full");
|
||||
});
|
||||
});
|
||||
@@ -22,10 +22,10 @@ export default function BotSuggestionChip({ step }: Props) {
|
||||
color="gray"
|
||||
size="smaller"
|
||||
title={`Put this in your input: ${step}`}
|
||||
className="inline-flex h-auto max-w-full gap-1! flex-nowrap align-middle px-2! py-1! text-left text-[13px] font-normal whitespace-normal [&_.twui-button-content-wrapper]:min-w-0"
|
||||
className="inline-flex h-auto max-w-full min-w-0 gap-1! flex-nowrap align-middle px-2! py-1! text-left text-[13px] font-normal whitespace-normal [&_.twui-button-content-wrapper]:min-w-0 [&_.twui-button-content-wrapper]:whitespace-normal"
|
||||
onClick={() => onUseSuggestion({ text: step })}
|
||||
>
|
||||
<Span className="min-w-0">{step}</Span>
|
||||
<Span className="min-w-0 break-words">{step}</Span>
|
||||
<ArrowUpRight size={14} aria-hidden className="shrink-0" />
|
||||
</Button>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user