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

Dark mode #242

Open
wants to merge 17 commits into
base: develop
Choose a base branch
from
Open

Dark mode #242

wants to merge 17 commits into from

Conversation

shubham-y
Copy link
Contributor

Closes #239

@shubham-y shubham-y self-assigned this Oct 21, 2021
@shubham-y shubham-y added feature task A big ticket item that needs to come up as a feature frontend labels Oct 21, 2021
components/Dark-Theme/useDarkMode.js Outdated Show resolved Hide resolved
components/Dark-Theme/useDarkMode.js Outdated Show resolved Hide resolved
components/Dark-Theme/useDarkMode.js Outdated Show resolved Hide resolved
@shubham-y
Copy link
Contributor Author

After changes

updated-dark-mode.mp4

@shubham-y shubham-y marked this pull request as ready for review November 5, 2021 13:36
Copy link
Contributor

@prakashchoudhary07 prakashchoudhary07 left a comment

Choose a reason for hiding this comment

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

Wow, this is Great PR 🎉 🎉

@shubham-y
Copy link
Contributor Author

Made changes to use the cookie as a feature flag

dark-mode-update_m07JVukg.mp4

Copy link
Contributor

@rohan09-raj rohan09-raj left a comment

Choose a reason for hiding this comment

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

@shubham-y Have you removed the implementation of Icons ??

components/custom-button/custom-button.style.js Outdated Show resolved Hide resolved
rohan09-raj
rohan09-raj previously approved these changes Apr 19, 2022
Copy link
Contributor

@rohan09-raj rohan09-raj left a comment

Choose a reason for hiding this comment

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

Looks good to me , approving the PR

Copy link

@Neha Neha left a comment

Choose a reason for hiding this comment

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

Code review is in WIP

border: 0.5px solid #ccc;
border: 0.5px solid var(--colorAuctionInput);
background-color: var(--colorBackgroundDark);
color: var(--colorWhite);
border-radius: 5px;
padding: 10px;
padding-left: 10px;
Copy link

Choose a reason for hiding this comment

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

repetitive code. Please remove padding-left

.inputBox:disabled{
background-color: var(--colorBackgroundLight);
}

