Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: join us button #5900

Merged
merged 3 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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} />;
};
};
Loading