[questions][chore] refactor and add in todo

pull/346/head
wlren 3 years ago
parent 630005e541
commit 81746fa047

@ -43,15 +43,15 @@ export type QuestionCardProps = ActionButtonProps &
UpvoteProps & { UpvoteProps & {
content: string; content: string;
location: string; location: string;
receivedCount: number;
role: string; role: string;
similarCount: number;
timestamp: string; timestamp: string;
}; };
export default function QuestionCard({ export default function QuestionCard({
answerCount, answerCount,
content, content,
similarCount, receivedCount,
showVoteButtons, showVoteButtons,
showUserStatistics, showUserStatistics,
showActionButton, showActionButton,
@ -63,7 +63,7 @@ export default function QuestionCard({
location, location,
}: QuestionCardProps) { }: QuestionCardProps) {
return ( return (
<article className="flex gap-4 rounded-md border border-slate-300 p-4 bg-white"> <article className="flex gap-4 rounded-md border border-slate-300 bg-white p-4">
{showVoteButtons && ( {showVoteButtons && (
<div className="flex flex-col items-center"> <div className="flex flex-col items-center">
<Button <Button
@ -110,7 +110,7 @@ export default function QuestionCard({
<Button <Button
addonPosition="start" addonPosition="start"
icon={EyeIcon} icon={EyeIcon}
label={`${similarCount} received this`} label={`${receivedCount} received this`}
size="sm" size="sm"
variant="tertiary" variant="tertiary"
/> />

@ -11,28 +11,26 @@ export type RadioData = {
export default function RadioGroup({ radioData, onChange }: RadioProps) { export default function RadioGroup({ radioData, onChange }: RadioProps) {
return ( return (
<fieldset <div className="mx-1 space-y-1">
onChange={(event: React.FormEvent<HTMLFieldSetElement>) => { {radioData.map((radio) => (
const target = event.target as HTMLInputElement; <div key={radio.value} className="flex items-center">
onChange(target.value); <input
}}> checked={radio.checked}
<div className="mx-1 space-y-2"> className="text-primary-600 focus:ring-primary-500 h-4 w-4 border-gray-300"
{radioData.map((radio) => ( type="radio"
<div key={radio.value} className="flex items-center"> value={radio.value}
<input onChange={(event) => {
checked={radio.checked} const target = event.target as HTMLInputElement;
className="text-primary-600 focus:ring-primary-500 h-4 w-4 border-gray-300" onChange(target.value);
type="radio" }}
value={radio.value} />
/> <label
<label className="ml-3 min-w-0 flex-1 text-gray-700"
className="ml-3 min-w-0 flex-1 text-gray-700" htmlFor={radio.value}>
htmlFor={radio.value}> {radio.label}
{radio.label} </label>
</label> </div>
</div> ))}
))} </div>
</div>
</fieldset>
); );
} }

@ -222,8 +222,8 @@ export default function QuestionsHomePage() {
answerCount={0} answerCount={0}
content="Given an array of integers nums and an integer target, return indices of the two numbers such that they add up. Given an array of integers nums and an integer target, return indices of the two numbers such that they add up. Given an array of integers nums and" content="Given an array of integers nums and an integer target, return indices of the two numbers such that they add up. Given an array of integers nums and an integer target, return indices of the two numbers such that they add up. Given an array of integers nums and"
location="Menlo Park, CA" location="Menlo Park, CA"
receivedCount={0}
role="Senior Engineering Manager" role="Senior Engineering Manager"
similarCount={0}
timestamp="Last month" timestamp="Last month"
upvoteCount={0} upvoteCount={0}
/> />

Loading…
Cancel
Save