.submitBtn {
cursor: pointer;
background-color: rgb(27, 199, 27);
color: white;
Copy link

Choose a reason for hiding this comment

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

Consistency is missing in colour value declarations: either use rgb or name of color of code of color.
Go with RGBA as it is easy to control the alpha value.

@@ -0,0 +1,48 @@
export const lightTheme = {
colorBackgroundLight: '#f4f4f4',
Copy link

Choose a reason for hiding this comment

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

Light/medium/Dark has same value. Why to make 2 variables for the same value?

colorExchangeBackground: 'aliceblue',
colorBodyBackground: '#e9ebff',
colorText: '#363636',
colorTransactionBorder: '#f0e2e7',
Copy link

Choose a reason for hiding this comment

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

From there onwards, variable names are tied with the component. Make generic names for the variables.

colorButtonBorder: 'white',
colorFilterHover: '#bdc3c7',
colorAuctionBackground: 'rgb(245, 235, 235)',
colorWhite: 'black',
Copy link

Choose a reason for hiding this comment

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

name is colorWhite but the value is black. Please correct this

@@ -12,6 +14,7 @@ const NavBar = () => {
const RDS_LOGO = '/assets/Real-Dev-Squad1x.png';
const GITHUB_LOGO = '/assets/github.png';
const DEFAULT_AVATAR = '/assets/default_avatar.jpg';
const [theme, themeData, themeToggler] = useDarkModeContext();
Copy link

Choose a reason for hiding this comment

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

From there themeData is not getting used anywhere

@@ -12,6 +14,7 @@ const NavBar = () => {
const RDS_LOGO = '/assets/Real-Dev-Squad1x.png';
Copy link

Choose a reason for hiding this comment

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

Move all the assests URL to constant


function DarkThemeIcon({ theme, themeToggleHandler }) {
return (
<div
Copy link

Choose a reason for hiding this comment

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

This should be button and not DIV

className={classNames.container}
>
{theme === 'light' ? (
<img src="/assets/moon.png" alt="moon" />
Copy link

Choose a reason for hiding this comment

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

this should come from constant also alt tag is wrong.

{theme === 'light' ? (
<img src="/assets/moon.png" alt="moon" />
) : (
<img src="/assets/sun.png" alt="sun" />
Copy link

Choose a reason for hiding this comment

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

this should come from constant

}
setMountedComponent(true);
}, []);
return [theme, themeData, themeToggler, mountedComponent];
Copy link

Choose a reason for hiding this comment

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

We should return the Object from here. This will help us to destruct values based on keys. Then we can avoid getting all values (even if we don't need them) and we can get them in any order

:root{
${({ theme }) => {
let style = ``;
for (const variableName in theme) {
Copy link

Choose a reason for hiding this comment

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

The name should property rather then variableName

@@ -2,8 +2,10 @@ import styles from './filter.module.css';
import Image from 'next/image';
import { useState, useRef } from 'react';
Copy link

Choose a reason for hiding this comment

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

Always have React import on the top.
Then the rest of the importa

src="/assets/filter-icon.svg"
src={
theme === 'light'
? '/assets/filter-icon.svg'
Copy link

Choose a reason for hiding this comment

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

Move the image src and the content to constant file. This logic could be a component as reusable. This is also getting used in Nav components also.

theme === 'light'
? '/assets/filter-icon.svg'
: '/assets/filter-icon-dark.svg'
}
alt="Filter icon"
width={20}
Copy link

Choose a reason for hiding this comment

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

width and height should come from constant. As well, the UL should come dynamic. create an Object with the list of options required... coop over it to create a List and then bind the event on it. Avoid doing any hardcoding of the content

@@ -182,6 +187,10 @@
float: none;
Copy link

Choose a reason for hiding this comment

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

We should not be using float at all.

@@ -77,13 +77,13 @@ export const Card = ({ stock, operationType }) => {
text-align: center;
width: 100%;
padding: 1rem;
background-color: #ffffff;
background-color: var(--colorBackgroundMedium);
}

.stock-card-product-name {
Copy link

Choose a reason for hiding this comment

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

Class name format is not consistent. Use camelCase

@@ -5,23 +5,44 @@ import { Footer } from '@components/footer';
import Head from 'next/head';
import HandleAuctions from '@components/Auction';
import styles from '@components/Auction/Auction.module.css';
import GlobalStyles from '@components/Dark-Theme/globalStyles';
import { ThemeProvider } from 'styled-components';
Copy link

Choose a reason for hiding this comment

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

Move the 3rd party imports on the top of the component

<ThemeProvider theme={themeData}>
<>
<GlobalStyles />
<div>
Copy link

Choose a reason for hiding this comment

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

DIV should start from the Navbar rather than before HEAD

/>
</Head>
<NavBar personData={personData} />
<Link href="/auction">
Copy link

Choose a reason for hiding this comment

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

Either use Link or a. Both should not be used together. Use Link for routing and for 3rd party use a tag

<NavBar personData={personData} />
<Link href="/auction">
<a>
<h2 className={styles.auctionPageNavigation}>Go Back</h2>
Copy link

Choose a reason for hiding this comment

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

Move the content to constant file

<CreateNewAuction />
<Footer />
</div>
</>
Copy link

Choose a reason for hiding this comment

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

If you are wrapping with DIV tag then you don't need Fragment tags

@@ -5,23 +5,42 @@ import { Footer } from '@components/footer';
import Head from 'next/head';
import CreateNewAuction from '@components/Auction/createNewAuction';
import styles from '@components/Auction/Auction.module.css';
import GlobalStyles from '@components/Dark-Theme/globalStyles';
import { ThemeProvider } from 'styled-components';
Copy link

Choose a reason for hiding this comment

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

Move this on the top

<ThemeProvider theme={themeData}>
<>
<GlobalStyles />
<div>
Copy link

Choose a reason for hiding this comment

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

Div should be moved after Head closing. As well as the fragment is not required. Make Head part as a reusable component to re-use

<Link href="/auction/new">
<div className={styles.newAuctionBtnContainer}>
<button className={styles.newAuctionBtn}>
Create New Auction
Copy link

Choose a reason for hiding this comment

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

Move this to constant

@MehulKChaudhari
Copy link
Member

MehulKChaudhari commented Jul 7, 2022

Hey @shubham-y, Could you make suggested changes or are you working on something else?

@MehulKChaudhari MehulKChaudhari added the Stale Not needed at the moment. label Jul 15, 2022
@MehulKChaudhari
Copy link
Member

As we are changing the UI of the crypto site. We don't need these changes at the moment. So I am marking this as stale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature task A big ticket item that needs to come up as a feature frontend Stale Not needed at the moment.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dark Mode for Crypto site
6 participants