diff --git a/ConfirmButton.jsx b/ConfirmButton.jsx new file mode 100644 index 0000000..0baa7a0 --- /dev/null +++ b/ConfirmButton.jsx @@ -0,0 +1,17 @@ +import React, { useState } from "react"; + +function ConfirmButton(props) { + const [isConfirmed, setIsConfirmed] = useState(false); + + const handleConfirm = () => { + setIsConfirmed((prevIsConfirmed) => !prevIsConfirmed); + }; + + return ( + + ); +} + +export default ConfirmButton; diff --git a/LandingPage.jsx b/LandingPage.jsx new file mode 100644 index 0000000..da35cdb --- /dev/null +++ b/LandingPage.jsx @@ -0,0 +1,27 @@ +import React, { useState } from "react"; +import Toolbar from "./Toolbar"; + +function LandingPage(props) { + const [isLoggedIn, setIsLoggedIn] = useState(false); + + const onClickLogin = () => { + setIsLoggedIn(true); + }; + + const onClickLogout = () => { + setIsLoggedIn(false); + }; + + return ( +
+ +
소플과 함께하는 리액트 공부!
+
+ ); +} + +export default LandingPage; diff --git a/Toolbar.jsx b/Toolbar.jsx new file mode 100644 index 0000000..a0254db --- /dev/null +++ b/Toolbar.jsx @@ -0,0 +1,31 @@ +import React from "react"; + +const styles = { + wrapper: { + padding: 16, + display: "flex", + flexDirection: "row", + borderBottom: "1px solid grey", + }, + greeting: { + marginRight: 8, + }, +}; + +function Toolbar(props) { + const { isLoggedIn, onClickLogin, onClickLogout } = props; + + return ( +
+ {isLoggedIn && 환영합니다!} + + {isLoggedIn ? ( + + ) : ( + + )} +
+ ); +} + +export default Toolbar;