-
-
Notifications
You must be signed in to change notification settings - Fork 118
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
Secondary Dropdown #808
Secondary Dropdown #808
Changes from 10 commits
59200e1
6e26233
a6c3771
5e852ea
606ed0d
3a18afd
f740ff5
88d1f5d
4d7494a
228b6f4
c1a272f
f9f173d
6d8eb47
f58b094
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 @@ | ||
export {default as SecondaryDropDown} from './secondaryDropDown'; |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,56 @@ | ||||||
import React from 'react'; | ||||||
import * as S from '../styles'; | ||||||
import * as H from '../../typography'; | ||||||
import { Details } from '../constants'; | ||||||
|
||||||
|
||||||
export default function SecondaryDropDown() { | ||||||
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. To be consistent to code structure
Suggested change
Change accordingly in Also make an entry in 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. Sure!Thank you. |
||||||
const [showOptions, setShowOptions] = React.useState(false); | ||||||
const [searchTerm, setSearchTerm] = React.useState(''); | ||||||
const [searchResults, setSearchResults] = React.useState([]); | ||||||
const handleChange = event => { | ||||||
setSearchTerm(event.target.value); | ||||||
setShowOptions(1); | ||||||
}; | ||||||
React.useEffect(() => { | ||||||
if(searchTerm){ | ||||||
setShowOptions(1); | ||||||
} | ||||||
else{ | ||||||
setShowOptions(null); | ||||||
} | ||||||
const results = Details.filter(person => | ||||||
person.name.replace(/\s+/g,'').toLowerCase().includes(searchTerm.replace(/\s+/g,'').toLowerCase()) | ||||||
); | ||||||
setSearchResults(results); | ||||||
}, [searchTerm]); | ||||||
|
||||||
return ( | ||||||
<S.ParentContainer className="ParentContainer"> | ||||||
<S.SearchBarWrapper> | ||||||
<S.SearchBar | ||||||
type={'text'} | ||||||
placeholder={'Search...'} | ||||||
onChange={handleChange} | ||||||
value={searchTerm} | ||||||
/> | ||||||
</S.SearchBarWrapper> | ||||||
{showOptions && | ||||||
<S.OptionsContainer> | ||||||
{searchResults.map((person, index) => | ||||||
<S.CardWrapper key={person.name + "_" + index}> | ||||||
<S.Avatar | ||||||
src={person.avatarLink} | ||||||
/> | ||||||
<S.NameWrapper> | ||||||
<H.Heading5> | ||||||
{person.name} | ||||||
</H.Heading5> | ||||||
</S.NameWrapper> | ||||||
</S.CardWrapper> | ||||||
)} | ||||||
</S.OptionsContainer> | ||||||
} | ||||||
</S.ParentContainer> | ||||||
); | ||||||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
|
||
export const Details = [ | ||
{ | ||
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. Expected indentation of 2 spaces but found 4 indent |
||
"avatarLink": "https://storage.googleapis.com/ignitus_assets/ig-avatars/eugene.png", | ||
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. Expected indentation of 4 spaces but found 6 indent |
||
"name": "Harpar Hopman" | ||
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. Expected indentation of 4 spaces but found 6 indent |
||
}, | ||
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. Expected indentation of 2 spaces but found 4 indent |
||
{ | ||
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. Expected indentation of 2 spaces but found 4 indent |
||
"avatarLink": "https://storage.googleapis.com/ignitus_assets/ig-avatars/eugene.png", | ||
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. Expected indentation of 4 spaces but found 6 indent |
||
"name": "Hara Hopman" | ||
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. Expected indentation of 4 spaces but found 6 indent |
||
}, | ||
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. Expected indentation of 2 spaces but found 4 indent |
||
{ | ||
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. Expected indentation of 2 spaces but found 4 indent |
||
"avatarLink": "https://storage.googleapis.com/ignitus_assets/ig-avatars/eugene.png", | ||
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. Expected indentation of 4 spaces but found 6 indent |
||
"name": "Harbour Center" | ||
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. Expected indentation of 4 spaces but found 6 indent |
||
}, | ||
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. Expected indentation of 2 spaces but found 4 indent |
||
{ | ||
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. Expected indentation of 2 spaces but found 4 indent |
||
"avatarLink": "https://storage.googleapis.com/ignitus_assets/ig-avatars/eugene.png", | ||
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. Expected indentation of 4 spaces but found 6 indent |
||
"name": "Harvard University" | ||
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. Expected indentation of 4 spaces but found 6 indent |
||
}, | ||
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. Expected indentation of 2 spaces but found 4 indent |
||
{ | ||
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. Expected indentation of 2 spaces but found 4 indent |
||
"avatarLink": "https://storage.googleapis.com/ignitus_assets/ig-avatars/eugene.png", | ||
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. Expected indentation of 4 spaces but found 6 indent |
||
"name": "Henry Harbour" | ||
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. Expected indentation of 4 spaces but found 6 indent |
||
}, | ||
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. Expected indentation of 2 spaces but found 4 indent |
||
{ | ||
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. Expected indentation of 2 spaces but found 4 indent |
||
"avatarLink": "https://storage.googleapis.com/ignitus_assets/ig-avatars/eugene.png", | ||
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. Expected indentation of 4 spaces but found 6 indent |
||
"name": "Hara Jackson" | ||
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. Expected indentation of 4 spaces but found 6 indent |
||
} | ||
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. Expected indentation of 2 spaces but found 4 indent |
||
|
||
] | ||
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. Expected indentation of 0 spaces but found 2 indent |
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import styled from '@emotion/styled'; | ||
import * as C from '../colors'; | ||
import * as F from '../fonts'; | ||
|
||
export const ParentContainer = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
width: 20rem; | ||
margin: 2rem; | ||
max-height: 20rem; | ||
`; | ||
|
||
export const SearchBarWrapper = styled.div` | ||
width: 20rem; | ||
height: 3rem; | ||
`; | ||
|
||
export const SearchBar = styled.input` | ||
outline: none; | ||
border: 0.1rem solid ${C.IgnitusBlue}; | ||
border-radius: 0.5rem; | ||
width: 20rem; | ||
height: 2.5rem; | ||
padding-left:0.25rem; | ||
color: ${C.IgnitusBlue}; | ||
font-weight: ${F.SemiBold}; | ||
:: placeholder{ | ||
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. use
|
||
color: ${C.IgnitusBlue}; | ||
font-weight: ${F.SemiBold}; | ||
} | ||
`; | ||
|
||
export const OptionsContainer = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
margin: 1rem 0.25rem; | ||
background-color: ${C.White}; | ||
overflow:auto; | ||
box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1); | ||
border-radius: 0.5rem; | ||
`; | ||
|
||
export const CardWrapper = styled.div` | ||
display: flex; | ||
flex-direction: row; | ||
justify-items: baseline; | ||
padding: 0.5rem; | ||
height: 3rem; | ||
:hover{ | ||
background-color: ${C.GreyLight}; | ||
} | ||
flex:1; | ||
`; | ||
|
||
export const Avatar = styled.img` | ||
border-radius: 50%; | ||
width : 2.5rem; | ||
margin: 0 1rem 0 1rem; | ||
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. use |
||
`; | ||
|
||
export const NameWrapper = styled.div` | ||
margin: 0.5rem; | ||
|
||
`; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export type SecondaryDropDownProps = { | ||
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. Parsing error: Unexpected token type |
||
label: string; | ||
options: string[]; | ||
display: string; | ||
}; | ||
|
||
// export type DropDownProps = { | ||
// display: string; | ||
// }; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import React from 'react'; | ||
import * as T from '../../../../../ignitus-Shared/ignitus-DesignSystem/ignitus-Atoms/typography'; | ||
import SecondaryDropDown | ||
from '../../../../../ignitus-Shared/ignitus-DesignSystem/ignitus-Atoms/ignitus-secondaryDropDown/Components/secondaryDropDown'; | ||
import * as S from '../styles' | ||
|
||
|
||
export const interfaceSecondaryDropDown: React.FC = () => ( | ||
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. Parsing error: Unexpected token : |
||
<React.Fragment> | ||
<S.TitleWrapper> | ||
<T.Heading3>Secondary DropDown</T.Heading3> | ||
</S.TitleWrapper> | ||
<br/> | ||
<SecondaryDropDown/> | ||
</React.Fragment> | ||
); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import styled from '@emotion/styled'; | ||
|
||
|
||
export const TitleWrapper = styled.div` | ||
padding: 2rem 1rem 0rem 2rem ; | ||
`; | ||
|
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.
I cannot see your dropdown on this route, so can you please add it. Also, try to add the information on how can we view your new PR, like mentioning the route in this case.