You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
spa_instat_tv/src/features/Search/styled.tsx

219 lines
4.0 KiB

import styled, { css } from 'styled-components/macro'
import { isMobileDevice } from 'config/userAgent'
import { customScrollbar } from 'features/Common'
import {
InputWrapper,
InputStyled,
Label,
Error,
} from 'features/Common/Input/styled'
export const Wrapper = styled.div`
max-width: 19.3rem;
margin-left: 0.472rem;
position: relative;
${isMobileDevice
? css`
max-width: 100%;
z-index: 11;
margin-left: 0;
`
: ''};
`
export const LoaderWrapper = styled.div`
position: absolute;
top: 0;
background-color: rgba(129, 129, 129, 0.5);
width: 100%;
height: 100%;
box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.3);
border-radius: 10px;
display: flex;
align-items: center;
justify-content: center;
${isMobileDevice
? css`
max-width: 95vw;
left: 0;
border-radius: 4px;
@media screen and (orientation: landscape){
max-width: 368px;
}
`
: ''};
`
type FormProps = {
expand: boolean,
isMatch: boolean,
}
const expandedStyles = css`
${InputWrapper} {
width: 19.3rem;
background: ${({ theme }) => theme.colors.inputs};
border-radius: 10px;
box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.3);
${isMobileDevice
? css`
max-width: 100%;
border-radius: 4px;
padding: 0 5px;
width: 95vw;
left: 0;
@media screen and (orientation: landscape){
max-width: 368px;
}
`
: ''};
}
`
export const Form = styled.form<FormProps>`
position: relative;
${isMobileDevice
? css`
@media screen and (orientation: landscape){
max-width: 368px;
top: -5px;
}
`
: ''};
${InputWrapper} {
width: 70px;
height: 1.7rem;
margin: 0;
padding-left: 0.567rem;
background-color: transparent;
box-shadow: none;
${isMobileDevice
? css`
height: 28px;
padding-right: 5px;
`
: ''};
}
${InputStyled} {
width: 100%;
padding: 0 12px;
font-weight: normal;
font-size: 14px;
letter-spacing: -0.4px;
::-webkit-search-decoration,
::-webkit-search-cancel-button,
::-webkit-search-results-button,
::-webkit-search-results-decoration {
display: none;
}
${isMobileDevice
? css`
font-size: 12px;
`
: ''};
}
${Label} {
::before {
content: '';
display: block;
position: absolute;
top: 0;
width: 1.18rem;
height: 100%;
background-image: url(/images/search.svg);
background-repeat: no-repeat;
background-position: center;
cursor: pointer;
${isMobileDevice
? css`
display: flex;
align-items: center;
width: 13px;
`
: ''};
}
}
${({ expand }) => (expand ? expandedStyles : null)}
:focus-within {
${expandedStyles}
}
${Error} {
display: none;
}
`
export const ListWrapper = styled.div`
overflow-y: auto;
max-height: 24.72rem;
margin-top: 0.63rem;
${customScrollbar}
::-webkit-scrollbar {
width: 5px;
}
::-webkit-scrollbar-thumb {
background: rgba(255, 255, 255, 0.2);
}
${isMobileDevice
? css`
margin-top: 15px;
max-height: 75vh;
`
: ''};
`
export const Results = styled.div`
position: absolute;
top: 2rem;
width: 19.3rem;
padding: 1.226rem 0.95rem;
background-color: ${({ theme }) => theme.colors.modalBackground};
box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.3);
border-radius: 2px;
z-index: 3;
${isMobileDevice
? css`
top: 33px;
left: 0;
padding: 20px;
width: 95vw;
@media screen and (orientation: landscape){
max-width: 368px;
left: 0;
}
`
: ''};
`
export const ClearButton = styled.button`
outline: none;
border: none;
cursor: pointer;
position: absolute;
top: 0;
right: 0;
width: 1.89rem;
height: 100%;
background-color: transparent;
background-image: url(/images/clear.svg);
background-position: center;
background-repeat: no-repeat;
z-index: 1;
${isMobileDevice
? css`
width: 20px;
margin-right: 5px;
right: 0;
`
: ''};
`