-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update: initial draft of Question and Answer widget
- Loading branch information
1 parent
e73b4fd
commit 2fabe17
Showing
8 changed files
with
67 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import styled, { css } from 'styled-components'; | ||
|
||
const sharedWidgetStyles = css` | ||
padding: 10px; | ||
border-radius: 8px; | ||
max-width: 80%; | ||
margin: 5px 0; | ||
`; | ||
|
||
const QuestionWrapper = styled.div` | ||
display: flex; | ||
justify-content: flex-end; | ||
width: 100%; | ||
`; | ||
|
||
const QuestionWidget = styled.p` | ||
background-color: ${({ theme }) => theme.colors.neutral400}; | ||
color: ${({ theme }) => theme.colors.white400}; | ||
${sharedWidgetStyles} | ||
`; | ||
|
||
const AnswerWrapper = styled.div` | ||
display: flex; | ||
width: 100%; | ||
`; | ||
|
||
const AnswerWidget = styled.p` | ||
background-color: ${({ theme }) => theme.colors.white400}; | ||
color: ${({ theme }) => theme.colors.dark500}; | ||
${sharedWidgetStyles} | ||
`; | ||
|
||
export { QuestionWrapper, QuestionWidget, AnswerWrapper, AnswerWidget }; |
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 |
---|---|---|
@@ -1,13 +1,26 @@ | ||
import React from 'react'; | ||
|
||
import { useSearchWidgetContext, Heading3 } from 'shared/components'; | ||
import { useSearchWidgetContext } from 'shared/components'; | ||
|
||
import { QuestionWidget, QuestionWrapper, AnswerWrapper, AnswerWidget } from './view.style'; | ||
|
||
export function TextEngineView() { | ||
const { searchQuery } = useSearchWidgetContext(); | ||
|
||
const isValidQuery = !!searchQuery.trim().length; | ||
|
||
return ( | ||
<div data-testid="textEngineView"> | ||
<Heading3>{searchQuery}</Heading3> | ||
{isValidQuery && ( | ||
<QuestionWrapper> | ||
<QuestionWidget>{searchQuery}</QuestionWidget> | ||
</QuestionWrapper> | ||
)} | ||
{isValidQuery && ( | ||
<AnswerWrapper> | ||
<AnswerWidget>Realtime answer coming soon</AnswerWidget> | ||
</AnswerWrapper> | ||
)} | ||
</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
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
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