Skip to content

Commit

Permalink
more stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
justinstoner2 committed May 6, 2024
1 parent af5a387 commit e70b29d
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 12 deletions.
13 changes: 12 additions & 1 deletion trivia-forge/frontend/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,20 @@
background-color: white;
}

h2 {
text-align: center;
}

.CardPadding {
margin: 20px;
background-color: bisque;
}

footer {
position: absolute;
position: fixed;
bottom: 0;
background-color: #282c34;
color: white;
text-align: center;
width: 100%;
}
Expand Down
27 changes: 17 additions & 10 deletions trivia-forge/frontend/src/Components/Questions.jsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,29 @@
import React from "react";
import Choices from "../Components/Choices";
import { Card } from "react-bootstrap";

import { Question } from "../Model/Question";

function Questions({ data }) {
let choices = data.choices;
return (
<div>
<div className="card-body">
<textarea className="form-control" defaultValue={data.question}></textarea>
</div>
<Choices choices={choices} />
<div className="card-body">
<textarea className="form-control" defaultValue={data.answer}></textarea>
</div>
<div className="card-body">
<textarea className="form-control" defaultValue={data.hint}></textarea>
</div>
<Card className="CardPadding">
<h2 className="centered">Question</h2>
<div className="card-body">
<textarea className="form-control" defaultValue={data.question}></textarea>
</div>
<h2>Choices</h2>
<Choices choices={choices} />
<h2>Answer</h2>
<div className="card-body">
<textarea className="form-control" defaultValue={data.answer}></textarea>
</div>
<h2>Hint</h2>
<div className="card-body">
<textarea className="form-control" defaultValue={data.hint}></textarea>
</div>
</Card>
</div>
)
}
Expand Down
4 changes: 3 additions & 1 deletion trivia-forge/frontend/src/Pages/TriviaGenPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ function TriviaGenPage() {

//parse response from API
let sections = completion.choices[0].message.content.split('\n'); // store trivia questions

for (let i = 0; i < sections.length; i++) {
if (sections[i] === '') { sections.splice(i, 1); }
}
//loop through sections and create question and choice objects
for (let i = 0; i < sections.length; i += 7) {
let question = sections[i];
Expand Down
3 changes: 3 additions & 0 deletions trivia-forge/frontend/src/Pages/TriviaReviewPage.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import { useLocation } from 'react-router-dom'; // used to access passed state
import Questions from '../Components/Questions';
import { Button } from 'react-bootstrap';

function TriviaReviewPage() {
// Reference: https://reactrouter.com/en/main/hooks/use-location
Expand All @@ -17,6 +18,8 @@ function TriviaReviewPage() {
<Questions key={index} data={q} />

))}
<Button variant="primary" size="lg" block>
Save Changes</Button>
</div>
);
}
Expand Down

0 comments on commit e70b29d

Please sign in to comment.