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

Mode Change #129

Open
wants to merge 7 commits 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
2 changes: 2 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[submodule "Find-Me-Issues"]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the submodule needed in the final commit?

url = https://github.com/snehautekar05/Find-Me-Issues.git
1 change: 1 addition & 0 deletions Find-Me-Issues
Submodule Find-Me-Issues added at f8614f
16 changes: 16 additions & 0 deletions build/asset-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"files": {
"main.css": "/static/css/main.29b6ce29.css",
"main.js": "/static/js/main.6ab41bd1.js",
"static/js/453.5882d2f0.chunk.js": "/static/js/453.5882d2f0.chunk.js",
"static/media/git9.jpg": "/static/media/git9.39d31573bf846e5493e5.jpg",
"index.html": "/index.html",
"main.29b6ce29.css.map": "/static/css/main.29b6ce29.css.map",
"main.6ab41bd1.js.map": "/static/js/main.6ab41bd1.js.map",
"453.5882d2f0.chunk.js.map": "/static/js/453.5882d2f0.chunk.js.map"
},
"entrypoints": [
"static/css/main.29b6ce29.css",
"static/js/main.6ab41bd1.js"
]
}
Binary file added build/favicon.ico
Binary file not shown.
1 change: 1 addition & 0 deletions build/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Find github repositories containing good first issues"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"><title>Find Me Issues</title><script defer="defer" src="/static/js/main.6ab41bd1.js"></script><link href="/static/css/main.29b6ce29.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
Binary file added build/logo192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added build/logo512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions build/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason for adding all the default react icon set and config?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default icon set and manifest.json enable PWA functionality, ensuring proper display across devices, customizable theming, and future-readiness for app installation.

"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
3 changes: 3 additions & 0 deletions build/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:
7 changes: 7 additions & 0 deletions build/static/css/main.29b6ce29.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions build/static/css/main.29b6ce29.css.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions build/static/js/453.5882d2f0.chunk.js

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

1 change: 1 addition & 0 deletions build/static/js/453.5882d2f0.chunk.js.map

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

3 changes: 3 additions & 0 deletions build/static/js/main.6ab41bd1.js

Large diffs are not rendered by default.

73 changes: 73 additions & 0 deletions build/static/js/main.6ab41bd1.js.LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/*
object-assign
(c) Sindre Sorhus
@license MIT
*/

/*!
Copyright (c) 2018 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/

/**
* @license
* Lodash <https://lodash.com/>
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
* Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
*/

/**
* A better abstraction over CSS.
*
* @copyright Oleg Isonen (Slobodskoi) / Isonen 2014-present
* @website https://github.com/cssinjs/jss
* @license MIT
*/

/** @license React v0.20.2
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/** @license React v16.13.1
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/** @license React v17.0.2
* react-dom.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/** @license React v17.0.2
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/** @license React v17.0.2
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
1 change: 1 addition & 0 deletions build/static/js/main.6ab41bd1.js.map

Large diffs are not rendered by default.

Binary file added build/static/media/git9.39d31573bf846e5493e5.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 12 additions & 9 deletions src/Context/themeContext.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,38 @@
import { createContext, useState, useEffect, useMemo } from "react";

// Create ThemeContext
export const ThemeContext = createContext();

// Theme modes
const light = { mode: "light", color: "black", bg: "white" };
const dark = { mode: "dark", color: "white", bg: "#020300" };

// Get the system theme
// Function to get the initial theme (from localStorage or system preference)
const getInitialTheme = () => {
const savedTheme = JSON.parse(localStorage.getItem("theme"));
if (savedTheme) {
return savedTheme;
}
return window.matchMedia("(prefers-color-scheme: dark)").matches
? dark
: light;
if (savedTheme) return savedTheme;

return window.matchMedia("(prefers-color-scheme: dark)").matches ? dark : light;
};

// ThemeProvider component
export function ThemeProvider({ children }) {
const [theme, setTheme] = useState(getInitialTheme());
const [theme, setTheme] = useState(getInitialTheme);

// Handle theme change
const changeTheme = () => {
const newTheme = theme.mode === "light" ? dark : light;
setTheme(newTheme);
localStorage.setItem("theme", JSON.stringify(newTheme));
};

// Apply theme to the document body when the theme changes
useEffect(() => {
localStorage.setItem("theme", JSON.stringify(theme));
document.body.style.backgroundColor = theme.bg;
document.body.style.color = theme.color;
}, [theme]);

// Memoize context value to avoid unnecessary re-renders
const contextValue = useMemo(() => ({ theme, changeTheme }), [theme]);

return (
Expand Down