-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #51 from Kartify-Team/q-and-a
Q and a
- Loading branch information
Showing
22 changed files
with
264 additions
and
227 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 |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
**/node_modules | ||
tests/ | ||
dist/ | ||
*test* | ||
|
||
node_modules/ | ||
# Logs | ||
|
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 was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import React, { useState } from "react"; | ||
import { removeHTMLTags } from "../../utils" | ||
const QuestionCard = ({ question }) => { | ||
let [expanded, setExpanded] = useState(false); | ||
return <div id="question-container" key={question.question_id} | ||
onClick={() => setExpanded(!expanded)}> | ||
<h2>Q: {removeHTMLTags(question.question_body)}</h2> | ||
<div> | ||
{Object.keys(question.answers).map((id, index) => { | ||
if (index < 2 || expanded) { | ||
return ( | ||
<span key={question.answers[id].id}> | ||
{index === 0 ? ( | ||
<p id="first-answer">A: {removeHTMLTags(question.answers[id].body)}</p> | ||
) : ( | ||
<p id="more-answers">{removeHTMLTags(question.answers[id].body)}</p> | ||
)} | ||
<sub id="answerer"> | ||
by {question.answers[id].answerer_name},{" "} | ||
{new Date(question.answers[id].date).toLocaleDateString("en-US", { | ||
dateStyle: "long" | ||
})} | ||
| Helpful? Yes {question.answers[id].helpfulness} | ||
| Report | ||
</sub> | ||
</span> | ||
); | ||
} | ||
})} | ||
</div> | ||
</div> | ||
|
||
|
||
}; | ||
|
||
export default QuestionCard; |
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 was deleted.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import Redux from 'redux'; | ||
// import Redux from 'redux'; | ||
|
||
export default (state = null, action) => { | ||
switch (action.type) { | ||
case 'CHANGE_PRODUCT': | ||
return action.info; | ||
default: | ||
return state; | ||
case 'CHANGE_PRODUCT': | ||
return action.info; | ||
default: | ||
return state; | ||
} | ||
}; |
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,11 +1,11 @@ | ||
import Redux from 'redux'; | ||
import { ADD_QUESTION_LIST } from '../actions/index' | ||
// import Redux from 'redux'; | ||
import { ADD_QUESTION_LIST } from '../actions/index'; | ||
|
||
export default (state = {}, action) => { | ||
switch (action.type) { | ||
case ADD_QUESTION_LIST: | ||
return action.questions | ||
default: | ||
return state; | ||
} | ||
switch (action.type) { | ||
case ADD_QUESTION_LIST: | ||
return action.questions; | ||
default: | ||
return state; | ||
} | ||
}; |
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.