-
Notifications
You must be signed in to change notification settings - Fork 3
TUR-60: Basic NavBar Drop down menu #43
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
base: develop
Are you sure you want to change the base?
Changes from all commits
ba5a466
9f55063
5c6c336
a85ad39
ce0eb64
af06a1b
6835691
ae759ef
dc935d6
a896397
cb45f1c
4560398
069a435
f957178
8c4c52c
ec0632e
325312e
888a723
74a45a0
91d5a75
716d4e0
354c4e1
e135b3a
7a13f0a
713bebb
68c8a49
4f40142
c26ead2
e4a78c0
2c772da
edf2abf
eaa765c
28a2361
d87697b
b351046
7381b51
c65c8ab
31d58d6
53f8ca2
2a11309
b5896e5
b0c7e2f
202a06d
7049a79
3e02715
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import React, { Component, useState } from "react"; | ||
import { | ||
Container, | ||
DropDownHeader, | ||
DropDownListContainer, | ||
DropDownList, | ||
ListItem | ||
} from "./DropDownMenu.styled"; | ||
|
||
const options = ["Apps", "Account", "Questions"]; | ||
|
||
export default function DropDownMenu() { | ||
const [isOpen, setIsOpen] = useState(false); | ||
|
||
const [selectedOption, setSelectedOption] = useState(null); | ||
|
||
const toggling = () => setIsOpen(!isOpen); | ||
|
||
const onOptionClicked = value => () => { | ||
setSelectedOption(value); | ||
setIsOpen(false); | ||
}; | ||
|
||
return ( | ||
<Container> | ||
<DropDownHeader onClick={toggling}> | ||
{selectedOption || "Welcome, Joe!"} | ||
</DropDownHeader> | ||
{isOpen && ( | ||
<DropDownListContainer> | ||
<DropDownList> | ||
{options.map(option => ( | ||
<ListItem onClick = {() => onOptionClicked() } key={Math.random()}> | ||
{option} | ||
</ListItem> | ||
))} | ||
</DropDownList> | ||
</DropDownListContainer> | ||
)} | ||
</Container> | ||
); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import styled from 'styled-components'; | ||
|
||
|
||
export const Container = styled.div` | ||
padding-top: 12px; | ||
flex: 1; | ||
background-color: transparent; | ||
|
||
&:hover { | ||
cursor: pointer; | ||
} | ||
`; | ||
|
||
export const DropDownHeader = styled.div` | ||
padding-top: 12px; | ||
margin-bottom: 10px; | ||
padding: 5px 16px 5px 20px; | ||
font-weight: 500; | ||
font-size: 20px; | ||
color: #3faffa; | ||
background: #ffffff; | ||
`; | ||
|
||
export const DropDownListContainer = styled.div` | ||
padding-top: 12px; | ||
width: 160px; | ||
margin: 0 auto; | ||
`; | ||
|
||
export const DropDownList = styled.ul` | ||
padding: 0; | ||
margin: 0; | ||
padding-left: 0px; | ||
background: #ffffff; | ||
border: 2px solid #e5e5e5; | ||
box-sizing: border-box; | ||
color: #3faffa; | ||
font-size: 20px; | ||
font-weight: 600; | ||
&:first-child { | ||
padding-top: 8px; | ||
} | ||
`; | ||
|
||
export const ListItem = styled.ul` | ||
list-style: none; | ||
margin-bottom: 8px; | ||
`; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
import styled from 'styled-components' | ||
import gray from '../../images/gray.jpg'; | ||
|
||
export const MainHeader = styled.h1` | ||
position: absolute; | ||
font-family: 'Trebuchet MS', sans-serif; | ||
text-align: center; | ||
left: 27%; | ||
color: white; | ||
top: 1%; | ||
`; | ||
|
||
export const TextWrapper = styled.body` | ||
position: absolute; | ||
top: 50%; | ||
left: 35%; | ||
width: 900px; | ||
height: 600px; | ||
padding: 40px; | ||
padding-top: 50px; | ||
box-sizing: border-box; | ||
transform: translate(-50%, -50%); | ||
box-shadow: 0 1px 15px; | ||
color: #FFFFE0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. see if you can use palette in styles folder for colors |
||
border-radius: 20px; | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. clean up spacing |
||
`; | ||
|
||
export const Button = styled.button` | ||
/* This renders the buttons above... Edit me! */ | ||
display: inline-block; | ||
font-family: 'Trebuchet MS', sans-serif; | ||
border-radius: 20px; //button shape | ||
padding: 8px; | ||
margin: 10px 60px; | ||
width: 150px; | ||
color: black; | ||
border: 2px solid black; | ||
background-color: #A9A9A9; | ||
:hover { | ||
cursor: pointer; | ||
background: #FFFFE0; | ||
transition: 0.2s ease-in-out; | ||
} | ||
`; | ||
|
||
export const Input = styled.input` | ||
display: block; | ||
text-align: left; | ||
font-family: 'Trebuchet MS', sans-serif; | ||
width: 200px; | ||
padding: 10px 10px; //inside padding | ||
margin: 20px auto; | ||
background: transparent; | ||
border: 2px solid #FFFFE0 | ||
; | ||
color: white; | ||
cursor: pointer; | ||
font-size: 15px; | ||
border-radius: 20px; | ||
outline: none; | ||
::placeholder { | ||
font-family: 'Trebuchet MS', sans-serif; | ||
} | ||
`; | ||
|
||
export const Label = styled.label` | ||
position: absolute; | ||
top: 5%; | ||
left: 34%; | ||
margin: 0 0 30px; | ||
font-family: 'Trebuchet MS', sans-serif; | ||
color: white; | ||
text-align: center; | ||
font-size: 30px; | ||
font-weight: bold; | ||
`; | ||
|
||
export const LoginWrapper = styled.body` | ||
position: absolute; | ||
top: 50%; | ||
left: 80%; | ||
width: 350px; | ||
height: 270px; | ||
padding: 40px; | ||
padding-top: 50px; | ||
box-sizing: border-box; | ||
transform: translate(-50%, -50%); | ||
box-shadow: 0 15px 25px rgba(0,0,0,1); | ||
border-radius: 20px; | ||
`; | ||
|
||
export const LoginContainer = styled.div` | ||
background-image: url(${gray}); | ||
height: 100vh; | ||
background-position: center; | ||
background-size: cover; | ||
`; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import styled from 'styled-components' | ||
import gray from '../../images/gray.jpg'; | ||
|
||
export const Button = styled.button` | ||
display: inline-block; | ||
font-family: 'Trebuchet MS', sans-serif; | ||
border-radius: 20px; //button shape | ||
padding: 8px; | ||
margin: 10px 60px; | ||
width: 150px; | ||
color: black; | ||
border: 2px solid black; | ||
background-color: #A9A9A9; | ||
:hover { | ||
cursor: pointer; | ||
background: #FFFFE0; | ||
transition: 0.2s ease-in-out; | ||
} | ||
`; | ||
|
||
export const Input = styled.input` | ||
display: block; | ||
text-align: left; | ||
font-family: 'Trebuchet MS', sans-serif; | ||
width: 200px; | ||
padding: 10px 10px; //inside padding | ||
margin: 20px auto; | ||
background: transparent; | ||
border: 2px solid #FFFFE0 | ||
; | ||
color: white; | ||
cursor: pointer; | ||
font-size: 15px; | ||
border-radius: 20px; | ||
outline: none; | ||
::placeholder { | ||
font-family: 'Trebuchet MS', sans-serif; | ||
} | ||
`; | ||
|
||
export const Label = styled.label` | ||
position: absolute; | ||
top: 5%; | ||
left: 34%; | ||
margin: 0 0 30px; | ||
font-family: 'Trebuchet MS', sans-serif; | ||
color: white; | ||
text-align: center; | ||
font-size: 30px; | ||
font-weight: bold; | ||
`; | ||
|
||
export const Wrapper = styled.body` | ||
position: absolute; | ||
top: 40%; | ||
left: 50%; | ||
width: 350px; | ||
height: 400px; | ||
padding: 40px; | ||
padding-top: 50px; | ||
box-sizing: border-box; | ||
transform: translate(-50%, -50%); | ||
box-shadow: 0 15px 25px rgba(0,0,0,1); | ||
border-radius: 20px; | ||
`; | ||
|
||
export const LoginContainer = styled.div` | ||
background-image: url(${gray}); | ||
height: 100vh; | ||
background-position: center; | ||
background-size: cover; | ||
`; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. clean up spacing. You can keep empty test files |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same comment as for david
const functionName = (values) => {
body
}