Skip to content

Commit b8d962b

Browse files
author
Katie George
committed
fix: Small page fixes
1 parent 973e482 commit b8d962b

File tree

5 files changed

+37
-23
lines changed

5 files changed

+37
-23
lines changed

pages/support-prompt-group/in-context.page.tsx

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
// SPDX-License-Identifier: Apache-2.0
3-
import { useState } from "react";
3+
import { createRef, useState } from "react";
44

55
import Button from "@cloudscape-design/components/button";
66
import Container from "@cloudscape-design/components/container";
@@ -14,10 +14,13 @@ import { TestBed } from "../app/test-bed";
1414
import { ChatBubbleAvatarGenAI, ChatBubbleAvatarUser } from "../chat-bubble/util-components";
1515
import { ScreenshotArea } from "../screenshot-area";
1616

17+
import styles from "./styles.module.scss";
18+
1719
export default function SupportPromptPage() {
1820
const [text, setText] = useState("");
1921
const [text2, setText2] = useState("");
2022
const [sentText, setSentText] = useState("");
23+
const ref = createRef<HTMLTextAreaElement>();
2124

2225
const items = [
2326
{
@@ -44,14 +47,14 @@ export default function SupportPromptPage() {
4447
id: "brainstorm",
4548
},
4649
{
47-
text: "Summarize this long and complex PDF for me.",
50+
text: "Summarize this long PDF for me.",
4851
id: "summarize",
4952
},
5053
];
5154

5255
return (
5356
<ScreenshotArea>
54-
<main style={{ maxWidth: "800px" }}>
57+
<main className={styles.container}>
5558
<TestBed>
5659
<SpaceBetween size="xl">
5760
<Container
@@ -70,9 +73,9 @@ export default function SupportPromptPage() {
7073
amount of data, at any time, from anywhere.
7174
</ChatBubble>
7275
{text === "" && (
73-
<div style={{ marginInlineStart: "36px" }}>
76+
<div className={styles["support-prompt-container"]}>
7477
<SupportPromptGroup
75-
ariaLabel="Horizontal support prompt group"
78+
ariaLabel="Test support prompt group 1"
7679
alignment="vertical"
7780
onItemClick={({ detail }) => {
7881
const activeItem = items.find((item) => item.id === detail.id);
@@ -104,7 +107,7 @@ export default function SupportPromptPage() {
104107
}
105108
>
106109
<SpaceBetween direction="vertical" size="m">
107-
<div style={{ height: "100px" }} />
110+
<div className={styles.placeholder} />
108111
{sentText !== "" && (
109112
<ChatBubble type="outgoing" avatar={<ChatBubbleAvatarUser />} ariaLabel="User at 4:23:20pm">
110113
{sentText}
@@ -114,16 +117,18 @@ export default function SupportPromptPage() {
114117
{sentText === "" && (
115118
<SupportPromptGroup
116119
alignment="horizontal"
117-
ariaLabel="Horizontal support prompt group"
120+
ariaLabel="Test support prompt group 2"
118121
onItemClick={({ detail }) => {
119122
const activeItem = items2.find((item) => item.id === detail.id);
120123
setText2(activeItem?.text || "");
124+
ref.current?.focus();
121125
}}
122126
items={items2}
123127
/>
124128
)}
125129

126130
<PromptInput
131+
ref={ref}
127132
placeholder="Write a prompt"
128133
value={text2}
129134
actionButtonIconName="send"

pages/support-prompt-group/simple.page.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export default function SupportPromptPage() {
5252
]}
5353
/>
5454

55-
<h2>group with really long text</h2>
55+
<h2>Horizontal group with really long text</h2>
5656
<SupportPromptGroup
5757
ariaLabel="Horizontal support prompt group"
5858
alignment="horizontal"
@@ -72,7 +72,7 @@ export default function SupportPromptPage() {
7272
},
7373
{
7474
text: "What questions remain unanswered after reading the document(s)? The response shall consider all current or past uploaded documents.",
75-
id: "image",
75+
id: "image-2",
7676
},
7777
]}
7878
/>
@@ -96,7 +96,7 @@ export default function SupportPromptPage() {
9696
},
9797
{
9898
text: "What questions remain unanswered after reading the document(s)? The response shall consider all current or past uploaded documents.",
99-
id: "image",
99+
id: "image-2",
100100
},
101101
]}
102102
/>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
.support-prompt-container {
7+
margin-inline-start: 36px;
8+
}
9+
10+
.container {
11+
max-width: 1000px;
12+
}
13+
14+
.placeholder {
15+
block-size: 150px;
16+
}

src/support-prompt-group/internal.tsx

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -125,18 +125,10 @@ export const InternalSupportPromptGroup = forwardRef(
125125
handleKey(event as any, {
126126
onHome: () => focusElement(focusables[0]),
127127
onEnd: () => focusElement(focusables[focusables.length - 1]),
128-
onInlineStart: () =>
129-
alignment === "horizontal" &&
130-
focusElement(focusables[circleIndex(activeIndex - 1, [0, focusables.length - 1])]),
131-
onInlineEnd: () =>
132-
alignment === "horizontal" &&
133-
focusElement(focusables[circleIndex(activeIndex + 1, [0, focusables.length - 1])]),
134-
onBlockStart: () =>
135-
alignment === "vertical" &&
136-
focusElement(focusables[circleIndex(activeIndex - 1, [0, focusables.length - 1])]),
137-
onBlockEnd: () =>
138-
alignment === "vertical" &&
139-
focusElement(focusables[circleIndex(activeIndex + 1, [0, focusables.length - 1])]),
128+
onInlineStart: () => focusElement(focusables[circleIndex(activeIndex - 1, [0, focusables.length - 1])]),
129+
onInlineEnd: () => focusElement(focusables[circleIndex(activeIndex + 1, [0, focusables.length - 1])]),
130+
onBlockStart: () => focusElement(focusables[circleIndex(activeIndex - 1, [0, focusables.length - 1])]),
131+
onBlockEnd: () => focusElement(focusables[circleIndex(activeIndex + 1, [0, focusables.length - 1])]),
140132
});
141133
}
142134

src/support-prompt-group/styles.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
@include shared.styles-reset;
1212

1313
display: flex;
14+
flex-wrap: wrap;
1415
gap: awsui.$space-scaled-xs;
1516

1617
&.vertical {
@@ -56,7 +57,7 @@
5657
outline: none;
5758

5859
@include shared.when-visible {
59-
@include shared.focus-highlight(4px, 4px);
60+
@include shared.focus-highlight(6px, 6px);
6061
}
6162
}
6263
}

0 commit comments

Comments
 (0)