-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #92 from RGPosadas/TASK-12/discovery-page-tabs
TASK-12: discovery page tabs
- Loading branch information
Showing
14 changed files
with
451 additions
and
161 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains 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 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 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 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 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
35 changes: 35 additions & 0 deletions
35
...ull-ui/src/app/components/subnavigation-bar/__snapshots__/subnavigation-bar.spec.tsx.snap
This file contains 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,35 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`SubNavigationBar should match snapshot 1`] = ` | ||
<div | ||
className="subnavigation-container" | ||
> | ||
<a | ||
aria-current={null} | ||
className="subnavigation-link" | ||
data-testid="subnavigation-discover-button" | ||
href="/home/discover" | ||
onClick={[Function]} | ||
> | ||
Discover | ||
</a> | ||
<a | ||
aria-current={null} | ||
className="subnavigation-link" | ||
data-testid="subnavigation-upcoming-button" | ||
href="/home/upcoming" | ||
onClick={[Function]} | ||
> | ||
Upcoming | ||
</a> | ||
<a | ||
aria-current={null} | ||
className="subnavigation-link" | ||
data-testid="subnavigation-myEvents-button" | ||
href="/home/myevents" | ||
onClick={[Function]} | ||
> | ||
My Events | ||
</a> | ||
</div> | ||
`; |
23 changes: 23 additions & 0 deletions
23
apps/mull-ui/src/app/components/subnavigation-bar/subnavigation-bar.scss
This file contains 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,23 @@ | ||
@import 'variables'; | ||
@import 'styles'; | ||
|
||
.subnavigation-container { | ||
margin-top: 1rem; | ||
display: flex; | ||
justify-content: space-evenly; | ||
} | ||
|
||
.subnavigation-link { | ||
color: $inactive-button-color; | ||
} | ||
|
||
.active { | ||
color: $primary-color; | ||
font-weight: 600; | ||
} | ||
|
||
@media (min-width: $breakpoint-mobile) { | ||
.subnavigation-container { | ||
margin-top: 2.5rem; | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
apps/mull-ui/src/app/components/subnavigation-bar/subnavigation-bar.spec.tsx
This file contains 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,56 @@ | ||
import React from 'react'; | ||
import renderer from 'react-test-renderer'; | ||
import SubNavigationBar from './subnavigation-bar'; | ||
|
||
import { render } from '@testing-library/react'; | ||
import { createMemoryHistory } from 'history'; | ||
import { Router } from 'react-router-dom'; | ||
|
||
import { ROUTES } from '../../../constants'; | ||
|
||
describe('SubNavigationBar', () => { | ||
it('should render successfully', () => { | ||
const history = createMemoryHistory(); | ||
|
||
const { baseElement } = render( | ||
<Router history={history}> | ||
<SubNavigationBar /> | ||
</Router> | ||
); | ||
|
||
expect(baseElement).toBeTruthy(); | ||
}); | ||
|
||
it('should have the correct button active based on the url', () => { | ||
const testIds = { | ||
[ROUTES.DISCOVER]: 'subnavigation-discover-button', | ||
[ROUTES.UPCOMING]: 'subnavigation-upcoming-button', | ||
[ROUTES.MY_EVENTS]: 'subnavigation-myEvents-button', | ||
}; | ||
const history = createMemoryHistory(); | ||
|
||
const utils = render( | ||
<Router history={history}> | ||
<SubNavigationBar /> | ||
</Router> | ||
); | ||
|
||
for (const [key, value] of Object.entries(testIds)) { | ||
history.push(key); | ||
const button = utils.getByTestId(value); | ||
expect(button.classList.contains('active')); | ||
} | ||
}); | ||
|
||
it('should match snapshot', () => { | ||
const history = createMemoryHistory(); | ||
const tree = renderer | ||
.create( | ||
<Router history={history}> | ||
<SubNavigationBar /> | ||
</Router> | ||
) | ||
.toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
}); | ||
}); |
37 changes: 37 additions & 0 deletions
37
apps/mull-ui/src/app/components/subnavigation-bar/subnavigation-bar.tsx
This file contains 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,37 @@ | ||
import { ROUTES } from '../../../constants'; | ||
import React from 'react'; | ||
import { NavLink } from 'react-router-dom'; | ||
|
||
import './subnavigation-bar.scss'; | ||
|
||
export const SubNavigationBar = () => { | ||
return ( | ||
<div className="subnavigation-container"> | ||
<NavLink | ||
to={ROUTES.DISCOVER} | ||
className="subnavigation-link" | ||
data-testid="subnavigation-discover-button" | ||
> | ||
Discover | ||
</NavLink> | ||
<NavLink | ||
to={ROUTES.UPCOMING} | ||
className="subnavigation-link" | ||
activeClassName="active" | ||
data-testid="subnavigation-upcoming-button" | ||
> | ||
Upcoming | ||
</NavLink> | ||
<NavLink | ||
to={ROUTES.MY_EVENTS} | ||
className="subnavigation-link" | ||
activeClassName="active" | ||
data-testid="subnavigation-myEvents-button" | ||
> | ||
My Events | ||
</NavLink> | ||
</div> | ||
); | ||
}; | ||
|
||
export default SubNavigationBar; |
This file contains 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 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 |
---|---|---|
|
@@ -11,6 +11,10 @@ | |
border: 0; | ||
} | ||
|
||
a { | ||
text-decoration: none; | ||
} | ||
|
||
.error-message { | ||
display: block; | ||
margin-top: 5px; | ||
|
Oops, something went wrong.