Skip to content

Commit

Permalink
feedback form not showing
Browse files Browse the repository at this point in the history
  • Loading branch information
buddy-web3 committed Mar 17, 2024
1 parent 2a5551b commit 53f13c1
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/components/Article/FeedbackForm/feedbackForm.css
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
.composite-button > .feedback-form {
position: absolute;
left: 90px;
top: -342px;
top: -350px;
display: none;
}
.composite-button > .feedback-form.show {
Expand Down
13 changes: 11 additions & 2 deletions app/components/Article/FeedbackForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,18 @@ export interface FeedbackFormProps {
* Has Options
*/
hasOptions?: boolean
/**
* onSubmit
*/
onSubmit?: () => void
}
const FeedbackForm = ({
pageid,
className = 'feedback-form',
onBlur,
onFocus,
hasOptions = true,
onSubmit,
}: FeedbackFormProps) => {
// to be implemented.
const [selected, setSelected] = React.useState<string>()
Expand All @@ -47,7 +52,7 @@ const FeedbackForm = ({
option: 'typos',
},
]
const [enabledSubmit, setEnabledSubmit] = React.useState(false)
const [enabledSubmit, setEnabledSubmit] = React.useState(!hasOptions)
const selectFeedback = (option: string) => {
setSelected(option)

Expand All @@ -73,7 +78,11 @@ const FeedbackForm = ({
[onBlur]
)

const handleSubmit = () => {}
const handleSubmit = () => {
if (onSubmit) {
onSubmit()
}
}

return (
<div key={pageid} className={className} onBlur={handleBlur} onFocus={onFocus}>
Expand Down
3 changes: 2 additions & 1 deletion app/components/Article/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const ArticleFooter = (question: Question) => {
</div>
<span>Was this page helpful?</span>

<CompositeButton className="flex-container">
<CompositeButton className="flex-container relative">
<Action
pageid={question.pageid}
showText={true}
Expand All @@ -74,6 +74,7 @@ const ArticleFooter = (question: Question) => {
onBlur={() => setIsFormFocused(false)}
onFocus={() => setIsFormFocused(true)}
hasOptions={false}
onSubmit={() => setShowFeedbackForm(false)}
/>
</CompositeButton>
</div>
Expand Down
3 changes: 3 additions & 0 deletions app/newRoot.css
Original file line number Diff line number Diff line change
Expand Up @@ -536,3 +536,6 @@ button {
.margin-top-40 {
margin-top: var(--spacing-40);
}
.relative {
position: relative;
}

0 comments on commit 53f13c1

Please sign in to comment.