diff --git a/src/components/DropDownBox/DropDownBox.scss b/src/components/DropDownBox/DropDownBox.scss new file mode 100644 index 0000000..80a1c78 --- /dev/null +++ b/src/components/DropDownBox/DropDownBox.scss @@ -0,0 +1,5 @@ +@import "../../assets/scss/globals"; + +.drop-down-box { + color: $white; +} diff --git a/src/components/DropDownBox/DropDownBox.tsx b/src/components/DropDownBox/DropDownBox.tsx new file mode 100644 index 0000000..faf4325 --- /dev/null +++ b/src/components/DropDownBox/DropDownBox.tsx @@ -0,0 +1,18 @@ +import * as React from "react"; +import "./DropDownBox.scss"; + +export interface DropDownBoxProps {} +export interface DropDownBoxState {} + +class DropDownBox extends React.Component { + render() { + const { children } = this.props; + return ( +
+ {children} +
+ ); + } +} + +export default DropDownBox; diff --git a/src/components/DropDownBox/index.ts b/src/components/DropDownBox/index.ts new file mode 100644 index 0000000..64e87ea --- /dev/null +++ b/src/components/DropDownBox/index.ts @@ -0,0 +1,2 @@ +import DropDownBox from "./DropDownBox"; +export default DropDownBox; diff --git a/src/components/NavbarChildLink/NavbarChildLink.tsx b/src/components/NavbarChildLink/NavbarChildLink.tsx index f4f9d31..a4a99ae 100644 --- a/src/components/NavbarChildLink/NavbarChildLink.tsx +++ b/src/components/NavbarChildLink/NavbarChildLink.tsx @@ -4,12 +4,17 @@ import "./NavbarChildLink.scss"; export interface NavbarChildLinkProps { to: string; } -export interface NavbarChildLinkState {} +export interface NavbarChildLinkState { + open: Boolean; +} class NavbarChildLink extends React.Component { render() { + // style={this.state.open ? {} : {display: "none"}} return ( - + + {this.props.children} ); } diff --git a/src/components/NavbarDropdownLink/NavbarDropdownLink.tsx b/src/components/NavbarDropdownLink/NavbarDropdownLink.tsx index 9e3e2fe..34eb7a1 100644 --- a/src/components/NavbarDropdownLink/NavbarDropdownLink.tsx +++ b/src/components/NavbarDropdownLink/NavbarDropdownLink.tsx @@ -1,19 +1,58 @@ import * as React from "react"; import "./NavbarDropdownLink.scss"; +import { Fragment } from "react"; +import DropDownBox from "../DropDownBox/DropDownBox"; export interface NavbarDropdownLinkProps { to: string; text: string; } -export interface NavbarDropdownLinkState {} +export interface NavbarDropdownLinkState { + open: Boolean; +} class NavbarDropdownLink extends React.Component { + + constructor(props) { + super(props); + this.state = {open: false}; + } + + handleOpen = () => { + this.setState({open: true}); + } + + handleClose = () => { + this.setState({open: false}); + } + render() { - return ( - - {this.props.text} - - ); + const { children } = this.props; + const { open } = this.state; + if (open) { + return ( + + {this.props.text} + + { children } + + + ); + } else { + return ( + + {this.props.text} + + ); + } } }