-
Notifications
You must be signed in to change notification settings - Fork 64
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
base: develop
Are you sure you want to change the base?
Dark mode #242
Conversation
After changes updated-dark-mode.mp4 |
There was a problem hiding this 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 🎉 🎉
Made changes to use the cookie as a feature flag dark-mode-update_m07JVukg.mp4 |
There was a problem hiding this 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 ??
There was a problem hiding this 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
There was a problem hiding this 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; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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', |
There was a problem hiding this comment.
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', |
There was a problem hiding this comment.
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', |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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'; |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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" /> |
There was a problem hiding this comment.
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" /> |
There was a problem hiding this comment.
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]; |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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'; |
There was a problem hiding this comment.
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' |
There was a problem hiding this comment.
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} |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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'; |
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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"> |
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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> | ||
</> |
There was a problem hiding this comment.
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'; |
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this to constant
Hey @shubham-y, Could you make suggested changes or are you working on something else? |
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. |
Closes #239