Skip to content

Commit

Permalink
Fix main content href
Browse files Browse the repository at this point in the history
  • Loading branch information
adlk committed Mar 25, 2020
1 parent e71b362 commit 922f861
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions src/features/announcements/components/AnnouncementScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,14 +234,18 @@ class AnnouncementScreen extends Component {
<Button
label={announcement.main.cta.label}
onClick={() => {
const { analytics } = announcement.main.cta;
if (announcement.spotlight.cta.href.startsWith('http')) {
actions.app.openExternalUrl({ url: announcement.spotlight.cta.href });
const {
analytics,
href,
label,
} = announcement.main.cta;
if (announcement.main.cta.href.startsWith('http')) {
actions.app.openExternalUrl({ url: href });
} else {
window.location.href = `#${announcement.main.cta.href}`;
window.location.href = `#${href}`;
}

gaEvent(analytics.category, analytics.action, announcement.main.cta.label);
gaEvent(analytics.category, analytics.action, label);
}}
/>
</div>
Expand All @@ -265,14 +269,18 @@ class AnnouncementScreen extends Component {
<Button
label={announcement.spotlight.cta.label}
onClick={() => {
const { analytics } = announcement.spotlight.cta;
const {
analytics,
href,
label,
} = announcement.spotlight.cta;
if (announcement.spotlight.cta.href.startsWith('http')) {
actions.app.openExternalUrl({ url: announcement.spotlight.cta.href });
actions.app.openExternalUrl({ url: href });
} else {
window.location.href = `#${announcement.spotlight.cta.href}`;
window.location.href = `#${href}`;
}

gaEvent(analytics.category, analytics.action, announcement.spotlight.cta.label);
gaEvent(analytics.category, analytics.action, label);
}}
/>
</div>
Expand Down

0 comments on commit 922f861

Please sign in to comment.