From 4a57ff8c3d71af5b2f43749d1990bb1eda17eac5 Mon Sep 17 00:00:00 2001 From: Mudit Date: Fri, 26 May 2023 17:32:00 +0530 Subject: [PATCH 1/3] Added SignUp and Login Page with routing --- package-lock.json | 63 ++++++++++++++++++++++++++++++++- package.json | 3 +- src/App.css | 42 ---------------------- src/App.jsx | 74 +++++++++------------------------------ src/css/Login.css | 53 ++++++++++++++++++++++++++++ src/index.css | 0 src/main.jsx | 20 ++++++----- src/pages/Login.jsx | 20 +++++++++++ src/pages/Problem.jsx | 7 ++++ src/pages/ProblemList.jsx | 7 ++++ src/pages/Signup.jsx | 18 ++++++++++ 11 files changed, 197 insertions(+), 110 deletions(-) delete mode 100644 src/App.css create mode 100644 src/css/Login.css delete mode 100644 src/index.css create mode 100644 src/pages/Login.jsx create mode 100644 src/pages/Problem.jsx create mode 100644 src/pages/ProblemList.jsx create mode 100644 src/pages/Signup.jsx diff --git a/package-lock.json b/package-lock.json index cd606935..4a36cfa9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,8 @@ "version": "0.0.0", "dependencies": { "react": "^18.2.0", - "react-dom": "^18.2.0" + "react-dom": "^18.2.0", + "react-router-dom": "^6.11.2" }, "devDependencies": { "@types/react": "^18.0.28", @@ -766,6 +767,14 @@ "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==", "dev": true }, + "node_modules/@remix-run/router": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.6.2.tgz", + "integrity": "sha512-LzqpSrMK/3JBAVBI9u3NWtOhWNw5AMQfrUFYB0+bDHTSw17z++WJLsPsxAuK+oSddsxk4d7F/JcdDPM1M5YAhA==", + "engines": { + "node": ">=14" + } + }, "node_modules/@types/prop-types": { "version": "15.7.5", "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.5.tgz", @@ -1226,6 +1235,36 @@ "node": ">=0.10.0" } }, + "node_modules/react-router": { + "version": "6.11.2", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.11.2.tgz", + "integrity": "sha512-74z9xUSaSX07t3LM+pS6Un0T55ibUE/79CzfZpy5wsPDZaea1F8QkrsiyRnA2YQ7LwE/umaydzXZV80iDCPkMg==", + "dependencies": { + "@remix-run/router": "1.6.2" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "react": ">=16.8" + } + }, + "node_modules/react-router-dom": { + "version": "6.11.2", + "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.11.2.tgz", + "integrity": "sha512-JNbKtAeh1VSJQnH6RvBDNhxNwemRj7KxCzc5jb7zvDSKRnPWIFj9pO+eXqjM69gQJ0r46hSz1x4l9y0651DKWw==", + "dependencies": { + "@remix-run/router": "1.6.2", + "react-router": "6.11.2" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "react": ">=16.8", + "react-dom": ">=16.8" + } + }, "node_modules/resolve": { "version": "1.22.2", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz", @@ -1853,6 +1892,11 @@ } } }, + "@remix-run/router": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.6.2.tgz", + "integrity": "sha512-LzqpSrMK/3JBAVBI9u3NWtOhWNw5AMQfrUFYB0+bDHTSw17z++WJLsPsxAuK+oSddsxk4d7F/JcdDPM1M5YAhA==" + }, "@types/prop-types": { "version": "15.7.5", "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.5.tgz", @@ -2176,6 +2220,23 @@ "integrity": "sha512-wViHqhAd8OHeLS/IRMJjTSDHF3U9eWi62F/MledQGPdJGDhodXJ9PBLNGr6WWL7qlH12Mt3TyTpbS+hGXMjCzQ==", "dev": true }, + "react-router": { + "version": "6.11.2", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.11.2.tgz", + "integrity": "sha512-74z9xUSaSX07t3LM+pS6Un0T55ibUE/79CzfZpy5wsPDZaea1F8QkrsiyRnA2YQ7LwE/umaydzXZV80iDCPkMg==", + "requires": { + "@remix-run/router": "1.6.2" + } + }, + "react-router-dom": { + "version": "6.11.2", + "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.11.2.tgz", + "integrity": "sha512-JNbKtAeh1VSJQnH6RvBDNhxNwemRj7KxCzc5jb7zvDSKRnPWIFj9pO+eXqjM69gQJ0r46hSz1x4l9y0651DKWw==", + "requires": { + "@remix-run/router": "1.6.2", + "react-router": "6.11.2" + } + }, "resolve": { "version": "1.22.2", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz", diff --git a/package.json b/package.json index 154dd4dd..208323e3 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,8 @@ }, "dependencies": { "react": "^18.2.0", - "react-dom": "^18.2.0" + "react-dom": "^18.2.0", + "react-router-dom": "^6.11.2" }, "devDependencies": { "@types/react": "^18.0.28", diff --git a/src/App.css b/src/App.css deleted file mode 100644 index b9d355df..00000000 --- a/src/App.css +++ /dev/null @@ -1,42 +0,0 @@ -#root { - max-width: 1280px; - margin: 0 auto; - padding: 2rem; - text-align: center; -} - -.logo { - height: 6em; - padding: 1.5em; - will-change: filter; - transition: filter 300ms; -} -.logo:hover { - filter: drop-shadow(0 0 2em #646cffaa); -} -.logo.react:hover { - filter: drop-shadow(0 0 2em #61dafbaa); -} - -@keyframes logo-spin { - from { - transform: rotate(0deg); - } - to { - transform: rotate(360deg); - } -} - -@media (prefers-reduced-motion: no-preference) { - a:nth-of-type(2) .logo { - animation: logo-spin infinite 20s linear; - } -} - -.card { - padding: 2em; -} - -.read-the-docs { - color: #888; -} diff --git a/src/App.jsx b/src/App.jsx index 7743965b..f045b0dd 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -1,59 +1,19 @@ -/* - * Temporary problems array schema - */ -const problems = [{ - title: "201. Bitwise AND of Numbers Range", - difficulty: "Medium", - acceptance: "42%" -},{ - title: "201. Bitwise AND of Numbers Range", - difficulty: "Medium", - acceptance: "412%" -}, - { - title: "202. Happy Number", - difficulty: "Easy", - acceptance: "54.9%" - }, - { - title: "203. Remove Linked List Elements", - difficulty: "Hard", - acceptance: "42%" - }]; +import React from "react"; +import { Routes, Route } from "react-router-dom"; +import Login from "./pages/Login"; +import Signup from "./pages/Signup"; +import Problem from "./pages/Problem"; +import ProblemList from "./pages/ProblemList"; +const App = () => { + return ( + + } /> + } /> + } /> + } /> + + ); +}; -function App() { - - /* Add routing here, routes look like - - /login - Login page - /signup - Signup page - /problemset/all/ - All problems (see problems array above) - /problems/:problem_slug - A single problem page - */ - - return ( -
- Finish the assignment! Look at the comments in App.jsx as a starting point -
- ) -} - -// A demo component -function ProblemStatement(props) { - const title = props.title; - const acceptance = props.acceptance; - const difficulty = props.difficulty; - - return - - {title} - - - {acceptance} - - - {difficulty} - - -} -export default App +export default App; diff --git a/src/css/Login.css b/src/css/Login.css new file mode 100644 index 00000000..173978ec --- /dev/null +++ b/src/css/Login.css @@ -0,0 +1,53 @@ +* { + font-family: Arial, Helvetica, sans-serif; +} + +.login { + display: flex; + justify-content: center; + align-items: center; + height: 100vh; + background-color: #f5f5f5; +} + +.card { + width: 300px; + max-width: 90%; + padding: 20px; + background-color: #fff; + border-radius: 5px; + text-align: center; +} + +.card h2 { + margin-bottom: 20px; + color: #333; +} + +form { + display: flex; + flex-direction: column; +} + +input { + margin-bottom: 10px; + padding: 10px; + font-size: 16px; + border: 1px solid #ccc; + border-radius: 5px; +} + +button { + padding: 10px 20px; + font-size: 16px; + color: #fff; + background-color: #007bff; + border: none; + border-radius: 5px; + cursor: pointer; + margin-bottom: 1rem; +} + +button:hover { + background-color: #0056b3; +} diff --git a/src/index.css b/src/index.css deleted file mode 100644 index e69de29b..00000000 diff --git a/src/main.jsx b/src/main.jsx index 5cc59919..3ee309d3 100644 --- a/src/main.jsx +++ b/src/main.jsx @@ -1,10 +1,12 @@ -import React from 'react' -import ReactDOM from 'react-dom/client' -import App from './App' -import './index.css' +import React from "react"; +import ReactDOM from "react-dom/client"; +import App from "./App"; +import { BrowserRouter } from "react-router-dom"; -ReactDOM.createRoot(document.getElementById('root')).render( - - - , -) +ReactDOM.createRoot(document.getElementById("root")).render( + + + + + +); diff --git a/src/pages/Login.jsx b/src/pages/Login.jsx new file mode 100644 index 00000000..a17f696f --- /dev/null +++ b/src/pages/Login.jsx @@ -0,0 +1,20 @@ +import "../css/Login.css"; +import { Link } from "react-router-dom"; + +const Login = () => { + return ( +
+
+

