1- import React from 'react' ;
2- import styled from 'styled-components' ;
3- import { Link } from 'react-router-dom' ;
41import delayEffect from '@codesandbox/common/lib/utils/animation/delay-effect' ;
2+ import React , { ComponentProps , forwardRef } from 'react' ;
3+ import { Link } from 'react-router-dom' ;
54import { MenuSeparator } from 'reakit' ;
5+ import styled , { css } from 'styled-components' ;
66
77export const Container = styled . div `
8- background-color: ${ props => props . theme . background4 } ;
9- box-shadow: 0px 3px 8px rgba(0, 0, 0, 0.75);
8+ ${ ( { theme } ) => css `
9+ background-color : ${ theme . background4 } ;
10+ box-shadow : 0 3px 8px rgba (0 , 0 , 0 , 0.75 );
1011
11- ${ delayEffect ( 0 ) } ;
12+ ${ delayEffect ( 0 ) } ;
1213
13- min-width: 200px;
14+ min- width: 200px;
1415
15- z-index: 20;
16+ z- index: 20;
17+ ` } ;
1618` ;
1719
18- const StyledMenu = styled ( Link ) < { to ?: string ; href ?: string } > `
19- transition: 0.3s ease all;
20- display: flex;
21- align-items: center;
22- font-size: 0.875rem;
23- padding: 0.5rem 1rem;
20+ const StyledMenu = styled ( Link ) < { href ?: string ; to ?: string } > `
21+ ${ ( { theme } ) => css `
22+ transition: 0.3s ease all;
23+ dis play: flex;
24+ align- items: center;
25+ font- size: 0.875rem;
26+ padding: 0.5rem 1rem;
2427
25- text-decoration: none;
28+ text- decor ation: none;
2629
27- color: rgba(255, 255, 255, 0.8);
28- border: 0;
29- outline: 0;
30- outline-width: 0 !important;
31- box-sizing: border-box;
32- border-left: 2px solid transparent;
33- background-color: transparent;
34- width: 100%;
30+ color : rgba(255, 255, 255, 0.8);
31+ bor der: 0;
32+ outline: 0 !important ;
33+ box- sizing: bor der- box;
34+ bor der- left: 2px solid transparent;
35+ background- color : transparent;
36+ width: 100%;
3537
36- cursor: pointer;
38+ cursor : pointer;
3739
38- &:focus {
39- border-color: ${ props => props . theme . secondary } ;
40- color: white;
41- background-color: ${ props => props . theme . secondary . clearer ( 0.9 ) } ;
42- outline: 0;
43- }
40+ & : focus {
41+ border-color : ${ theme . secondary } ;
42+ color : white;
43+ background-color : ${ theme . secondary . clearer ( 0.9 ) } ;
44+ outline : 0 ;
45+ }
4446
45- &:hover {
46- border-color: ${ props => props . theme . secondary } ;
47- color: white;
48- background-color: ${ props => props . theme . secondary . clearer ( 0.9 ) } ;
49- }
47+ & : hover {
48+ border-color : ${ theme . secondary } ;
49+ color : white;
50+ background-color : ${ theme . secondary . clearer ( 0.9 ) } ;
51+ }
52+ ` } ;
5053` ;
5154
5255const StyledMenuA = StyledMenu . withComponent ( 'a' ) ;
5356const StyledMenuButton = StyledMenu . withComponent ( 'button' ) ;
5457
55- export const ItemA = React . forwardRef ( ( props : any , ref ) => (
56- < StyledMenuA { ...props } ref = { ref } />
57- ) ) ;
58- export const ItemButton = React . forwardRef ( ( props : any , ref ) => (
59- < StyledMenuButton { ...props } ref = { ref } />
60- ) ) ;
61- export const ItemLink = React . forwardRef ( ( props : any , ref ) => (
62- < StyledMenu { ...props } innerRef = { ref } />
63- ) ) ;
58+ export const ItemA = forwardRef <
59+ HTMLAnchorElement ,
60+ ComponentProps < typeof StyledMenuA >
61+ > ( ( props , ref ) => < StyledMenuA { ...props } ref = { ref } /> ) ;
62+ export const ItemButton = forwardRef <
63+ HTMLButtonElement ,
64+ ComponentProps < typeof StyledMenuButton >
65+ > ( ( props , ref ) => < StyledMenuButton { ...props } ref = { ref } /> ) ;
66+ export const ItemLink = forwardRef <
67+ HTMLAnchorElement ,
68+ ComponentProps < typeof StyledMenu >
69+ > ( ( props , ref ) => < StyledMenu { ...props } innerRef = { ref } /> ) ;
6470
6571export const Icon = styled . span `
6672 margin-right : 0.75rem ;
@@ -69,11 +75,13 @@ export const Icon = styled.span`
6975` ;
7076
7177export const Separator = styled ( MenuSeparator ) `
72- height: 1px;
73- width: 100%;
74- margin: 0.5rem 0;
78+ ${ ( { theme } ) => css `
79+ height : 1px ;
80+ width : 100% ;
81+ margin : 0.5rem 0 ;
7582
76- background-color: ${ props => props . theme . background } ;
77- border: 0;
78- outline: 0;
83+ background-color : ${ theme . background } ;
84+ border : 0 ;
85+ outline : 0 ;
86+ ` } ;
7987` ;
0 commit comments