Skip to content

Website Repository maneeshhm #1181

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

Open
wants to merge 2 commits into
base: master
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
9 changes: 6 additions & 3 deletions Calculator/jashkarangiya/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@
<table>
<tr>
<td><button class="btn-operator" id="clear">C</button></td>
<td><button class="btn-operator" id="/">&divide;</button></td>
<td><button class="btn-operator" id="*">&times;</button></td>
<td><button class="btn-operator" id="backspace"><</button></td>
<td><button class="btn-operator" id="/">/</button></td>
<!-- <td><button class="btn-operator" id="*">&times;</button></td> -->
<td><button class="btn-operator" id="*">*</button></td>
<td><button class="btn-operator" id="backspace">
< </button>
</td>
</tr>
<tr>
<td><button class="btn-number" id="7">7</button></td>
Expand Down
55 changes: 37 additions & 18 deletions Calculator/jashkarangiya/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,48 @@ const display = document.querySelector("#display");
const buttons = document.querySelectorAll("button");

buttons.forEach((item) => {
item.onclick = () => {
if (item.id == "clear") {
display.innerText = "";
} else if (item.id == "backspace") {
let string = display.innerText.toString();
display.innerText = string.substr(0, string.length - 1);
} else if (display.innerText != "" && item.id == "equal") {
display.innerText = eval(display.innerText);
} else if (display.innerText == "" && item.id == "equal") {
display.innerText = "Empty!";
setTimeout(() => (display.innerText = ""), 2000);
} else {
display.innerText += item.id;
item.onclick = () => {
if (item.id == "clear") {
display.innerText = "";
} else if (item.id == "backspace") {
let string = display.innerText.toString();
display.innerText = string.substr(0, string.length - 1);
} else if (display.innerText != "" && item.id == "equal") {
try {
if (display.innerText.includes("/0")) {
throw new Error("Division by zero");
}
};
display.innerText = Function(
'"use strict";return (' + display.innerText + ")"
)();
} catch (e) {
display.innerText = "Cannot divide by zero!";
setTimeout(() => (display.innerText = ""), 2000);
}
} else if (display.innerText == "" && item.id == "equal") {
display.innerText = "Empty!";
setTimeout(() => (display.innerText = ""), 2000);
} else {
const lastChar = display.innerText.slice(-1);
if (
["+", "-", "*", "/"].includes(lastChar) &&
["+", "-", "*", "/"].includes(item.innerText)
) {
// Prevent adding multiple consecutive operators
display.innerText = display.innerText.slice(0, -1) + item.innerText;
} else {
display.innerText += item.innerText;
}
}
};
});

const themeToggleBtn = document.querySelector(".theme-toggler");
const calculator = document.querySelector(".calculator");
const toggleIcon = document.querySelector(".toggler-icon");
let isDark = true;
themeToggleBtn.onclick = () => {
calculator.classList.toggle("dark");
themeToggleBtn.classList.toggle("active");
isDark = !isDark;
};
calculator.classList.toggle("dark");
themeToggleBtn.classList.toggle("active");
isDark = !isDark;
};
5 changes: 4 additions & 1 deletion Website/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@ import { BrowserRouter as Router, Routes, Route } from "react-router-dom";
import Home from "./Pages/Home";