Login

+
+ + + + Sign Up +
+
+
+ ); +}; + +export default Login; diff --git a/src/pages/Problem.jsx b/src/pages/Problem.jsx new file mode 100644 index 00000000..e132d5bb --- /dev/null +++ b/src/pages/Problem.jsx @@ -0,0 +1,7 @@ +import React from "react"; + +const Problem = () => { + return
Problem
; +}; + +export default Problem; diff --git a/src/pages/ProblemList.jsx b/src/pages/ProblemList.jsx new file mode 100644 index 00000000..783d7254 --- /dev/null +++ b/src/pages/ProblemList.jsx @@ -0,0 +1,7 @@ +import React from "react"; + +const ProblemList = () => { + return
ProblemList
; +}; + +export default ProblemList; diff --git a/src/pages/Signup.jsx b/src/pages/Signup.jsx new file mode 100644 index 00000000..5e11e5ba --- /dev/null +++ b/src/pages/Signup.jsx @@ -0,0 +1,18 @@ +import "../css/Login.css"; + +const Signup = () => { + return ( +
+
+

Signup

+
+ + + +
+
+
+ ); +}; + +export default Signup; From 596ef8a3f196078a050c47ad62d641da7ce67e2c Mon Sep 17 00:00:00 2001 From: Mudit Date: Fri, 26 May 2023 23:28:08 +0530 Subject: [PATCH 2/3] Problem list page updated created ui for specific page --- index.html | 5 + src/App.jsx | 4 +- src/css/Login.css | 1 + src/css/Problem.css | 75 +++++++++++++++ src/css/ProblemList.css | 36 +++++++ src/pages/NotFound.jsx | 7 ++ src/pages/Problem.jsx | 45 ++++++++- src/pages/ProblemList.jsx | 192 +++++++++++++++++++++++++++++++++++++- 8 files changed, 360 insertions(+), 5 deletions(-) create mode 100644 src/css/Problem.css create mode 100644 src/css/ProblemList.css create mode 100644 src/pages/NotFound.jsx diff --git a/index.html b/index.html index 79c47019..dfafd199 100644 --- a/index.html +++ b/index.html @@ -5,6 +5,11 @@ Vite + React +
diff --git a/src/App.jsx b/src/App.jsx index f045b0dd..731d884a 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -4,6 +4,7 @@ import Login from "./pages/Login"; import Signup from "./pages/Signup"; import Problem from "./pages/Problem"; import ProblemList from "./pages/ProblemList"; +import NotFound from "./pages/NotFound"; const App = () => { return ( @@ -11,7 +12,8 @@ const App = () => { } /> } /> } /> - } /> + } /> + } /> ); }; diff --git a/src/css/Login.css b/src/css/Login.css index 173978ec..dbd91cfb 100644 --- a/src/css/Login.css +++ b/src/css/Login.css @@ -27,6 +27,7 @@ form { display: flex; flex-direction: column; + align-items: center; /* Add this line */ } input { diff --git a/src/css/Problem.css b/src/css/Problem.css new file mode 100644 index 00000000..ee03a539 --- /dev/null +++ b/src/css/Problem.css @@ -0,0 +1,75 @@ +* { + font-family: Arial, Helvetica, sans-serif; +} + +.problem-form-container { + display: flex; + justify-content: space-between; +} + +.left-section { + flex: 1; + padding-right: 20px; +} + +.right-section { + flex: 1; + padding-left: 20px; + border-left: 1px solid #ccc; +} + +h2 { + font-size: 24px; + margin-bottom: 20px; +} + +.form-fields { + display: flex; + flex-direction: column; +} + +.form-field { + margin-bottom: 20px; +} + +label { + font-weight: bold; +} + +input, +textarea { + width: 100%; + padding: 10px; + border: 1px solid #ccc; + border-radius: 4px; +} + +button { + background-color: #007bff; + color: #fff; + padding: 10px 20px; + border: none; + border-radius: 4px; + cursor: pointer; +} + +.preview-content { + display: flex; + flex-direction: column; +} + +.preview-field { + margin-bottom: 5px; +} + +.preview-field h3 { + font-size: 18px; +} + +.preview-field p { + white-space: pre-line; + padding: 10px; + background-color: #f9f9f9; + border: 1px solid #ccc; + border-radius: 4px; +} diff --git a/src/css/ProblemList.css b/src/css/ProblemList.css new file mode 100644 index 00000000..ab64dae8 --- /dev/null +++ b/src/css/ProblemList.css @@ -0,0 +1,36 @@ +* { + font-family: Arial, Helvetica, sans-serif; +} + +.heading { + margin: auto; + display: flex; + text-align: center; + justify-content: center; + margin-bottom: 1rem; +} + +table { + border-collapse: collapse; + width: 100%; + max-width: 600px; + margin: auto; +} + +th, +td { + border: 1px solid #ddd; + padding: 8px; +} + +thead th { + background-color: #f2f2f2; +} + +tbody tr:nth-child(even) { + background-color: #f9f9f9; +} + +div { + margin: 0.5rem; +} diff --git a/src/pages/NotFound.jsx b/src/pages/NotFound.jsx new file mode 100644 index 00000000..75f177c7 --- /dev/null +++ b/src/pages/NotFound.jsx @@ -0,0 +1,7 @@ +import React from "react"; + +const NotFound = () => { + return
NotFound
; +}; + +export default NotFound; diff --git a/src/pages/Problem.jsx b/src/pages/Problem.jsx index e132d5bb..765be9b5 100644 --- a/src/pages/Problem.jsx +++ b/src/pages/Problem.jsx @@ -1,7 +1,48 @@ -import React from "react"; +import "../css/Problem.css"; +import { useParams } from "react-router-dom"; const Problem = () => { - return
Problem
; + const { id } = useParams(); + + return ( +
+
+
+

Problem {id}

+
+

Title

+

title

+
+
+

Example

+

example

+
+
+

Input

+

input

+
+
+

Output

+

output

+
+
+

Explanation

+

explanation

+
+
+
+
+
+
+ + +
+ + +
+
+
+ ); }; export default Problem; diff --git a/src/pages/ProblemList.jsx b/src/pages/ProblemList.jsx index 783d7254..9c9f3a17 100644 --- a/src/pages/ProblemList.jsx +++ b/src/pages/ProblemList.jsx @@ -1,7 +1,195 @@ -import React from "react"; +import React, { useState } from "react"; +import { Link } from "react-router-dom"; +import "../css/ProblemList.css"; + +const Problem1 = [ + { + id: 1, + Title: "Two Sum", + Acceptance: "67.8%", + difficulty: "Easy", + }, + { + id: 2, + Title: "Two Sum", + Acceptance: "67.8%", + difficulty: "Medium", + }, + { + id: 3, + Title: "Two Sum", + Acceptance: "67.8%", + difficulty: "Medium", + }, + { + id: 4, + Title: "Two Sum", + Acceptance: "67.8%", + difficulty: "Medium", + }, + { + id: 5, + Title: "Two Sum", + Acceptance: "67.8%", + difficulty: "Medium", + }, + { + id: 6, + Title: "Two Sum", + Acceptance: "67.8%", + difficulty: "Medium", + }, + { + id: 7, + Title: "Two Sum", + Acceptance: "67.8%", + difficulty: "Medium", + }, + { + id: 8, + Title: "Two Sum", + Acceptance: "67.8%", + difficulty: "Medium", + }, + { + id: 9, + Title: "Two Sum", + Acceptance: "67.8%", + difficulty: "Medium", + }, +]; + +const Problem2 = [ + { + id: 10, + Title: "Add Two Numbers", + Acceptance: "40.5%", + difficulty: "Medium", + }, + { + id: 11, + Title: "Add Two Numbers", + Acceptance: "40.5%", + difficulty: "Medium", + }, + { + id: 12, + Title: "Add Two Numbers", + Acceptance: "40.5%", + difficulty: "Medium", + }, + { + id: 13, + Title: "Add Two Numbers", + Acceptance: "40.5%", + difficulty: "Medium", + }, + { + id: 14, + Title: "Add Two Numbers", + Acceptance: "40.5%", + difficulty: "Medium", + }, + { + id: 15, + Title: "Add Two Numbers", + Acceptance: "40.5%", + difficulty: "Medium", + }, + { + id: 16, + Title: "Add Two Numbers", + Acceptance: "40.5%", + difficulty: "Medium", + }, + { + id: 17, + Title: "Add Two Numbers", + Acceptance: "40.5%", + difficulty: "Medium", + }, + { + id: 18, + Title: "Add Two Numbers", + Acceptance: "40.5%", + difficulty: "Medium", + }, +]; const ProblemList = () => { - return
ProblemList
; + const [data, setData] = useState(Problem1); + + const displayProblemSetOne = () => { + setData(Problem1); + }; + + const displayProblemSetTwo = () => { + setData(Problem2); + }; + + return ( +
+

Problems

+ + + + + + + + + + + {data.map((row) => ( + + + + + + + ))} + +
S.noTitleAcceptanceDifficulty
{row.id} +
+ {row.Title} +
+
+
{row.Acceptance}
+
+
{row.difficulty}
+
+
+ + +
+
+ ); }; export default ProblemList; From 0e930ec302403046fe3bdce75c8f44e2232d3ca3 Mon Sep 17 00:00:00 2001 From: Mudit Date: Sat, 27 May 2023 22:13:43 +0530 Subject: [PATCH 3/3] Individual problems added --- src/css/Login.css | 54 ++++++++++- src/css/Problem.css | 74 +++++++++++---- src/css/ProblemList.css | 27 +++++- src/pages/Problem.jsx | 185 +++++++++++++++++++++++++++++++++++--- src/pages/ProblemList.jsx | 18 ++-- 5 files changed, 315 insertions(+), 43 deletions(-) diff --git a/src/css/Login.css b/src/css/Login.css index dbd91cfb..dac5952b 100644 --- a/src/css/Login.css +++ b/src/css/Login.css @@ -15,8 +15,9 @@ max-width: 90%; padding: 20px; background-color: #fff; - border-radius: 5px; + border-radius: 10px; text-align: center; + box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15); /* Add a subtle box shadow */ } .card h2 { @@ -27,7 +28,7 @@ form { display: flex; flex-direction: column; - align-items: center; /* Add this line */ + align-items: center; } input { @@ -36,6 +37,7 @@ input { font-size: 16px; border: 1px solid #ccc; border-radius: 5px; + outline: none; /* Remove the outline on focus */ } button { @@ -47,6 +49,54 @@ button { border-radius: 5px; cursor: pointer; margin-bottom: 1rem; + transition: background-color 0.3s ease; /* Add a smooth transition effect */ +} + +button:hover { + background-color: #0056b3; +} + +/* Add some additional styles to make it more visually appealing */ + +.login { + background-color: #f1f5f8; +} + +.card { + margin: 20px; + border: 1px solid #ddd; +} + +.card h2 { + margin-bottom: 30px; + font-size: 24px; + color: #333; +} + +input { + width: 100%; + margin-bottom: 20px; + padding: 12px; + font-size: 16px; + border: 1px solid #ddd; + border-radius: 8px; + transition: border-color 0.3s ease; +} + +input:focus { + border-color: #007bff; +} + +button { + width: 100%; + padding: 12px; + font-size: 16px; + color: #fff; + background-color: #007bff; + border: none; + border-radius: 8px; + cursor: pointer; + transition: background-color 0.3s ease; } button:hover { diff --git a/src/css/Problem.css b/src/css/Problem.css index ee03a539..c042a8ab 100644 --- a/src/css/Problem.css +++ b/src/css/Problem.css @@ -1,5 +1,6 @@ * { - font-family: Arial, Helvetica, sans-serif; + font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; + box-sizing: border-box; } .problem-form-container { @@ -15,12 +16,13 @@ .right-section { flex: 1; padding-left: 20px; - border-left: 1px solid #ccc; + border-left: 1px solid #eaeaea; } h2 { - font-size: 24px; - margin-bottom: 20px; + font-size: 28px; + margin-bottom: 30px; + color: #333333; } .form-fields { @@ -29,28 +31,48 @@ h2 { } .form-field { - margin-bottom: 20px; + margin-bottom: 30px; } label { font-weight: bold; + font-size: 16px; + color: #333333; + margin-bottom: 1rem; } input, textarea { width: 100%; - padding: 10px; - border: 1px solid #ccc; - border-radius: 4px; + padding: 12px; + border: 1px solid #eaeaea; + border-radius: 6px; + background-color: #f9f9f9; + color: #333333; + font-size: 16px; + outline: none; + transition: background-color 0.3s ease; +} + +input:focus, +textarea:focus { + background-color: #f5f5f5; } button { background-color: #007bff; - color: #fff; - padding: 10px 20px; + color: #ffffff; + padding: 12px 24px; border: none; - border-radius: 4px; + border-radius: 6px; + font-size: 16px; + font-weight: bold; cursor: pointer; + transition: background-color 0.3s ease; +} + +button:hover { + background-color: #0056b3; } .preview-content { @@ -59,17 +81,37 @@ button { } .preview-field { - margin-bottom: 5px; + margin-bottom: 15px; } .preview-field h3 { - font-size: 18px; + font-size: 20px; + color: #333333; + margin-bottom: 10px; } .preview-field p { white-space: pre-line; padding: 10px; - background-color: #f9f9f9; - border: 1px solid #ccc; - border-radius: 4px; + background-color: #f5f5f5; + border: 1px solid #eaeaea; + border-radius: 6px; + color: #333333; +} + +button.back-button { + background-color: #007bff; + color: #ffffff; + padding: 10px 20px; + border: none; + border-radius: 6px; + font-size: 16px; + font-weight: bold; + cursor: pointer; + transition: background-color 0.3s ease; + margin-top: 20px; +} + +button.back-button:hover { + background-color: #0056b3; } diff --git a/src/css/ProblemList.css b/src/css/ProblemList.css index ab64dae8..35261cd0 100644 --- a/src/css/ProblemList.css +++ b/src/css/ProblemList.css @@ -1,12 +1,11 @@ * { - font-family: Arial, Helvetica, sans-serif; + font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; + box-sizing: border-box; } .heading { margin: auto; - display: flex; text-align: center; - justify-content: center; margin-bottom: 1rem; } @@ -34,3 +33,25 @@ tbody tr:nth-child(even) { div { margin: 0.5rem; } + +button { + background-color: #007bff; + color: #ffffff; + padding: 8px 12px; + border: none; + border-radius: 4px; + font-size: 14px; + font-weight: bold; + cursor: pointer; + transition: background-color 0.3s ease; +} + +button:hover { + background-color: #0056b3; +} + +.center { + display: flex; + justify-content: center; + align-items: center; +} diff --git a/src/pages/Problem.jsx b/src/pages/Problem.jsx index 765be9b5..6f5413c6 100644 --- a/src/pages/Problem.jsx +++ b/src/pages/Problem.jsx @@ -1,41 +1,198 @@ import "../css/Problem.css"; -import { useParams } from "react-router-dom"; +import { Link, useParams } from "react-router-dom"; +const Problems = [ + { + id: "1", + title: "Two Sum", + description: + "Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.", + input: "nums = [2,7,11,15], target = 9", + output: "[0,1]", + }, + { + id: "2", + title: "Two Sum", + description: + "Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.", + input: "nums = [2,7,11,15], target = 9", + output: "[0,1]", + }, + { + id: "3", + title: "Two Sum", + description: + "Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.", + input: "nums = [2,7,11,15], target = 9", + output: "[0,1]", + }, + { + id: "4", + title: "Two Sum", + description: + "Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.", + input: "nums = [2,7,11,15], target = 9", + output: "[0,1]", + }, + { + id: "5", + title: "Two Sum", + description: + "Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.", + input: "nums = [2,7,11,15], target = 9", + output: "[0,1]", + }, + { + id: "6", + title: "Two Sum", + description: + "Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.", + input: "nums = [2,7,11,15], target = 9", + output: "[0,1]", + }, + { + id: "7", + title: "Two Sum", + description: + "Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.", + input: "nums = [2,7,11,15], target = 9", + output: "[0,1]", + }, + { + id: "8", + title: "Two Sum", + description: + "Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.", + input: "nums = [2,7,11,15], target = 9", + output: "[0,1]", + }, + { + id: "9", + title: "Two Sum", + description: + "Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.", + input: "nums = [2,7,11,15], target = 9", + output: "[0,1]", + }, + { + id: "10", + title: "Add Two Numbers", + description: + "You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order, and each of their nodes contains a single digit. Add the two numbers and return the sum as a linked list.", + input: "l1 = [2,4,3], l2 = [5,6,4]", + output: "[7,0,8]", + }, + { + id: "11", + title: "Add Two Numbers", + description: + "You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order, and each of their nodes contains a single digit. Add the two numbers and return the sum as a linked list.", + input: "l1 = [2,4,3], l2 = [5,6,4]", + output: "[7,0,8]", + }, + { + id: "12", + title: "Add Two Numbers", + description: + "You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order, and each of their nodes contains a single digit. Add the two numbers and return the sum as a linked list.", + input: "l1 = [2,4,3], l2 = [5,6,4]", + output: "[7,0,8]", + }, + { + id: "13", + title: "Add Two Numbers", + description: + "You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order, and each of their nodes contains a single digit. Add the two numbers and return the sum as a linked list.", + input: "l1 = [2,4,3], l2 = [5,6,4]", + output: "[7,0,8]", + }, + { + id: "14", + title: "Add Two Numbers", + description: + "You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order, and each of their nodes contains a single digit. Add the two numbers and return the sum as a linked list.", + input: "l1 = [2,4,3], l2 = [5,6,4]", + output: "[7,0,8]", + }, + { + id: "15", + title: "Add Two Numbers", + description: + "You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order, and each of their nodes contains a single digit. Add the two numbers and return the sum as a linked list.", + input: "l1 = [2,4,3], l2 = [5,6,4]", + output: "[7,0,8]", + }, + { + id: "16", + title: "Add Two Numbers", + description: + "You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order, and each of their nodes contains a single digit. Add the two numbers and return the sum as a linked list.", + input: "l1 = [2,4,3], l2 = [5,6,4]", + output: "[7,0,8]", + }, + { + id: "17", + title: "Add Two Numbers", + description: + "You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order, and each of their nodes contains a single digit. Add the two numbers and return the sum as a linked list.", + input: "l1 = [2,4,3], l2 = [5,6,4]", + output: "[7,0,8]", + }, + { + id: "18", + title: "Add Two Numbers", + description: + "You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order, and each of their nodes contains a single digit. Add the two numbers and return the sum as a linked list.", + input: "l1 = [2,4,3], l2 = [5,6,4]", + output: "[7,0,8]", + }, +]; const Problem = () => { const { id } = useParams(); + const problem = Problems.find((problem) => problem.id === id); + if (!problem) { + return
Problem not found
; + } + + const { title, description, input, output } = problem; + return (
-

Problem {id}

-
-

Title

-

title

-
-

Example

-

example

+

{title}

+

{description}

Input

-

input

+

{input}

Output

-

output

+

{output}

-

Explanation

-

explanation

+
- - + +
diff --git a/src/pages/ProblemList.jsx b/src/pages/ProblemList.jsx index 9c9f3a17..5cdf16af 100644 --- a/src/pages/ProblemList.jsx +++ b/src/pages/ProblemList.jsx @@ -13,49 +13,49 @@ const Problem1 = [ id: 2, Title: "Two Sum", Acceptance: "67.8%", - difficulty: "Medium", + difficulty: "Easy", }, { id: 3, Title: "Two Sum", Acceptance: "67.8%", - difficulty: "Medium", + difficulty: "Easy", }, { id: 4, Title: "Two Sum", Acceptance: "67.8%", - difficulty: "Medium", + difficulty: "Easy", }, { id: 5, Title: "Two Sum", Acceptance: "67.8%", - difficulty: "Medium", + difficulty: "Easy", }, { id: 6, Title: "Two Sum", Acceptance: "67.8%", - difficulty: "Medium", + difficulty: "Easy", }, { id: 7, Title: "Two Sum", Acceptance: "67.8%", - difficulty: "Medium", + difficulty: "Easy", }, { id: 8, Title: "Two Sum", Acceptance: "67.8%", - difficulty: "Medium", + difficulty: "Easy", }, { id: 9, Title: "Two Sum", Acceptance: "67.8%", - difficulty: "Medium", + difficulty: "Easy", }, ]; @@ -174,6 +174,7 @@ const ProblemList = () => { fontSize: "14px", padding: "6px 12px", marginRight: "10px", + width: "40px", }} > 1 @@ -183,6 +184,7 @@ const ProblemList = () => { style={{ fontSize: "14px", padding: "6px 12px", + width: "40px", }} > 2