Skip to content

Commit 188a0ed

Browse files
committed
feat: open "Application Feedback" as regular link
1 parent bb31746 commit 188a0ed

File tree

3 files changed

+46
-15
lines changed

3 files changed

+46
-15
lines changed

src/components/MenuItem/MenuItem.jsx

Lines changed: 40 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,38 +23,54 @@ const MenuItem = ({
2323
match,
2424
wrapperClass,
2525
toolTipText,
26+
enforceA,
27+
openNewTab,
2628
}) => {
2729
const matchedPath = match && match.path
2830
const isChildActive = children && some(children, c => c.to === matchedPath)
2931

32+
const linkContent = (
33+
<span styleName="content">
34+
<span styleName="left">
35+
{!!Icon && (
36+
<Icon className={cn(styles.icon, styles[iconClassName])} />
37+
)}
38+
{label}
39+
</span>
40+
<span styleName="right">
41+
{!!count && <NotificationBadge count={count} text={toolTipText} />}
42+
</span>
43+
</span>
44+
)
45+
3046
return (
3147
<li className={
3248
cn(wrapperClass,
3349
styles.menuItem,
3450
{ [styles.open]: isAccordionOpen, [styles.withChildren]: children })}
3551
>
36-
{!children && (
52+
{!children && !enforceA && (
3753
<NavLink
3854
to={to}
3955
className={styles.navItem}
4056
activeClassName={styles.active}
4157
exact={exact}
4258
isActive={isActive}
4359
>
44-
<span styleName="content">
45-
<span styleName="left">
46-
{!!Icon && (
47-
<Icon className={cn(styles.icon, styles[iconClassName])} />
48-
)}
49-
{label}
50-
</span>
51-
<span styleName="right">
52-
{!!count && <NotificationBadge count={count} text={toolTipText} />}
53-
</span>
54-
</span>
60+
{linkContent}
5561
</NavLink>
5662
)}
5763

64+
{!children && enforceA && (
65+
<a
66+
href={to}
67+
className={styles.navItem}
68+
target={openNewTab ? '_blank' : ''}
69+
>
70+
{linkContent}
71+
</a>
72+
)}
73+
5874
{children && (
5975
<div>
6076
<div
@@ -91,7 +107,9 @@ const MenuItem = ({
91107
}
92108

93109
MenuItem.defaultProps = {
94-
exact: true
110+
exact: true,
111+
enforceA: false,
112+
openNewTab: false,
95113
}
96114

97115
MenuItem.propTypes = {
@@ -107,6 +125,15 @@ MenuItem.propTypes = {
107125
onAccordionToggle: PT.func,
108126
wrapperClass: PT.string,
109127
toolTipText: PT.string,
128+
/**
129+
* Render as regular link `<a>` instead of React Router `<NavLink>`
130+
*/
131+
enforceA: PT.bool,
132+
/**
133+
* Open link in the new tab.
134+
* Only works if `enforceA` is `true`.
135+
*/
136+
openNewTab: PT.bool,
110137
}
111138

112139
export default withRouter(MenuItem)

src/components/UserSidebar/UserSidebar.jsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ const navLinks = [{
6565
iconClassName: 'fill',
6666
}, {
6767
label: 'GIVE APPLICATION FEEDBACK',
68-
to: '/',
68+
to: 'https://forms.gle/hwRWYB3cGQnKVpjk7',
69+
enforceA: true,
70+
openNewTab: true,
6971
Icon: FAQIcon,
7072
iconClassName: 'fill',
7173
}]

src/projects/detail/containers/ProjectInfoContainer.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,9 @@ class ProjectInfoContainer extends React.Component {
594594
navLinks={[
595595
{
596596
label: 'GIVE APPLICATION FEEDBACK',
597-
to: '/',
597+
to: 'https://forms.gle/hwRWYB3cGQnKVpjk7',
598+
enforceA: true,
599+
openNewTab: true,
598600
Icon: FAQIcon,
599601
iconClassName: 'fill',
600602
}

0 commit comments

Comments
 (0)