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
55import Button from "@cloudscape-design/components/button" ;
66import Container from "@cloudscape-design/components/container" ;
@@ -14,10 +14,13 @@ import { TestBed } from "../app/test-bed";
1414import { ChatBubbleAvatarGenAI , ChatBubbleAvatarUser } from "../chat-bubble/util-components" ;
1515import { ScreenshotArea } from "../screenshot-area" ;
1616
17+ import styles from "./styles.module.scss" ;
18+
1719export 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"
0 commit comments