diff --git a/client/src/components/Flashcard/Flashcard.css b/client/src/components/Flashcard/Flashcard.css new file mode 100644 index 000000000..95ac7ae6b --- /dev/null +++ b/client/src/components/Flashcard/Flashcard.css @@ -0,0 +1,42 @@ +.card { + display: flex; + justify-content: center; + align-items: center; + position: relative; + border-radius: 0.25rem; + box-shadow: 0 0 5px 2px rgba(0, 0, 0, 0.3); + background-color: white; + transform: perspective(1000px) rotateY(var(--rotate-y, 0)) + translateY(var(--translate-y, 0)); + transform-style: preserve-3d; + transition: 150ms; + cursor: pointer; + border: 2px solid #000; + + width: 50%; + height: 500px; +} + +.card:hover { + --translate-y: -2px; + box-shadow: 0 0 5px 2px rgba(0, 0, 0, 0.5); +} + +.card.flip { + --rotate-y: 180deg; +} + +.card .front, +.card .back { + position: absolute; + padding: 1rem; + backface-visibility: hidden; +} + +.card .back { + transform: rotateY(180deg); +} + +.card .front { + transform: rotateY(0deg); +} diff --git a/client/src/components/Flashcard/Flashcard.js b/client/src/components/Flashcard/Flashcard.js new file mode 100644 index 000000000..7de9e24f7 --- /dev/null +++ b/client/src/components/Flashcard/Flashcard.js @@ -0,0 +1,64 @@ +import { useState } from "react"; + +import "./Flashcard.css"; + +function Flashcard({ flashcards, setViewCard }) { + const [flip, setFlip] = useState(false); // Flip card hook + const [index, setIndex] = useState(0); + + function handleRecord() {} + function handleSubmit() {} + function handleListen() {} + + return ( +
+ +
+ {index > 0 ? ( + + ) : ( + <> + )} +
setFlip(!flip)} + > +
{flashcards[index].wordName}
+
{flashcards[index].englishTranslation}
+
+ {index < flashcards.length - 2 ? ( + + ) : ( + <> + )} +
+
+ + + +
+
+ ); +} + +export default Flashcard; diff --git a/client/src/components/viewAssignments/viewAssignment.css b/client/src/components/viewAssignments/viewAssignment.css new file mode 100644 index 000000000..3fda0f908 --- /dev/null +++ b/client/src/components/viewAssignments/viewAssignment.css @@ -0,0 +1,88 @@ +/* General styling for view assignments */ +.viewAssignment { + padding: 10px; +} + +/* Button container with flex layout */ +.button-container { + display: flex; + justify-content: space-between; /* Space buttons out */ + align-items: center; /* Center buttons vertically */ + margin-bottom: 20px; /* Add some margin below the container */ +} + +/* Styles for the back button */ +.backButton { + background-color: maroon; /* Less prominent color for secondary action */ + color: white; + border: none; + padding: 5px 10px; /* Smaller padding */ + font-size: 14px; /* Smaller font size */ + cursor: pointer; + margin: 0 10px; /* Space between buttons */ + border-radius: 5px; /* Rounded corners */ + transition: background-color 0.4s, transform 0.2s; /* Smooth transitions for interaction */ +} + +/* Hover effect for back button */ +.backButton:hover { + background-color: darkred; /* Darken on hover */ + transform: scale(1.05); /* Slight increase in size on hover */ +} + +/* Styles for the flashcard button */ +.flashCardButton { + background-color: maroon; /* Prominent color for primary action */ + color: white; + border: none; + padding: 15px 30px; /* Larger padding for emphasis */ + font-size: 18px; /* Larger font size */ + cursor: pointer; + margin: 0 10px; /* Space between buttons */ + border-radius: 5px; /* Rounded corners */ + transition: background-color 0.4s, transform 0.2s; /* Smooth transitions for interaction */ +} + +/* Hover effect for flashcard button */ +.flashCardButton:hover { + background-color: darkred; /* Darken on hover */ + transform: scale(1.05); /* Slight increase in size on hover */ +} + +/* Styling for lesson names */ +.lessonName { + margin-bottom: 20px; + color: maroon; +} + +/* Container for tables with scrolling capability */ +.tableContainer { + max-height: 800px; + overflow-y: auto; + border: 1px solid #ddd; +} + +/* Styling for flashcard tables */ +.flashcardTable { + width: 100%; + border-collapse: collapse; +} + +/* Styling for table headers and cells */ +.flashcardTable th, .flashcardTable td { + border: 1px solid #ddd; + padding: 8px; + text-align: left; +} + +/* Sticky header in table */ +.flashcardTable thead th { + position: sticky; + top: 0; + background-color: #f0f0f0; +} + +/* Full-width audio controls for better usability */ +.audioControl { + width: 100%; +} diff --git a/client/src/components/viewAssignments/viewAssignments.js b/client/src/components/viewAssignments/viewAssignments.js index 920bb22d0..386d65611 100644 --- a/client/src/components/viewAssignments/viewAssignments.js +++ b/client/src/components/viewAssignments/viewAssignments.js @@ -1,23 +1,51 @@ -import React from 'react'; - -function ViewAssignment() { - const flashcards = [ - { wordName: 'Apple', englishTranslation: 'Apple', audioFile: 'apple.mp3' }, - { wordName: 'Banana', englishTranslation: 'Banana', audioFile: 'banana.mp3' }, - { wordName: 'Orange', englishTranslation: 'Orange', audioFile: 'orange.mp3' }, - ]; +import { useState } from "react"; +import React from "react"; +import "./ViewAssignment.css"; // Make sure this points to the correct CSS file +import Flashcard from "../Flashcard/Flashcard"; +export default function ViewAssignment({ lessonName, flashcards, onBack }) { + const [isViewCard, setViewCard] = useState(false); return ( -
- {flashcards.map((flashcard, index) => ( -
-
{flashcard.wordName}
-
{flashcard.englishTranslation}
-
+ )} + ); } - -export default ViewAssignment; \ No newline at end of file