Skip to content

Commit

Permalink
Merge pull request #5900 from vishalvivekm/eurl
Browse files Browse the repository at this point in the history
fix: join us button
  • Loading branch information
leecalcote authored Sep 23, 2024
2 parents 24ebd3f + 7c2a927 commit 4cce0c2
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 11 deletions.
3 changes: 3 additions & 0 deletions src/sections/Community/Event-single/EventSingle.style.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ const EventSinglePageWrapper = styled.div`
div.event-title {
text-align: center;
margin-bottom: 4rem;
h3 {
color:black;
}
}
ul.speakers {
margin-left:0px;
Expand Down
25 changes: 16 additions & 9 deletions src/sections/Community/Event-single/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,13 @@ const EventSingle = ({ data }) => {

//const frontmatter = ({speakers = []});
const { frontmatter, body } = data.mdx;


const isEventPassed = () => {
const eventDate = new Date(frontmatter.date);
const currentDate = new Date();
return eventDate < currentDate;
};
const isEventUrlSpecified = !!frontmatter.eurl;
const showJoinUsButton = !isEventPassed() && isEventUrlSpecified;
return (
<EventPageWrapper>
<PageHeader
Expand Down Expand Up @@ -86,13 +91,15 @@ const EventSingle = ({ data }) => {
</li>
))}
</ul>
<div className="event-title">
<Button primary url={frontmatter.eurl} external={true}>
<h3>
Join us at {frontmatter.title}
</h3>
</Button>
</div>
{showJoinUsButton && (
<div className="event-title">
<Button primary url={frontmatter.eurl} external={true}>
<h3>
Join us at {frontmatter.title}
</h3>
</Button>
</div>
)}
</div>
<CTA_Bottom
category={"Kanvas"}
Expand Down
4 changes: 2 additions & 2 deletions src/templates/event-single.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const query = graphql`query EventsBySlug($slug: String!) {
type
speakers
register
date(formatString: "MMM Do, YYYY")
date
thumbnail {
publicURL
relativePath
Expand Down Expand Up @@ -59,4 +59,4 @@ export default EventSinglePage;

export const Head = ({ data }) => {
return <SEO title={data.mdx.frontmatter.title} description={data.mdx.frontmatter.description} image={data.mdx.frontmatter.thumbnail.publicURL} />;
};
};

0 comments on commit 4cce0c2

Please sign in to comment.