handle onClick

This commit is contained in:
srgooglo 2022-10-20 13:36:08 +02:00
parent d8f529d044
commit e004c4b2ab
2 changed files with 13 additions and 2 deletions

View File

@ -4,7 +4,16 @@ import { Icons } from "components/Icons"
import "./index.less" import "./index.less"
export default (props) => { export default (props) => {
const { backgroundImg, backgroundStyle, logoImg, title, description } = props.data ?? {} const { backgroundImg, backgroundStyle, logoImg, title, description } = props.data?.announcement ?? {}
const onClickEvent = () => {
if (!props.data?._id) {
console.error("No event ID provided")
return false
}
app.setLocation(`/featured-event/${props.data?._id}`)
}
return <div return <div
key={props.index} key={props.index}
@ -13,6 +22,7 @@ export default (props) => {
backgroundImage: `url(${backgroundImg})`, backgroundImage: `url(${backgroundImg})`,
...backgroundStyle ...backgroundStyle
}} }}
onClick={onClickEvent}
> >
<div className="indicator"> <div className="indicator">
<Icons.Target /> <span>Featured event</span> <Icons.Target /> <span>Featured event</span>

View File

@ -48,9 +48,10 @@
.content { .content {
display: flex; display: flex;
flex-direction: column;
flex-direction: column;
align-items: flex-start; align-items: flex-start;
margin-left: 20px; margin-left: 20px;
margin-bottom: 10px; margin-bottom: 10px;