add add question mechanic

This commit is contained in:
WindowsCrashed
2023-08-07 23:03:13 -03:00
parent decd05a156
commit 0b5964a6d7
4 changed files with 74 additions and 161 deletions

View File

@@ -1,17 +1,22 @@
import React, { FC, PropsWithChildren } from "react";
import { SideBar } from "./SideBar";
import { SelectedQuestionCard } from "./SelectedQuestionCard";
interface Props extends PropsWithChildren {
type Props = {
questions: {id: string, label: string}[],
onRemoveQuestion: Function
}
export const SelectedQuestionsSideBar: FC<Props> = ({ children }) => {
export const SelectedQuestionsSideBar: FC<Props> = ({ questions, onRemoveQuestion }) => {
return (
<SideBar>
<h1>Questões Selecionadas</h1>
<hr className="h-1 mt-2"/>
<div>
{children ??
{questions.length ?
questions.map(q => <SelectedQuestionCard
key={q.id} id={q.id} label={q.label}
onRemoveQuestion={onRemoveQuestion}/>) :
<h2 className="text-gray-700 mt-3">
Nenhuma questão selecionada
</h2>