Added contact button that calls the VideoAsk
widget and opens the chat window.
This commit is contained in:
parent
06c56623a8
commit
f4d67450f0
13
Components/Buttons/Button.jsx
Normal file
13
Components/Buttons/Button.jsx
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import Link from "next/link";
|
||||||
|
const Button = ({ buttonText, buttonLink ="/",}) => {
|
||||||
|
return (
|
||||||
|
<Link href = {buttonLink} target="_blank" rel="noopener noreferrer">
|
||||||
|
<button className="px-20 mt-8 mx-5 py-2 text-white border border-blue-500 rounded hover:border-white transition duration-300 ease-in-out focus:outline-none">
|
||||||
|
{buttonText}
|
||||||
|
</button>
|
||||||
|
</Link>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Button;
|
||||||
|
|
19
Components/Buttons/ContactButton.jsx
Normal file
19
Components/Buttons/ContactButton.jsx
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
const ContactButton = ({buttonText}) => {
|
||||||
|
const openChatScreen = () => {
|
||||||
|
const chatButton = document.getElementsByClassName('videoask-embed__button--SgLKO')[0];
|
||||||
|
if (chatButton) {
|
||||||
|
chatButton.click();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<button
|
||||||
|
className="px-20 mt-8 mx-5 py-2 text-white border border-blue-500 rounded hover:border-white transition duration-300 ease-in-out focus:outline-none"
|
||||||
|
onClick={openChatScreen}
|
||||||
|
>
|
||||||
|
{buttonText}
|
||||||
|
</button>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default ContactButton;
|
@ -1,25 +1,30 @@
|
|||||||
import { useEffect } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
|
|
||||||
const VideoAsk = () => {
|
const VideoAsk = () => {
|
||||||
useEffect(() => {
|
const [isMounted, setIsMounted] = useState(false);
|
||||||
window.VIDEOASK_EMBED_CONFIG = {
|
|
||||||
"kind": "widget",
|
|
||||||
"url": "https://www.videoask.com/f8fah1r34",
|
|
||||||
"options": {
|
|
||||||
"widgetType": "VideoThumbnailSmall",
|
|
||||||
"text": "Talk",
|
|
||||||
"backgroundColor": "#FFFFFF",
|
|
||||||
"position": "bottom-right",
|
|
||||||
"dismissible": true
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const script = document.createElement('script');
|
|
||||||
script.src = 'https://www.videoask.com/embed/embed.js';
|
|
||||||
script.async = true;
|
|
||||||
document.body.appendChild(script);
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
return null;
|
useEffect(() => {
|
||||||
|
setIsMounted(true);
|
||||||
|
if (isMounted) {
|
||||||
|
window.VIDEOASK_EMBED_CONFIG = {
|
||||||
|
"kind": "widget",
|
||||||
|
"url": "https://www.videoask.com/f8fah1r34",
|
||||||
|
"options": {
|
||||||
|
"widgetType": "VideoThumbnailSmall",
|
||||||
|
"text": "Talk",
|
||||||
|
"backgroundColor": "#FFFFFF",
|
||||||
|
"position": "bottom-right",
|
||||||
|
"dismissible": true
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const script = document.createElement('script');
|
||||||
|
script.src = 'https://www.videoask.com/embed/embed.js';
|
||||||
|
script.async = true;
|
||||||
|
document.body.appendChild(script);
|
||||||
|
}
|
||||||
|
}, [isMounted]);
|
||||||
|
|
||||||
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default VideoAsk;
|
export default VideoAsk;
|
@ -1,36 +1,30 @@
|
|||||||
import VideoButton from "/home/clyde/Code/shiloh/Components/Buttons/video-button.jsx";
|
import ContactButton from "../Buttons/ContactButton.jsx";
|
||||||
import Link from "next/link";
|
|
||||||
import ContactThreeJsComponent from "../Elements/ContactThreeJsComponent.jsx";
|
import ContactThreeJsComponent from "../Elements/ContactThreeJsComponent.jsx";
|
||||||
|
|
||||||
const ContactFormSection = ({
|
const ContactFormSection = ({
|
||||||
text,
|
text,
|
||||||
videoId,
|
buttonText,
|
||||||
buttonOneText,
|
|
||||||
buttonTwoText,
|
|
||||||
buttonLink = "/", // add a default value,
|
|
||||||
}) => {
|
}) => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<>
|
||||||
<div className="relative z-10 h-screen w-screen">
|
<div className="relative z-10 h-screen w-screen">
|
||||||
<div className="absolute inset-0 z-0">
|
<div className="absolute inset-0 z-0">
|
||||||
<ContactThreeJsComponent />
|
<ContactThreeJsComponent />
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div className="relative z-10 flex flex-col items-center justify-center h-full">
|
<div className="relative z-10 flex flex-col items-center justify-center h-full">
|
||||||
<div className="relative flex justify-center items-end w-full mb-20">
|
<div className="relative flex justify-center items-end w-full mb-20">
|
||||||
<h1 className="text-6xl font-normal text-white">{text}</h1>
|
<h1 className="text-6xl font-normal text-white">{text}</h1>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex justify-start space-x-4">
|
<div className="flex justify-start space-x-4">
|
||||||
<VideoButton videoId={videoId} buttonOneText={buttonOneText} />
|
<ContactButton
|
||||||
<Link
|
buttonText={buttonText}
|
||||||
href={buttonLink}
|
/>
|
||||||
className="px-4 mt-8 mx-5 py-2 text-white underline border-white rounded hover:border-white transition duration-300 ease-in-out focus:outline-none"
|
|
||||||
>
|
|
||||||
{buttonTwoText}
|
|
||||||
</Link>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ContactFormSection;
|
export default ContactFormSection;
|
||||||
|
@ -50,7 +50,9 @@ export default function Home() {
|
|||||||
buttonLink="/contactus"
|
buttonLink="/contactus"
|
||||||
/>
|
/>
|
||||||
<ContactFormSection
|
<ContactFormSection
|
||||||
buttonOneText="contact us"
|
text="contact us"
|
||||||
|
buttonText="contact us"
|
||||||
|
buttonLink="https://www.videoask.com/f8fah1r34"
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user