-
Notifications
You must be signed in to change notification settings - Fork 0
/
ListaDesplegable.jsx
64 lines (62 loc) · 1.43 KB
/
ListaDesplegable.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import styled from "styled-components";
import { Device} from "../../index";
export function ListaDesplegable({ data, setState, funcion, scroll,top,state }) {
if(!state) return;
function seleccionar(p) {
funcion(p);
setState();
}
return (
<Container scroll={scroll} $top={top}>
<section className="contentClose" onClick={setState}>
x
</section>
<section className="contentItems">
{data?.map((item, index) => {
return (
<ItemContainer key={index} onClick={() => seleccionar(item)}>
<span>🌫️</span>
<span>{item?.nombre}</span>
</ItemContainer>
);
})}
</section>
</Container>
);
}
const Container = styled.div`
display: flex;
flex-direction: column;
background: ${({ theme }) => theme.body};
color: ${({ theme }) => theme.text};
position: absolute;
margin-bottom: 15px;
top: ${(props)=>props.$top};
width: 100%;
padding: 10px;
border-radius: 10px;
gap: 10px;
z-index: 3;
height:230px;
@media ${() => Device.tablet} {
}
.contentClose{
font-weight:700;
cursor: pointer;
font-size:20px;
}
.contentItems {
overflow-y: ${(props) => props.scroll};
}
`;
const ItemContainer = styled.div`
gap: 10px;
display: flex;
padding: 10px;
border-radius: 10px;
cursor: pointer;
transition: 0.3s;
&:hover {
background-color: ${({ theme }) => theme.bgtotal};
}
`;