Skip to content

Commit

Permalink
refactor: update Highlight component to remove unnecessary actions
Browse files Browse the repository at this point in the history
  • Loading branch information
a-ng-d committed Sep 5, 2024
1 parent 20d21cd commit 7e16652
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions src/ui/modules/Highlight.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,7 @@ export default class Highlight extends React.Component<
return (
<Dialog
title={locals[this.props.lang].pending.announcements}
actions={{
primary: undefined,
secondary: undefined,
}}
actions={{}}
onClose={this.props.onCloseHighlight}
>
<div className="onboarding__callout--centered">
Expand All @@ -78,10 +75,7 @@ export default class Highlight extends React.Component<
return (
<Dialog
title={locals[this.props.lang].error.generic}
actions={{
primary: undefined,
secondary: undefined,
}}
actions={{}}
onClose={this.props.onCloseHighlight}
>
<div className="onboarding__callout--centered">
Expand All @@ -99,6 +93,10 @@ export default class Highlight extends React.Component<
this.state.announcements[this.state.position].properties.Titre
.title[0].plain_text
}
tag={
this.state.announcements[this.state.position].properties.Type.select
.name
}
actions={{
primary: {
label:
Expand All @@ -107,15 +105,19 @@ export default class Highlight extends React.Component<
: locals[this.props.lang].highlight.cta.gotIt,
action: (e) => this.goNextSlide(e),
},
secondary: {
label: locals[this.props.lang].highlight.cta.learnMore,
action: () =>
window.open(
this.state.announcements[this.state.position].properties.URL
.url,
'_blank'
),
},
secondary: (() => {
if (this.state.announcements[this.state.position].properties.URL.url !== null)
return {
label: locals[this.props.lang].highlight.cta.learnMore,
action: () =>
window.open(
this.state.announcements[this.state.position].properties.URL
.url,
'_blank'
)
};
else return undefined
})()
}}
indicator={
this.state.announcements.length > 1
Expand Down

0 comments on commit 7e16652

Please sign in to comment.