Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implemented The Wikipedia logo in a highlighted state in toggle button #200

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions eduaid_web/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added eduaid_web/src/assets/wifipedia_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 15 additions & 9 deletions eduaid_web/src/pages/Text_Input.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ import stars from "../assets/stars.png";
import cloud from "../assets/cloud.png";
import { FaClipboard } from "react-icons/fa";
import Switch from "react-switch";
import wifipediaLogo from "../assets/wifipedia_logo.png"; // Import Wikipedia logo

const Text_Input = () => {
const [text, setText] = useState("");
const [difficulty, setDifficulty] = useState("Easy Difficulty");
const [numQuestions, setNumQuestions] = useState(10);
const [loading, setLoading] = useState(false);
const fileInputRef = useRef(null);
const [fileContent, setFileContent] = useState("");
const [docUrl, setDocUrl] = useState("");
const [isToggleOn, setIsToggleOn] = useState(0);
const [isToggleOn, setIsToggleOn] = useState(false); // Toggle state as boolean

const toggleSwitch = () => {
setIsToggleOn((isToggleOn + 1) % 2);
setIsToggleOn(!isToggleOn); // Toggle the state
};

const handleFileUpload = async (event) => {
Expand Down Expand Up @@ -285,11 +285,19 @@ const Text_Input = () => {
<div className="text-white text-xl font-bold">Use Wikipedia: </div>
<Switch
onChange={toggleSwitch}
checked={isToggleOn === 1}
checked={isToggleOn}
onColor="#008080"
offColor="#3e5063"
checkedIcon={false}
uncheckedIcon={false}
checkedIcon={
<div className="flex justify-center items-center h-full">
<img src={wifipediaLogo} alt="Wikipedia" className="h-5 w-5 opacity-100" />
</div>
}
uncheckedIcon={
<div className="flex justify-center items-center h-full">
<img src={wifipediaLogo} alt="Wikipedia" className="h-5 w-5 opacity-40" />
</div>
}
/>
</div>
</div>
Expand All @@ -299,18 +307,16 @@ const Text_Input = () => {
Back
</button>
</a>
{/* <a href="output"> */}
<button
onClick={handleSaveToLocalStorage}
className="bg-black items-center text-xl text-white px-4 py-2 border-gradient flex"
>
Next
</button>
{/* </a> */}
</div>
</div>
</div>
);
};

export default Text_Input;
export default Text_Input;