Skip to content

Commit

Permalink
feat: event share #608
Browse files Browse the repository at this point in the history
created event share component ui and functionality
  • Loading branch information
ajoneoito committed Dec 2, 2021
1 parent 8eea066 commit fda6074
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 16 deletions.
4 changes: 2 additions & 2 deletions component/layout/EventDetails/BookEvent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import styles from "./BookEvent.module.scss";
import moment from "moment";
import Link from "next/link";

export default function BookEvent({ data,showshare }) {
export default function BookEvent({ data,showShare }) {
const { meta_title, description, event_time, location, registration_link } = data;
return (
<div className={styles.Book_Wrap}>
Expand All @@ -26,7 +26,7 @@ export default function BookEvent({ data,showshare }) {
BOOK NOW
</a>
</Link>
<button className={styles.share} onClick={showshare}>SHARE EVENT</button>
<button className={styles.share} onClick={showShare}>SHARE EVENT</button>
</div>
);
}
4 changes: 2 additions & 2 deletions component/layout/EventDetails/EventSpotlight.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import BookEvent from "./BookEvent";
import styles from "./EventSpotlight.module.scss";
import GuestDetails from "./GuestDetails";

export default function EventSpotlight({ data, showwindow }) {
export default function EventSpotlight({ data, showWindow }) {
const {
banner_image,
guest_name,
Expand All @@ -17,7 +17,7 @@ export default function EventSpotlight({ data, showwindow }) {
<div className={styles.postWrap}>
<figure>{banner_image && <img src={banner_image} alt="Event Image" />}</figure>
<div className={styles.bookEvent}>
<BookEvent data={data} showshare={showwindow} />
<BookEvent data={data} showShare={showWindow} />
</div>
<div className={styles.author}>
<GuestDetails name={guest_name} avatar={guest_image} desig={guest_designation} />
Expand Down
4 changes: 2 additions & 2 deletions component/layout/EventDetails/ShareEvent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
import { FacebookIcon, TwitterIcon, LinkedinIcon, WhatsappIcon } from "react-share";
function ShareEvent({ hidewindow, location }) {
const url = location;
const copytoclipboard = () => {
const copyToClipBoard = () => {
navigator.clipboard.writeText(url);
notify("Copied to clipboard", "success");
};
Expand Down Expand Up @@ -50,7 +50,7 @@ function ShareEvent({ hidewindow, location }) {
</div>
<div>
<input
onClick={copytoclipboard}
onClick={copyToClipBoard}
type="text"
name="link"
id="link"
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
"react-reveal": "^1.2.2",
"react-select": "^4.3.1",
"react-share": "^4.4.0",
"react-share-social": "^0.1.48",
"react-slick": "^0.28.1",
"react-toastify": "^7.0.4",
"reactjs-popup": "^2.0.4",
Expand Down
15 changes: 6 additions & 9 deletions pages/events/[event_id].js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import SiteFooter from "../../component/layout/SiteFooter/SiteFooter";
import Head from "next/head";
import EventService from "../../services/EventService";
import Cookies from "universal-cookie";
import { url, logoPath } from "../../seoschema/schema";
import { url,logoPath } from "../../seoschema/schema";
import notify from "../../lib/notify";
import EventSpotlight from "../../component/layout/EventDetails/EventSpotlight";
import Detail from "../../component/layout/EventDetails/Detail";
import ShareEvent from "../../component/layout/EventDetails/ShareEvent";
import { useState } from "react";
import { useEffect, useState } from "react";

export async function getServerSideProps(context) {
try {
Expand Down Expand Up @@ -61,11 +61,8 @@ export default function BlogListing({ event }) {
} = event;
const cookies = new Cookies();
const userCookie = cookies.get("userNullcast");
const [viewshare, setViewshare] = useState(true)
const url = window.location.href
const showwindow = (id) => {
setViewshare(true)
}
const [viewshare, setViewshare] = useState(false)
let pageUrl = window.location.href
return (
<>
<Head>
Expand Down Expand Up @@ -132,8 +129,8 @@ export default function BlogListing({ event }) {
<meta property="og:image:height" content="630" />
</Head>
<SiteHeader />
{viewshare && <ShareEvent location={url} hidewindow={()=> setViewshare(false)} />}
<EventSpotlight showwindow={()=> setViewshare(true)} data={event} />
{viewshare && <ShareEvent location={pageUrl} hidewindow={()=> setViewshare(false)} />}
<EventSpotlight showWindow={()=> setViewshare(true)} data={event} />
<Detail event={event} />
<SectionSwag />
<SiteFooter />
Expand Down

0 comments on commit fda6074

Please sign in to comment.