generated from RealDevSquad/website-template
-
Notifications
You must be signed in to change notification settings - Fork 64
Feature Added Sidebar. #274
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
Open
ivinayakg
wants to merge
20
commits into
RealDevSquad:develop
Choose a base branch
from
ivinayakg:feature/new-sidebar
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
7bb0bcd
Sync main with develop (#249)
akshay1502 0d35066
added contstants and image
ivinayakg 4d7da41
fixed sidebar files
ivinayakg 3e19883
fixed the sidebar
ivinayakg f82eed7
'Requested Changes Done'
ivinayakg 5505754
fixed typo
ivinayakg ba14b6c
Merge branch 'develop' into feature/new-sidebar
MehulKChaudhari 944e08f
responsivness added
ivinayakg 2f0e329
Add: Move to yarn (#289)
MehulKChaudhari 955df28
*WIP* Add: cypress tests setup (#276)
MehulKChaudhari fc04834
add: msw (#288)
MehulKChaudhari 9feaa96
Feature/integrating-new-signup-flow (#293)
ranitasahaa1230 22d8795
Sync main with develop (#249)
akshay1502 752bcf2
added contstants and image
ivinayakg 1a89d49
fixed sidebar files
ivinayakg 0a53637
fixed the sidebar
ivinayakg def0ffb
'Requested Changes Done'
ivinayakg 72bd58e
fixed typo
ivinayakg 9cbf66b
responsivness added
ivinayakg 125e025
Merge branch 'feature/new-sidebar' of https://github.com/ivinayakg/we…
ivinayakg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,39 +1,46 @@ | ||
| { | ||
| "env": { | ||
| "browser": true, | ||
| "commonjs": true, | ||
| "es6": true, | ||
| "node": true, | ||
| "jest": true | ||
| }, | ||
| "plugins": [ | ||
| "react", | ||
| "react-hooks", | ||
| "jest", | ||
| "better-styled-components" | ||
| ], | ||
| "extends": ["eslint:recommended", "plugin:react/recommended", "plugin:prettier/recommended"], | ||
| "parserOptions": { | ||
| "sourceType": "module", | ||
| "ecmaVersion": 12 | ||
| }, | ||
| "settings": { | ||
| "react": { | ||
| "version": "detect" | ||
| } | ||
| }, | ||
| "rules": { | ||
| "linebreak-style": ["warn", "unix"], | ||
| "no-unused-vars" : "warn", | ||
| "react-hooks/rules-of-hooks": "error", | ||
| "react-hooks/exhaustive-deps": "warn", | ||
| "react/react-in-jsx-scope": "off", | ||
| "react/prop-types": "off", | ||
| "jest/no-disabled-tests": "warn", | ||
| "jest/no-focused-tests": "error", | ||
| "jest/no-identical-title": "error", | ||
| "jest/prefer-to-have-length": "warn", | ||
| "jest/valid-expect": "error", | ||
| "better-styled-components/sort-declarations-alphabetically": "warn" | ||
| "env": { | ||
| "browser": true, | ||
| "commonjs": true, | ||
| "es6": true, | ||
| "node": true, | ||
| "jest": true | ||
| }, | ||
| "plugins": [ | ||
| "react", | ||
| "react-hooks", | ||
| "jest", | ||
| "better-styled-components", | ||
| "cypress" | ||
| ], | ||
| "extends": [ | ||
| "eslint:recommended", | ||
| "plugin:react/recommended", | ||
| "plugin:prettier/recommended", | ||
| "plugin:cypress/recommended" | ||
| ], | ||
| "parserOptions": { | ||
| "sourceType": "module", | ||
| "ecmaVersion": 12 | ||
| }, | ||
| "settings": { | ||
| "react": { | ||
| "version": "detect" | ||
| } | ||
| } | ||
| }, | ||
| "rules": { | ||
| "linebreak-style": ["warn", "unix"], | ||
| "no-unused-vars": "warn", | ||
| "react-hooks/rules-of-hooks": "error", | ||
| "react-hooks/exhaustive-deps": "warn", | ||
| "react/react-in-jsx-scope": "off", | ||
| "react/prop-types": "off", | ||
| "jest/no-disabled-tests": "warn", | ||
| "jest/no-focused-tests": "error", | ||
| "jest/no-identical-title": "error", | ||
| "jest/prefer-to-have-length": "warn", | ||
| "jest/valid-expect": "error", | ||
| "better-styled-components/sort-declarations-alphabetically": "warn", | ||
| "react/no-unknown-property": "warn" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,3 +34,5 @@ yarn-error.log* | |
| # vercel | ||
| .vercel | ||
|
|
||
| cypress/videos | ||
| cypress/screenshots | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| import mockAxios from 'jest-mock-axios'; | ||
| export default mockAxios; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| import { setupWorker } from 'msw'; | ||
| import handlers from './handlers'; | ||
|
|
||
| export const worker = setupWorker(...handlers); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| module.exports = 'test-file-stub'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| import testHandlers from './handlers/test.handler'; | ||
|
|
||
| const handlers = [...testHandlers]; | ||
|
|
||
| export default handlers; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| import { rest } from 'msw'; | ||
| const URL = process.env.NEXT_PUBLIC_BASE_URL; | ||
|
|
||
| const testHandlers = [ | ||
| rest.get(`${URL}/test`, (_, res, ctx) => { | ||
| return res( | ||
| ctx.status(200), | ||
| ctx.json({ | ||
| message: 'Test returned successfully!', | ||
| }) | ||
| ); | ||
| }), | ||
| ]; | ||
|
|
||
| export default testHandlers; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| async function initMocks() { | ||
| if (typeof window === 'undefined') { | ||
| const { server } = await import('./server'); | ||
| server.listen(); | ||
| } else { | ||
| const { worker } = await import('./browser'); | ||
| worker.start(); | ||
| } | ||
| } | ||
|
|
||
| initMocks(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| import { setupServer } from 'msw/node'; | ||
| import handlers from './handlers'; | ||
|
|
||
| export const server = setupServer(...handlers); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "name": "Using fixtures to represent data", | ||
| "email": "hello@cypress.io", | ||
| "body": "Fixtures are a great way to mock data for responses to routes" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| describe('Navigation', () => { | ||
| it('should navigate to the about page', () => { | ||
| // Start from the index page | ||
| cy.visit('/'); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| // *********************************************** | ||
| // This example commands.js shows you how to | ||
| // create various custom commands and overwrite | ||
| // existing commands. | ||
| // | ||
| // For more comprehensive examples of custom | ||
| // commands please read more here: | ||
| // https://on.cypress.io/custom-commands | ||
| // *********************************************** | ||
| // | ||
| // | ||
| // -- This is a parent command -- | ||
| // Cypress.Commands.add('login', (email, password) => { ... }) | ||
| // | ||
| // | ||
| // -- This is a child command -- | ||
| // Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... }) | ||
| // | ||
| // | ||
| // -- This is a dual command -- | ||
| // Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... }) | ||
| // | ||
| // | ||
| // -- This will overwrite an existing command -- | ||
| // Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| // *********************************************************** | ||
| // This example support/e2e.js is processed and | ||
| // loaded automatically before your test files. | ||
| // | ||
| // This is a great place to put global configuration and | ||
| // behavior that modifies Cypress. | ||
| // | ||
| // You can change the location of this file or turn off | ||
| // automatically serving support files with the | ||
| // 'supportFile' configuration option. | ||
| // | ||
| // You can read more here: | ||
| // https://on.cypress.io/configuration | ||
| // *********************************************************** | ||
|
|
||
| // Import commands.js using ES2015 syntax: | ||
| import './commands'; | ||
|
|
||
| // Alternatively you can use CommonJS syntax: | ||
| // require('./commands') |
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| import styles from './sidebar.module.css'; | ||
| import { useRouter } from 'next/router'; | ||
| import Image from 'next/image'; | ||
| import sidebarMenuOptions from 'constants/sidebarMenuOptions'; | ||
| import { useState } from 'react'; | ||
|
|
||
| const Sidebar = () => { | ||
| const [mobileToggle, setMobileToggle] = useState(false); | ||
| const router = useRouter(); | ||
| const navigateTo = (url) => router.push(url); | ||
|
|
||
| const basePath = router.pathname; | ||
| const pagePath = router.pathname.split('/')[1]; | ||
|
|
||
| const activeOptionClass = (optionURL) => | ||
| pagePath === optionURL || (basePath === '/' && '/' === optionURL) | ||
| ? ' ' + styles.option_active | ||
| : ''; | ||
|
|
||
| return ( | ||
| <div className={styles.wrapper} data-testid="sidebar-notification"> | ||
| <div | ||
| className={ | ||
| styles.mobileToggle + | ||
| ` ${mobileToggle ? styles['mobileToggle--active'] : ''}` | ||
| } | ||
| onClick={() => setMobileToggle((prev) => !prev)} | ||
| > | ||
| <h3>Menu</h3> | ||
| <Image src="/assets/MenuArrow.svg" width={25} height={25} /> | ||
| </div> | ||
|
|
||
| <aside className={styles.sidebar}> | ||
| <span className={styles.heading}> | ||
| <Image src={'/assets/Real-Dev-Squad1x.png'} width={50} height={50} /> | ||
| <h3>RealDevSquad</h3> | ||
| </span> | ||
| <div className={styles.options}> | ||
| {sidebarMenuOptions.map((option, index) => { | ||
| const optionPath = option.urlPath; | ||
| return ( | ||
| <span | ||
| key={index} | ||
| // this code below insure even if we are in nested path like currency-exchange/**/ | ||
| //even then the link is active | ||
| className={styles.option + activeOptionClass(optionPath)} | ||
| onClick={() => navigateTo(optionPath)} | ||
| > | ||
| <Image | ||
| src={option.iconPath} | ||
| className={styles.option_image} | ||
| width={25} | ||
| height={25} | ||
| /> | ||
| <p>{option.name}</p> | ||
| <span className={styles.option_bar}></span> | ||
| </span> | ||
| ); | ||
| })} | ||
| </div> | ||
|
|
||
| <div className={styles.buttonWrapper}> | ||
| {router.pathname !== '/currency-exchange' && ( | ||
| <button className={styles.button}> | ||
| <Image src="/assets/InfoSquare.svg" width={25} height={25} /> | ||
| Trade Now | ||
| </button> | ||
| )} | ||
| <button className={styles.button}> | ||
| <Image src="/assets/InfoSquare.svg" width={25} height={25} /> | ||
| Guide | ||
| </button> | ||
| </div> | ||
| </aside> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default Sidebar; | ||
|
|
||
| //pure TDD | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.