1
1
import React , { memo , useState , createRef } from 'react' ;
2
- import styled , { css } from 'styled-components' ;
2
+ import styled from 'styled-components' ;
3
3
import helpers from 'helpers' ;
4
4
5
5
import { useOnClickOutside } from 'hooks/useOnClickOutside' ;
6
6
import Menu from 'Components/Menu' ;
7
7
8
8
import { Card } from 'Styled/shared' ;
9
+ import { placement } from './dynamic' ;
10
+
9
11
import {
10
12
alignDynamic ,
11
13
visibleDynamic ,
12
14
} from 'Styled/dynamic' ;
13
15
16
+ const MenuContainer = styled . div `
17
+ margin: 0.125rem 0 0;
18
+ padding: 0.5rem 0;
19
+ line-height: 1.5;
20
+ min-width: 10rem;
21
+ transform: none;
22
+ ` ;
23
+
14
24
const Container = styled . div `
15
25
${ alignDynamic } ;
16
26
z-index: 12;
@@ -21,7 +31,9 @@ const Container = styled.div`
21
31
border-color: transparent;
22
32
` ;
23
33
24
- const ContentStyle = styled ( Card ) `
34
+ const Content = styled ( Card ) `
35
+ ${ visibleDynamic } ;
36
+ ${ placement } ;
25
37
text-align: left;
26
38
position: absolute;
27
39
font-size: 14px;
@@ -30,34 +42,6 @@ const ContentStyle = styled(Card)`
30
42
z-index: 1;
31
43
` ;
32
44
33
- const MenuContainer = styled . div `
34
- margin: 0.125rem 0 0;
35
- padding: 0.5rem 0;
36
- line-height: 1.5;
37
- min- width: 10rem;
38
- transfor m: none;
39
- ` ;
40
-
41
- // Dynamic spacing
42
- const spaceing = css `
43
- to p: ${ ( { top } ) => top } ;
44
- left: ${ ( { left } ) => left } ;
45
- ` ;
46
-
47
- const transform = css `
48
- transfor m: ${ ( { placement } ) =>
49
- ( {
50
- topRight : 'translate3d(12px, -143px, 0px)' ,
51
- bottomLeft : 'translate3d(-100px, 20px, 0px)' ,
52
- } [ placement ] ) } ;
53
- ` ;
54
-
55
- const Content = styled ( ContentStyle ) `
56
- ${ spaceing } ;
57
- ${ transform } ;
58
- ${ visibleDynamic } ;
59
- ` ;
60
-
61
45
/**
62
46
*
63
47
* @component
0 commit comments