Skip to content
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

Merged
merged 14 commits into from
Apr 29, 2020
6 changes: 6 additions & 0 deletions src/ignitus-Routes/ignitus-UserInterfaceBookRoutes/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ import {interfaceOverlay} from '../../ignitus-UserInterfaceBook/Components/Molec
import {interfaceTags} from '../../ignitus-UserInterfaceBook/Components/Atoms/interfaceTags/Components';
import {interfaceFilters} from '../../ignitus-UserInterfaceBook/Components/Templates/interfaceFilters/Components/index';
import {interfaceUserProfile} from '../../ignitus-UserInterfaceBook/Components/Organisms/interfaceUserProfile/Components';
import {interfaceSecondaryDropDown} from '../../ignitus-UserInterfaceBook/Components/Atoms/interfaceSecondaryDropdown/Components';
import {InterfaceAvatar} from '../../ignitus-UserInterfaceBook/Components/Organisms/interfaceAvatar/Components';
import {interfaceSideProfile} from '../../ignitus-UserInterfaceBook/Components/Organisms/interfaceSideProfile/Components/index';
import {InterfaceProgress} from '../../ignitus-UserInterfaceBook/Components/Molecules/interfaceProgress/index';


const Container = styled.div`
display: flex;
flex-direction: row;
Expand Down Expand Up @@ -93,6 +95,10 @@ export const UserInterfaceBookRoutes: React.FunctionComponent = () => (
path="/interface/defaultDropdown"
component={interfaceDropDown}
/>
<Route
path="/interface/secondaryDropdown"
Copy link
Member

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.

component={interfaceSecondaryDropDown}
/>
<Route
path="/interface/defaultCheckbox"
component={interfaceCheckBox}
Expand Down
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() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be consistent to code structure

Suggested change
export default function SecondaryDropDown() {
export const SecondaryDropDown: React.FC = () => {

Change accordingly in Components/index.ts

Also make an entry in ignitus-Shared/index.ts, for easy access.

Copy link
Contributor Author

@meghanacosmos meghanacosmos Apr 23, 2020

Choose a reason for hiding this comment

The 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 = [
{
Copy link

Choose a reason for hiding this comment

The 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",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 4 spaces but found 6 indent
Strings must use singlequote quotes
Unnecessarily quoted property 'avatarLink' found quote-props

"name": "Harpar Hopman"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 4 spaces but found 6 indent
Missing trailing comma comma-dangle
Strings must use singlequote quotes
Unnecessarily quoted property 'name' found quote-props

},
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent

{
Copy link

Choose a reason for hiding this comment

The 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",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 4 spaces but found 6 indent
Strings must use singlequote quotes
Unnecessarily quoted property 'avatarLink' found quote-props

"name": "Hara Hopman"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 4 spaces but found 6 indent
Missing trailing comma comma-dangle
Strings must use singlequote quotes
Unnecessarily quoted property 'name' found quote-props

},
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent

{
Copy link

Choose a reason for hiding this comment

The 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",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 4 spaces but found 6 indent
Strings must use singlequote quotes
Unnecessarily quoted property 'avatarLink' found quote-props

"name": "Harbour Center"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 4 spaces but found 6 indent
Missing trailing comma comma-dangle
Strings must use singlequote quotes
Unnecessarily quoted property 'name' found quote-props

},
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent

{
Copy link

Choose a reason for hiding this comment

The 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",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 4 spaces but found 6 indent
Strings must use singlequote quotes
Unnecessarily quoted property 'avatarLink' found quote-props

"name": "Harvard University"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 4 spaces but found 6 indent
Missing trailing comma comma-dangle
Strings must use singlequote quotes
Unnecessarily quoted property 'name' found quote-props

},
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent

{
Copy link

Choose a reason for hiding this comment

The 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",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 4 spaces but found 6 indent
Strings must use singlequote quotes
Unnecessarily quoted property 'avatarLink' found quote-props

"name": "Henry Harbour"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 4 spaces but found 6 indent
Missing trailing comma comma-dangle
Strings must use singlequote quotes
Unnecessarily quoted property 'name' found quote-props

},
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent

{
Copy link

Choose a reason for hiding this comment

The 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",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 4 spaces but found 6 indent
Strings must use singlequote quotes
Unnecessarily quoted property 'avatarLink' found quote-props

"name": "Hara Jackson"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 4 spaces but found 6 indent
Missing trailing comma comma-dangle
Strings must use singlequote quotes
Unnecessarily quoted property 'name' found quote-props

}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent
Missing trailing comma comma-dangle


]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 0 spaces but found 2 indent
Missing semicolon semi


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{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use


 &::placeholder {
    color: ${C.IgnitusBlue};
    font-weight: ${F.SemiBold};
  }

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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use 0 1rem;

`;

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 = {
Copy link

Choose a reason for hiding this comment

The 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 = () => (
Copy link

Choose a reason for hiding this comment

The 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 ;
`;