Skip to content

Commit 336091e

Browse files
committed
feat: fix topbar design
1 parent be5ad3b commit 336091e

17 files changed

Lines changed: 121 additions & 27 deletions

File tree

apps/web/src/app/(lander-docs)/components/full-width-border.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export function FullWidthBorder({ className }: FullWidthBorderProps) {
99
<div
1010
aria-hidden="true"
1111
className={cn(
12-
"-translate-x-1/2 pointer-events-none absolute left-1/2 z-20 h-px w-screen border-t border-dashed",
12+
"-translate-x-1/2 pointer-events-none absolute left-1/2 z-1 h-px w-screen border-t border-dashed",
1313
className
1414
)}
1515
/>

apps/web/src/app/(lander-docs)/components/install/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const Install = () => (
2121
</div>
2222
<div
2323
className={cn(
24-
"relative flex flex-col justify-center gap-4 px-4 py-16 lg:w-1/2 lg:border-r lg:px-8 xl:px-12"
24+
"relative flex flex-col justify-center gap-4 px-4 py-16 lg:w-1/2 lg:px-8 xl:px-12"
2525
)}
2626
>
2727
<p className="font-mono text-primary/70 text-xs">

apps/web/src/app/(lander-docs)/components/precision-flow-section.test.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ describe("PrecisionFlowSection", () => {
3737

3838
expect(html).toContain("How do I delete my account?");
3939
expect(html).toContain("How it learns");
40-
expect(html).toContain("When Cossistant does not know, it asks your team.");
40+
expect(html).toContain("When the AI agent doesn&#x27;t know,");
4141
expect(html).toContain("Customer asks");
4242
expect(html).toContain("Cossistant checks");
4343
expect(html).toContain("Your team answers");
@@ -107,6 +107,7 @@ describe("PrecisionFlowSection", () => {
107107
expect(html).toContain("Reply");
108108
expect(html).toContain("Private note");
109109
expect(html).toContain('type="file"');
110+
expect(html).not.toContain("autofocus");
110111
expect(html).not.toContain("How do I delete my account?");
111112
expect(html).not.toContain(
112113
"I don&#x27;t know this one yet, so I&#x27;m asking the team and saving the answer for next time."
@@ -139,6 +140,7 @@ describe("PrecisionFlowSection", () => {
139140
expect(html).toContain('data-text-effect-caret="true"');
140141
expect(html).toContain('data-text-effect-visible="true"');
141142
expect(html).toContain("Next");
143+
expect(html).not.toContain("autofocus");
142144
expect(html).not.toContain("How do I delete my account?");
143145
});
144146

apps/web/src/app/(lander-docs)/components/precision-flow-section.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ function PrecisionFlowComposer({
123123
);
124124
centralBlock = (
125125
<ClarificationQuestionBlock
126+
autoFocus={false}
126127
freeAnswer={composerState.freeAnswer}
127128
getSuggestedAnswerButtonRef={(answer) =>
128129
answer === PRECISION_FLOW_QUESTION_TWO_ANSWER
@@ -219,6 +220,7 @@ function PrecisionFlowComposer({
219220
return (
220221
<Composer
221222
aboveBlock={aboveBlock}
223+
autoFocus={false}
222224
bottomBlock={bottomBlock}
223225
centralBlock={centralBlock}
224226
layoutMode="inline"

apps/web/src/app/(lander-docs)/components/topbar/index.tsx

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -151,14 +151,10 @@ export function TopBar({
151151
];
152152

153153
return (
154-
<div
155-
className={cn(
156-
"fixed top-0 right-0 left-0 z-[9999] border-grid-x bg-background",
157-
className
158-
)}
159-
>
160-
<div className="container-wrapper relative mx-auto">
161-
<div className="container absolute top-0 right-0 left-0 z-50 mx-auto flex items-center bg-background py-4 lg:justify-between">
154+
<div className={cn("fixed top-0 right-0 left-0 z-50", className)}>
155+
<div className="fixed top-0 right-0 left-0 h-16 min-h-16 min-w-screen border-background border-b bg-background" />
156+
<div className="container-wrapper relative mx-auto bg-background">
157+
<div className="container z-50 mx-auto flex items-center bg-background py-4 lg:justify-between">
162158
<div className="flex items-center gap-3 sm:gap-6">
163159
<Sheet>
164160
<SheetTrigger asChild>
@@ -223,9 +219,6 @@ export function TopBar({
223219
</div>
224220
<FullWidthBorder className="bottom-0" />
225221
</div>
226-
<div className="pointer-events-none absolute top-0 right-0 left-0 z-10 h-20 bg-linear-to-b from-background to-transparent" />
227-
<div className="pointer-events-none absolute top-0 right-0 left-0 z-10 h-24 bg-linear-to-b from-background to-transparent" />
228-
<div className="pointer-events-none absolute top-0 right-0 left-0 z-10 h-32 bg-linear-to-b from-background to-transparent" />
229222
</div>
230223
</div>
231224
);

apps/web/src/app/(lander-docs)/layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { TopBar } from "./components/topbar";
66

77
export default function Layout({ children }: { children: React.ReactNode }) {
88
return (
9-
<div className="relative flex min-h-svh flex-col overflow-clip border-grid-x">
9+
<div className="relative flex min-h-svh flex-col overflow-clip">
1010
<TopBar>
1111
<DashboardButton />
1212
</TopBar>

apps/web/src/components/conversation/composer/clarification-composer-flow.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ export type ClarificationQuestionBlockProps = {
7171
inputMode: NonNullable<
7272
Parameters<typeof KnowledgeClarificationQuestionContent>[0]["inputMode"]
7373
>;
74+
autoFocus?: Parameters<
75+
typeof KnowledgeClarificationQuestionContent
76+
>[0]["autoFocus"];
7477
selectedAnswer: string | null;
7578
freeAnswer: string;
7679
isOtherSelected: boolean;
@@ -244,6 +247,7 @@ export function ClarificationQuestionBlock({
244247
question,
245248
suggestedAnswers,
246249
inputMode,
250+
autoFocus,
247251
selectedAnswer,
248252
freeAnswer,
249253
isOtherSelected,
@@ -257,6 +261,7 @@ export function ClarificationQuestionBlock({
257261
<ComposerCentralBlock key="question">
258262
<div className="p-3" data-clarification-slot="question-flow">
259263
<KnowledgeClarificationQuestionContent
264+
autoFocus={autoFocus}
260265
freeAnswer={freeAnswer}
261266
getSuggestedAnswerButtonRef={getSuggestedAnswerButtonRef}
262267
inputMode={inputMode}

apps/web/src/components/conversation/composer/composer-central-block.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ type ComposerCentralBlockProps = {
3434
type ComposerDefaultCentralBlockProps = {
3535
className?: string;
3636
value: string;
37+
autoFocus?: boolean;
3738
textareaOverlay?: ReactNode;
3839
disabled: boolean;
3940
error?: Error | null;
@@ -75,6 +76,7 @@ type ComposerFileAttachmentsProps = {
7576
};
7677

7778
type ComposerEditorProps = {
79+
autoFocus: boolean;
7880
className?: string;
7981
disabled: boolean;
8082
isPrivate: boolean;
@@ -204,6 +206,7 @@ function ComposerFileAttachments({
204206
}
205207

206208
function ComposerEditor({
209+
autoFocus,
207210
className,
208211
disabled,
209212
isPrivate,
@@ -254,7 +257,7 @@ function ComposerEditor({
254257
<textarea
255258
aria-describedby={error ? "multimodal-input-error" : undefined}
256259
aria-invalid={error ? "true" : undefined}
257-
autoFocus
260+
autoFocus={autoFocus}
258261
className={cn(
259262
"flex-1 resize-none bg-transparent placeholder:text-primary/50 focus-visible:outline-none",
260263
COMPOSER_EDITOR_SURFACE_CLASS_NAME,
@@ -412,6 +415,7 @@ export function ComposerCentralBlock({
412415
export function ComposerDefaultCentralBlock({
413416
className,
414417
value,
418+
autoFocus = true,
415419
textareaOverlay,
416420
disabled,
417421
error,
@@ -471,6 +475,7 @@ export function ComposerDefaultCentralBlock({
471475
onVisibilityChange={onVisibilityChange}
472476
/>
473477
<ComposerEditor
478+
autoFocus={autoFocus}
474479
className={className}
475480
disabled={disabled}
476481
error={error}

apps/web/src/components/conversation/composer/index.test.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,21 @@ describe("Composer", () => {
112112
expect(html).toContain('data-composer-layout-mode="inline"');
113113
});
114114

115+
it("lets callers disable textarea autofocus when a demo should stay passive", async () => {
116+
const { Composer } = await composerModulePromise;
117+
118+
const html = renderToStaticMarkup(
119+
React.createElement(Composer, {
120+
autoFocus: false,
121+
onChange: () => {},
122+
onSubmit: () => {},
123+
value: "",
124+
})
125+
);
126+
127+
expect(html).not.toContain("autofocus");
128+
});
129+
115130
it("highlights the frame as soon as any custom slot is present", async () => {
116131
const { Composer } = await composerModulePromise;
117132

apps/web/src/components/conversation/composer/index.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ export type ComposerProps = {
5252
textareaOverlay?: React.ReactNode;
5353
escalationAction?: ComposerEscalationActionProps | null;
5454
value: string;
55+
autoFocus?: boolean;
5556
onChange: (value: string) => void;
5657
onSubmit: () => void;
5758
onFileSelect?: (files: File[]) => void;
@@ -90,6 +91,7 @@ export const Composer: React.FC<ComposerProps> = ({
9091
textareaOverlay,
9192
escalationAction = null,
9293
value,
94+
autoFocus = true,
9395
onChange,
9496
onSubmit,
9597
onFileSelect,
@@ -257,6 +259,7 @@ export const Composer: React.FC<ComposerProps> = ({
257259
) : (
258260
<ComposerDefaultCentralBlock
259261
allowedFileTypes={allowedFileTypes}
262+
autoFocus={autoFocus}
260263
canSubmit={canSubmit}
261264
className={className}
262265
disabled={disabled}

0 commit comments

Comments
 (0)