-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add exampleQuestions prop. Adjust default empty state design. Refacto…
…r tests.
- Loading branch information
Showing
26 changed files
with
577 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { VuiFlexContainer, VuiText, VuiTextColor } from "vui"; | ||
import { ChatBubbleIcon } from "../Icons"; | ||
|
||
export const DefaultEmptyPrompt = () => ( | ||
<VuiFlexContainer | ||
className="vrcbEmptyMessages" | ||
spacing="none" | ||
alignItems="center" | ||
justifyContent="center" | ||
direction="column" | ||
> | ||
<ChatBubbleIcon size="80px" color="#cbcdde" /> | ||
|
||
<VuiText> | ||
<p> | ||
<VuiTextColor color="subdued">Ask anything.</VuiTextColor> | ||
</p> | ||
</VuiText> | ||
</VuiFlexContainer> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { VuiSpacer, VuiTextColor, VuiTitle, VuiTopicButton } from "../../vui"; | ||
|
||
type Props = { | ||
children?: React.ReactNode; | ||
onClick: () => void; | ||
title?: string; | ||
}; | ||
|
||
export const ExampleQuestion = ({ children, onClick, title }: Props) => { | ||
const content = ( | ||
<> | ||
{title && ( | ||
<> | ||
<VuiTitle size="s"> | ||
<p> | ||
<VuiTextColor color="primary">{title}</VuiTextColor> | ||
</p> | ||
</VuiTitle> | ||
|
||
{children && <VuiSpacer size="xxs" />} | ||
</> | ||
)} | ||
|
||
{children} | ||
</> | ||
); | ||
|
||
return ( | ||
<VuiTopicButton onClick={onClick} data-testid="exampleQuestion"> | ||
{content} | ||
</VuiTopicButton> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { VuiGrid, VuiSpacer, VuiText, VuiTextColor } from "../../vui"; | ||
import { ExampleQuestion } from "./ExampleQuestion"; | ||
import { DefaultEmptyPrompt } from "./DefaultEmptyPrompt"; | ||
|
||
type Props = { | ||
exampleQuestions: string[]; | ||
onSubmitChat: (query: string) => void; | ||
}; | ||
|
||
export const ExampleQuestions = ({ exampleQuestions, onSubmitChat }: Props) => { | ||
const hasExampleQuestions = exampleQuestions.length > 0; | ||
if (!hasExampleQuestions) return <DefaultEmptyPrompt />; | ||
|
||
return ( | ||
<div className="vrcbExampleQuestionsContainer"> | ||
<VuiText> | ||
<p> | ||
<VuiTextColor color="subdued">Try out these example questions</VuiTextColor> | ||
</p> | ||
</VuiText> | ||
|
||
<VuiSpacer size="m" /> | ||
|
||
<VuiGrid columns={3}> | ||
{exampleQuestions.map((exampleQuestion) => ( | ||
<ExampleQuestion | ||
key={exampleQuestion} | ||
onClick={() => onSubmitChat(exampleQuestion)} | ||
title={exampleQuestion} | ||
/> | ||
))} | ||
</VuiGrid> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
@import "../../vui/styleUtils/index.scss"; | ||
|
||
.vrcbExampleQuestionsContainer { | ||
padding: $sizeM; | ||
height: 100%; | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.