Update search component

This commit is contained in:
Hazem Krimi
2021-04-23 18:24:40 +01:00
parent de13544afb
commit dc4cbbb528
2 changed files with 29 additions and 39 deletions
+2
View File
@@ -27,6 +27,7 @@ const Search = ({
return ( return (
<Wrapper color={color} {...props}> <Wrapper color={color} {...props}>
<div className='search'> <div className='search'>
<div>
<span className='icon left'> <span className='icon left'>
<SearchIcon /> <SearchIcon />
</span> </span>
@@ -37,6 +38,7 @@ const Search = ({
placeholder='Search' placeholder='Search'
/> />
</div> </div>
</div>
</Wrapper> </Wrapper>
); );
}; };
+15 -27
View File
@@ -21,28 +21,16 @@ export const Wrapper = styled.div<WrapperProps>`
width: inherit; width: inherit;
height: inherit; height: inherit;
border-radius: 5px; border-radius: 5px;
padding: 1rem; padding: 2px;
position: relative;
color: ${({ theme }) => theme.colors.black.main}; color: ${({ theme }) => theme.colors.black.main};
div {
background: ${({ theme }) => theme.colors.white.main}; background: ${({ theme }) => theme.colors.white.main};
background-clip: padding-box; padding: 1rem;
border: 2px solid transparent; border-radius: 5px;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
&:before {
content: '';
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
width: inherit;
height: inherit;
z-index: -1;
margin: -2px;
border-radius: inherit;
} }
} }
@@ -67,7 +55,7 @@ export const Wrapper = styled.div<WrapperProps>`
switch (color) { switch (color) {
case 'client': case 'client':
return css` return css`
.search:before { .search {
background: ${theme.colors.client.light}; background: ${theme.colors.client.light};
} }
@@ -77,7 +65,7 @@ export const Wrapper = styled.div<WrapperProps>`
`; `;
case 'productOwner': case 'productOwner':
return css` return css`
.search:before { .search {
background: ${theme.colors.productOwner.light}; background: ${theme.colors.productOwner.light};
} }
@@ -87,7 +75,7 @@ export const Wrapper = styled.div<WrapperProps>`
`; `;
case 'developer': case 'developer':
return css` return css`
.search:before { .search {
background: ${theme.colors.developer.light}; background: ${theme.colors.developer.light};
} }
@@ -97,7 +85,7 @@ export const Wrapper = styled.div<WrapperProps>`
`; `;
case 'admin': case 'admin':
return css` return css`
.search:before { .search {
background: ${theme.colors.admin.light}; background: ${theme.colors.admin.light};
} }
@@ -107,7 +95,7 @@ export const Wrapper = styled.div<WrapperProps>`
`; `;
case 'success': case 'success':
return css` return css`
.search:before { .search {
background: ${theme.colors.success.main}; background: ${theme.colors.success.main};
} }
@@ -117,7 +105,7 @@ export const Wrapper = styled.div<WrapperProps>`
`; `;
case 'warning': case 'warning':
return css` return css`
.search:before { .search {
background: ${theme.colors.warning.main}; background: ${theme.colors.warning.main};
} }
@@ -127,7 +115,7 @@ export const Wrapper = styled.div<WrapperProps>`
`; `;
case 'error': case 'error':
return css` return css`
.search:before { .search {
background: ${theme.colors.error.main}; background: ${theme.colors.error.main};
} }
@@ -137,7 +125,7 @@ export const Wrapper = styled.div<WrapperProps>`
`; `;
case 'black': case 'black':
return css` return css`
.search:before { .search {
background: ${theme.colors.black.main}; background: ${theme.colors.black.main};
} }
@@ -147,7 +135,7 @@ export const Wrapper = styled.div<WrapperProps>`
`; `;
case 'white': case 'white':
return css` return css`
.search:before { .search {
background: ${theme.colors.white.main}; background: ${theme.colors.white.main};
} }
@@ -157,7 +145,7 @@ export const Wrapper = styled.div<WrapperProps>`
`; `;
default: default:
return css` return css`
.search:before { .search {
background: ${theme.colors.client.light}; background: ${theme.colors.client.light};
} }