Skip to content

Commit

Permalink
Merge pull request #108 from HetviSoni/signup
Browse files Browse the repository at this point in the history
sign up button disappears when successfully signed up
  • Loading branch information
asubedy committed Jul 2, 2023
2 parents ae2bdd0 + 87b380a commit 3bafe87
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
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="faq">
<h1>Frequently Asked Questions</h1>
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
6 changes: 4 additions & 2 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,6 +29,8 @@ const SignupForm = () => {

useEffect(() => {
if (formSubmitted) {
props.onSubmit();

axios.post("https://hook.us1.make.com/x4crqi16j8wfhctosk8y47fj6gknyvvh", {
memberFormOne
});
Expand All @@ -38,7 +40,7 @@ const SignupForm = () => {
behavior: "smooth"
});
}
}, [formSubmitted, memberFormOne]);
}, [formSubmitted, memberFormOne, props]);

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

0 comments on commit 3bafe87

Please sign in to comment.