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

Feature: Add dark mode #3

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
18 changes: 16 additions & 2 deletions src/App.scss
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@

textarea,
input {
background-color: var(--background-color);
color: var(--text-color);
font-size: 20px;
font-weight: 500;
color: #868e96;
Expand All @@ -93,7 +95,7 @@

.encrypt,
.decrypt {
background: none;
//background: none;
border: none;
font-size: 20px;
padding: 5px;
Expand All @@ -104,7 +106,19 @@
border-bottom: 3px solid #0c8599;
}
}

.dark-mode-toggle {
background: #03071e;
color: #fff; // Adjust text color for better contrast
padding: 10px;
margin: 5px;
cursor: pointer;
border: none;
font-size: 16px;

&:hover {
background: #1a1a1a; // Adjust hover color if needed
}
}
.encrypt-btn,
.decrypt-btn {
background: #1098ad;
Expand Down
6 changes: 4 additions & 2 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@ import EncryptView from "./EncryptView";
import clsx from "clsx";
import GitHubCorner from "./GithubCorner";
import Footer from "./Footer";

import DarkModeToggle from './DarkModeToggle';
const VIEW = {
ENCRYPT: 0,
DECRYPT: 1,
};
function App() {
const App: React.FC = () => {
const [activeView, setActiveView] = useState(VIEW.ENCRYPT);
return (
<div className="App">
<div className="darkwave" style={{ position: "absolute" , left: 0}}>
<DarkModeToggle /></div>
<GitHubCorner />
<h1 style={{ color: "#0b7285" }}>Cryptmoji</h1>
<h3>Encrypt your messages into Emojis, Latin and Math Symbols</h3>
Expand Down
31 changes: 31 additions & 0 deletions src/DarkModeToggle.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

.dark-mode {
--background-color: #000000;
--text-color: #fff;
}
body {
background-color: var(--background-color);
color: var(--text-color);
}
// Add these styles for input fields in both light and dark modes
input {
font-size: 20px;
font-weight: 500;
color: #868e96;
font-weight: bold;
border: none;
border-radius: 0.25rem;
box-shadow: 0 0 0 1px #aaa;

&.dark-mode {
color: #fff; // Adjust text color for dark mode
background-color: #555; // Adjust background color for dark mode
}
}

// Add these styles for radio buttons in both light and dark modes
input[type="radio"] {
box-shadow: none;


}
21 changes: 21 additions & 0 deletions src/DarkModeToggle.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// DarkModeToggle.tsx

import React, { useState } from 'react';
import './DarkModeToggle.scss';

const DarkModeToggle: React.FC = () => {
const [isDarkMode, setIsDarkMode] = useState(false);

const toggleDarkMode = () => {
setIsDarkMode((prevMode) => !prevMode);
document.body.classList.toggle('dark-mode');
};

return (
<button className="dark-mode-toggle" onClick={toggleDarkMode}>
{isDarkMode ? 'Light Mode' : 'Dark Mode'}
</button>
);
};

export default DarkModeToggle;