Skip to content

Commit 2418c1b

Browse files
committed
new tab for videos
1 parent d9accf3 commit 2418c1b

File tree

4 files changed

+54
-1
lines changed

4 files changed

+54
-1
lines changed

client/src/Components/Navigation/HomeNav/HomeNav.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from 'react';
22
import PropTypes from 'prop-types';
33
import { connect } from 'react-redux';
44
import { Link } from 'react-router-dom';
5+
import { getVideosUrl } from 'utils';
56
import NavItem from '../NavItem/NavItem';
67
import Avatar from '../../UI/Avatar/Avatar';
78
import DropdownNavItem from '../DropdownNavItem';
@@ -33,9 +34,32 @@ const Navbar = ({ page, user, loggedIn, isDark, toggleAdmin }) => {
3334
});
3435
}
3536

37+
const _handleExternalLinkClick = (url) => {
38+
window.open(url, '_blank', 'noopener,noreferrer');
39+
};
40+
41+
const _videoButton = () => {
42+
return (
43+
<button
44+
onClick={() => _handleExternalLinkClick(getVideosUrl())}
45+
style={{
46+
border: 'none',
47+
fontSize: 'inherit',
48+
fontFamily: 'inherit',
49+
background: 'inherit',
50+
color: 'inherit',
51+
fontWeight: 'inherit',
52+
}}
53+
>
54+
Videos
55+
</button>
56+
);
57+
};
58+
3659
const aboutList = [
3760
{ name: 'About', link: '/about' },
3861
{ name: 'Instructions', link: '/instructions' },
62+
{ name: 'Videos', sliderDetails: { customComponent: _videoButton() } },
3963
{ name: 'FAQ', link: '/faq' },
4064
{ name: 'Contact', link: '/contact' },
4165
];

client/src/Components/Navigation/NavItem/NavItem.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ const NavItem = ({ name, link, ntf, sliderDetails, pattern }) => {
1717
const dataName = typeof name === 'string' ? name : 'profile';
1818

1919
if (sliderDetails) {
20-
const { isOn, onClick } = sliderDetails;
20+
const { isOn, onClick, customComponent } = sliderDetails;
21+
if (customComponent) return <div className={style}>{customComponent}</div>;
2122
return (
2223
<div className={style}>
2324
<Checkbox checked={isOn} change={onClick} dataId={`nav-${dataName}`}>
@@ -47,6 +48,7 @@ NavItem.propTypes = {
4748
sliderDetails: PropTypes.shape({
4849
isOn: PropTypes.bool,
4950
onClick: PropTypes.func,
51+
customComponent: PropTypes.element,
5052
}),
5153
};
5254

client/src/Components/Navigation/Navbar.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
33
import { Link, withRouter } from 'react-router-dom';
4+
import { getVideosUrl } from 'utils';
45
import NavItem from './NavItem/NavItem';
56
import DropdownNavItem from './DropdownNavItem';
67
import classes from './navbar.css';
@@ -30,9 +31,32 @@ const Navbar = ({ user, location, toggleAdmin }) => {
3031
styles = classes.EditorNavContainer;
3132
}
3233

34+
const _handleExternalLinkClick = (url) => {
35+
window.open(url, '_blank', 'noopener,noreferrer');
36+
};
37+
38+
const _videoButton = () => {
39+
return (
40+
<button
41+
onClick={() => _handleExternalLinkClick(getVideosUrl())}
42+
style={{
43+
border: 'none',
44+
fontSize: 'inherit',
45+
fontFamily: 'inherit',
46+
background: 'inherit',
47+
color: 'inherit',
48+
fontWeight: 'inherit',
49+
}}
50+
>
51+
Videos
52+
</button>
53+
);
54+
};
55+
3356
const aboutList = [
3457
{ name: 'About', link: '/about' },
3558
{ name: 'Instructions', link: '/instructions' },
59+
{ name: 'Videos', sliderDetails: { customComponent: _videoButton() } },
3660
{ name: 'FAQ', link: '/faq' },
3761
{ name: 'Contact', link: '/contact' },
3862
];

client/src/utils/appUrls.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,6 @@ export const getGoogleUrl = () => {
1515

1616
export const getDesmosActivityUrl = (code) =>
1717
`https://teacher.desmos.com/activitybuilder/custom/${code}`;
18+
19+
export const getVideosUrl = () =>
20+
'https://drive.google.com/drive/folders/1WbYYSlV0si0G8Odeuh1giR222qkkG-7M';

0 commit comments

Comments
 (0)