-
Notifications
You must be signed in to change notification settings - Fork 0
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
Feat/plus icon shortcut #22
base: main
Are you sure you want to change the base?
Changes from 8 commits
fdef9ea
ec2cc67
679a74e
df2c4c1
c9578a4
de75010
2c9cd7d
38655c4
24bec4d
fa033ba
1614e42
684c141
e667953
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,7 @@ describe('Landing page after logging in spec', () => { | |
|
||
cy.get('[href="https://www.google.com/search?q=papers"] >.m-auto').should('have.attr', 'src').should('include', 'VORK5CYII') | ||
|
||
cy.get('[href="https://www.google.com/search?q=plus"] > .m-auto').should('have.attr', 'src').should('include', 'SuQmCC') | ||
cy.get('button.m-auto > .m-auto').should('have.attr', 'src').should('include', 'SuQmCC') | ||
|
||
cy.get('[href="https://www.google.com/search?q=account"] > .m-auto').should('have.attr', 'src').should('include', '/static/media/person-icon.7a1fafe972143cff67a1.png') | ||
|
||
|
@@ -49,15 +49,38 @@ describe('Landing page after logging in spec', () => { | |
cy.url('match', 'https://www.google.com/search?q=papers'); | ||
cy.visit('http://localhost:3000/') | ||
|
||
cy.get('[href="https://www.google.com/search?q=plus"]').click() | ||
cy.url('match', 'https://www.google.com/search?q=plus'); | ||
cy.visit('http://localhost:3000/') | ||
|
||
cy.get('[href="https://www.google.com/search?q=account"]').click() | ||
cy.url('match', 'https://www.google.com/search?q=account'); | ||
cy.visit('http://localhost:3000/') | ||
|
||
}) | ||
|
||
|
||
describe('DropDown Menu', () => { | ||
it('has container for dropdown elements', () => { | ||
cy.visit('http://localhost:3000/') | ||
cy.get('button.m-auto > .m-auto').click() | ||
cy.get('.dropDownPlus').should('exist'); | ||
}) | ||
it('should render dropdown menu with link to create new contact', () => { | ||
cy.visit('http://localhost:3000/') | ||
cy.get('button.m-auto > .m-auto').click() | ||
cy.contains('Create New Contact').should('exist'); | ||
cy.get('.bg-cyan-600 > :nth-child(1) > a').click() | ||
cy.url('match', 'http://localhost:3000/contacts/new'); | ||
}) | ||
it('should render dropdown menu with link to create new company', () => { | ||
cy.visit('http://localhost:3000/') | ||
cy.get('button.m-auto > .m-auto').click() | ||
cy.contains('Create New Company').should('exist'); | ||
cy.get('.bg-cyan-600 > :nth-child(2) > a').click() | ||
cy.url('match', 'http://localhost:3000/companies/new'); | ||
}) | ||
it('should render dropdown menu with link to create new contact', () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this should say job application instead of "new contact" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch, thanks. Fixed. |
||
cy.visit('http://localhost:3000/') | ||
cy.get('button.m-auto > .m-auto').click() | ||
cy.contains('Create New Job Application').should('exist'); | ||
cy.get('.bg-cyan-600 > :nth-child(3) > a').click() | ||
cy.url('match', 'http://localhost:3000/jobapplications/new'); | ||
}) | ||
}) | ||
}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. idk if i'm missing this in the tests but you are testing for the presence of dropdown elements, may be worth testing the isDropDownOpen state directly just to check it's being toggled as expected. I might of missed it in your code. Correct me if i'm wrong. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,10 +3,17 @@ import logo from '../../turing-logo-gray.png'; | |
import person from '../../components/icons/person-icon.png'; | ||
import building from '../../components/icons/building-1062.png'; | ||
import plus from '../../components/icons/plus-small_4338829.png'; | ||
import plusOpen from '../../components/icons/plus-open.png'; | ||
import papers from '../../components/icons/documents-symbol_35920.png'; | ||
import { useState } from 'react'; | ||
import { Link } from 'react-router-dom'; | ||
|
||
|
||
function MenuBar() { | ||
const [isDropDownOpen, setIsDropDownOpen] = useState(false) | ||
const toggleDropDown = () => { | ||
setIsDropDownOpen((previousState) => !previousState) | ||
} | ||
|
||
return ( | ||
|
||
|
@@ -32,15 +39,34 @@ function MenuBar() { | |
</a> | ||
<a className="m-auto cursor-pointer" href="https://www.google.com/search?q=papers"> | ||
|
||
<img className="m-auto w-1/4 cursor-pointer" src={papers}> | ||
</img> | ||
<img className="m-auto w-1/4 cursor-pointer" src={papers}> | ||
</img> | ||
</a> | ||
|
||
<a className="m-auto cursor-pointer" href="https://www.google.com/search?q=plus"> | ||
<div className='dropDownPlus'> | ||
<button className="m-auto cursor-pointer" onClick={toggleDropDown}> | ||
<img | ||
className="m-auto w-1/4 cursor-pointer" | ||
src={isDropDownOpen ? plusOpen : plus} | ||
alt="Teal Plus Icon" | ||
/> | ||
</button> | ||
|
||
{isDropDownOpen && ( | ||
<ul className="bg-cyan-600 m-4 shadow-md rounded-md"> | ||
<li className="p-2 hover:bg-gray-200 rounded text-center mb-2"> | ||
<Link to="/newContact">Create New Contact</Link> | ||
</li> | ||
<li className="p-2 hover:bg-gray-200 rounded text-center mb-2"> | ||
<Link to="/companies/new">Create New Company</Link> | ||
</li> | ||
<li className="p-2 hover:bg-gray-200 rounded text-center"> | ||
<Link to="/jobapplications/new">Create New Job Application</Link> | ||
</li> | ||
</ul> | ||
)} | ||
</div> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just a suggestion not a pressing fix : When the dropdown is opened or closed, adding a small animation or transition to enhance the user experience. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I completely agree, I attempted to find something on tailwind, but was unable to get a transition to work. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does tailwind offer an invisible and visible style where you can always render the elements but conditionally rendering the styles? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. try this - I see it having a very smooth transition in and out
|
||
|
||
<img className="m-auto w-1/4 cursor-pointer" src={plus}> | ||
</img> | ||
</a> | ||
<a className="m-auto cursor-pointer" href="https://www.google.com/search?q=account"> | ||
|
||
<img className="m-auto w-1/5 rounded-full bg-blue-200 cursor-pointer" src={person}> | ||
|
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.
You had me at "HEY YOU!!!!!" Great addition to the readme and instructions to boot!