function App() {
const [searchTerm, setSearchTerm] = useState("");

return (
<div>
{/* <FoldersComponent/> */}
<Navbar />
{/* <Navbar /> */}
<Navbar searchTerm={searchTerm} setSearchTerm={setSearchTerm} />;

<Routes>
<Route exact path="/" element={<Home />}></Route>
Expand Down
3 changes: 2 additions & 1 deletion Website/src/Pages/Home.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ function Home() {

return (
<div>
<HeroSec searchTerm={searchTerm} setSearchTerm={setSearchTerm} />
{/* <HeroSec searchTerm={searchTerm} setSearchTerm={setSearchTerm} /> */}
<HeroSec />

<div className="grid grid-cols-3 p-8 gap-4 justify-center ">
{filteredFolders.map((folder, index) => (
Expand Down
9 changes: 3 additions & 6 deletions Website/src/componets/HeroSec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ export default function HeroSec({ searchTerm, setSearchTerm }) {
setSearchTerm(e.target.value);
};
return (

<div>
<section className="bg-center bg-no-repeat bg-[url('https://plus.unsplash.com/premium_photo-1661764393655-1dbffee8c0ce?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1170&q=80')] bg-gray-700 bg-blend-multiply">
<div>
<section className="bg-center bg-no-repeat bg-[url('https://plus.unsplash.com/premium_photo-1661764393655-1dbffee8c0ce?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1170&q=80')] bg-gray-700 bg-blend-multiply">
<div class="bg-white dark:bg-gray-900">
<div class="grid max-w-screen-xl px-4 py-8 mx-auto lg:gap-8 xl:gap-0 lg:py-16 lg:grid-cols-12">
<div class="mr-auto place-self-center lg:col-span-7">
<h1 class="max-w-2xl mb-4 text-4xl font-extrabold tracking-tight leading-none md:text-5xl xl:text-6xl dark:text-white">
Javascript Mini-Projects
Javascript Mini-Projects
</h1>
<p class="max-w-2xl mb-6 font-light text-gray-500 lg:mb-8 md:text-lg lg:text-xl dark:text-gray-400"></p>
<button
Expand All @@ -30,7 +29,6 @@ export default function HeroSec({ searchTerm, setSearchTerm }) {
</div>
</section>


<div class="flex items-center p-5 bg-gray-900">
<label for="simple-search" class="sr-only">
Search
Expand Down Expand Up @@ -82,7 +80,6 @@ export default function HeroSec({ searchTerm, setSearchTerm }) {
<span class="sr-only">Search</span>
</button>
</div>

</div>
);
}
34 changes: 32 additions & 2 deletions Website/src/componets/Navbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ import React from "react";
import icon from "../Image/javascript.png";
import { Link } from "react-router-dom";

export default function Navbar() {
export default function Navbar({ searchTerm, setSearchTerm }) {
const handleChange = (e) => {
console.log(e.target.value);
setSearchTerm(e.target.value);
};
return (
<div>
<nav class="bg-white border-gray-200 dark:bg-gray-900">
Expand All @@ -13,7 +17,7 @@ export default function Navbar() {
>
<img src={icon} class="h-8 mr-3" alt="hacker Logo" />
<span class="self-center text-2xl font-semibold whitespace-nowrap dark:text-white">
Javascript Mini-Projects
Javascript Mini-Projects
</span>
</a>
<div class="flex md:order-2">
Expand Down Expand Up @@ -101,6 +105,32 @@ export default function Navbar() {
Contact
</a>
</li>
<li>
<div class="flex rounded-full border-2 border-blue-500 overflow-hidden max-w-md mx-auto font-[sans-serif]">
<input
type="text"
id="simple-search"
class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full pl-10 p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
placeholder="Search Scripts"
value={searchTerm}
onChange={handleChange}
required
/>
<button
type="submit"
class="flex items-center justify-center bg-blue-500 hover:bg-blue-600 px-6"
>
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 192.904 192.904"
width="18px"
class="fill-white"
>
<path d="m190.707 180.101-47.078-47.077c11.702-14.072 18.752-32.142 18.752-51.831C162.381 36.423 125.959 0 81.191 0 36.422 0 0 36.423 0 81.193c0 44.767 36.422 81.187 81.191 81.187 19.688 0 37.759-7.049 51.831-18.751l47.079 47.078a7.474 7.474 0 0 0 5.303 2.197 7.498 7.498 0 0 0 5.303-12.803zM15 81.193C15 44.694 44.693 15 81.191 15c36.497 0 66.189 29.694 66.189 66.193 0 36.496-29.692 66.187-66.189 66.187C44.693 147.38 15 117.689 15 81.193z"></path>
</svg>
</button>
</div>
</li>
</ul>
</div>
</div>
Expand Down