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

sign up button disappears when successfully signed up #108

Merged
merged 6 commits into from
Jul 2, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
11 changes: 8 additions & 3 deletions site/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,23 @@ import { useDarkMode } from "./components/useDarkMode";
import ReactPlayer from 'react-player/youtube'
import Navigation from "./components/Navigation";
import Faq from "./components/Faq";

import { useState } from "react";

const App = () => {

const [theme, toggleTheme] = useDarkMode();
const themeMode = theme === 'light' ? lightTheme : darkTheme;
const [showSignUpButton, setShowSignUpButton] = useState(true);

const handleSignUpFormSubmit = () => {
setShowSignUpButton(false);
};

return (
<>
<ThemeProvider theme={themeMode}>
<GlobalStyle />
<Navigation theme={theme} toggleTheme={toggleTheme} />
<Navigation theme={theme} toggleTheme={toggleTheme} showSignUpButton={showSignUpButton} />
<Main>
<section className="hero">
<h3 className="try-now-txt">Try it now!</h3>
Expand All @@ -43,7 +48,7 @@ const App = () => {
</section>
<section className="form" id="signup-form">
<h2>Sign up for the early access of cloud native playground!</h2>
<SignupForm />
<SignupForm onSubmit={handleSignUpFormSubmit} />
</section>
<section className="join-community">
<div>
Expand Down
4 changes: 2 additions & 2 deletions site/src/components/Navigation/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import mesheryLogo from '../../assets/images/meshery-learn-logo.png';
import mesheryLogoLight from '../../assets/images/meshery-learn-logo-white.png';
import { Toggle } from "../Toggle";

function Navigation({theme, toggleTheme}) {
function Navigation({theme, toggleTheme, showSignUpButton}) {


const [openNav, setOpenNav] = useState(false);
Expand All @@ -29,7 +29,7 @@ function Navigation({theme, toggleTheme}) {
<img className="logo" src={Logo} alt="Meshery Logo" />
<div className="btn-container">
<Toggle theme={theme} toggleTheme={toggleTheme} />
<a href="#signup-form" className="signup-btn" role="button">Sign Up</a>
{showSignUpButton && <a href="#signup-form" className="signup-btn" role="button">Sign Up</a>}
{/* <a href="https://playground.meshery.io" className="login-btn" role="button">Login</a> */}
</div>
<div className="dropdown_btn" onClick={handleNavOpen}>
Expand Down
7 changes: 4 additions & 3 deletions site/src/components/SignupForm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import MesheryText from "../../assets/images/meshery-light-text.svg";
import SignupFormWrapper from "./signupform.style.js";
import DiscussCallout from "../Discuss-Callout";

const SignupForm = () => {
const SignupForm = (props) => {
// Form values
const [memberFormOne, setMemberFormOne] = useState({});

Expand All @@ -29,16 +29,17 @@ const SignupForm = () => {

useEffect(() => {
if (formSubmitted) {
props.onSubmit();
axios.post("https://hook.us1.make.com/x4crqi16j8wfhctosk8y47fj6gknyvvh", {
memberFormOne
memberFormOne
});
window.scrollTo({
top: 800,
left: 0,
behavior: "smooth"
});
}
}, [formSubmitted, memberFormOne]);
}, [formSubmitted, memberFormOne, props]);

const PlayFormComponent = () => {
return (
Expand Down