Skip to content

Commit 3ba4604

Browse files
authored
Merge branch 'master' into oztemplates-contract-depsfix
2 parents 725113c + fba3f38 commit 3ba4604

File tree

4 files changed

+109
-8
lines changed

4 files changed

+109
-8
lines changed

Diff for: apps/contract-verification/src/app/components/SearchableChainDropdown.tsx

+104-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
import React, { useState, useEffect, useRef, useMemo } from 'react'
1+
import React, { useState, useEffect, useRef, useMemo, Ref } from 'react'
22
import Fuse from 'fuse.js'
33
import type { Chain } from '../types'
44
import { AppContext } from '../AppContext'
5-
import { useIntl } from 'react-intl'
5+
import intl, { useIntl } from 'react-intl'
6+
import { Dropdown } from 'react-bootstrap'
67

78
function getChainDescriptor(chain: Chain): string {
89
if (!chain) return ''
@@ -16,6 +17,74 @@ interface DropdownProps {
1617
selectedChain: Chain
1718
}
1819

20+
export const CustomToggle = React.forwardRef(
21+
(
22+
{
23+
children,
24+
onClick,
25+
icon,
26+
className = ''
27+
}: {
28+
children: React.ReactNode
29+
onClick: (e) => void
30+
icon: string
31+
className: string
32+
},
33+
ref: Ref<HTMLButtonElement>
34+
) => (
35+
<button
36+
ref={ref}
37+
onClick={(e) => {
38+
e.preventDefault()
39+
onClick(e)
40+
}}
41+
className={className.replace('dropdown-toggle', '')}
42+
>
43+
<div className="d-flex">
44+
<div className="mr-auto text-nowrap text-truncate overflow-hidden" data-id={`dropdown-content`}>{children}</div>
45+
{icon && (
46+
<div className="pr-1">
47+
<i className={`${icon} pr-1`}></i>
48+
</div>
49+
)}
50+
<div>
51+
<i className="fad fa-sort-circle"></i>
52+
</div>
53+
</div>
54+
</button>
55+
)
56+
)
57+
58+
// export const CustomInputToggle = React.forwardRef(
59+
// (
60+
// {
61+
// children,
62+
// onClick,
63+
// icon,
64+
// className = ''
65+
// }: {
66+
// children: React.ReactNode
67+
// onClick: (e) => void
68+
// icon: string
69+
// className: string
70+
// },
71+
// ref: Ref<HTMLInputElement>
72+
// ) => {
73+
// const intl = useIntl()
74+
// return (
75+
// <input
76+
// ref={ref}
77+
// placeholder={intl.formatMessage({ id: "contract-verification.searchableChainDropdown", defaultMessage: "Select a chain" })}
78+
// type="text"
79+
// onClick={(e) => {
80+
// e.preventDefault()
81+
// onClick(e)
82+
// }}
83+
// className={className.replace('dropdown-toggle', '')}
84+
// />
85+
// )}
86+
// )
87+
1988
export const SearchableChainDropdown: React.FC<DropdownProps> = ({ label, id, setSelectedChain, selectedChain }) => {
2089
const { chains } = React.useContext(AppContext)
2190
const ethereumChainIds = [1, 11155111, 17000]
@@ -87,6 +156,38 @@ export const SearchableChainDropdown: React.FC<DropdownProps> = ({ label, id, se
87156
)
88157
}
89158

159+
const CustomInputToggle = React.forwardRef(
160+
(
161+
{
162+
children,
163+
onClick,
164+
icon,
165+
className = ''
166+
}: {
167+
children: React.ReactNode
168+
onClick: (e) => void
169+
icon: string
170+
className: string
171+
},
172+
ref: Ref<HTMLInputElement>
173+
) => {
174+
const intl = useIntl()
175+
return (
176+
<input
177+
ref={ref}
178+
placeholder={intl.formatMessage({ id: "contract-verification.searchableChainDropdown", defaultMessage: "Select a chain" })}
179+
type="text"
180+
onClick={(e) => {
181+
e.preventDefault()
182+
onClick(e)
183+
}}
184+
onChange={handleInputChange}
185+
value={searchTerm}
186+
className={className.replace('dropdown-toggle', '')}
187+
/>
188+
)}
189+
)
190+
90191
return (
91192
<div className="dropdown mb-3" ref={dropdownRef}>
92193
{' '}
@@ -101,7 +202,7 @@ export const SearchableChainDropdown: React.FC<DropdownProps> = ({ label, id, se
101202
placeholder={intl.formatMessage({ id: "contract-verification.searchableChainDropdown", defaultMessage: "Select a chain" })}
102203
className="form-control"
103204
/>
104-
<ul className="dropdown-menu show w-100" style={{ maxHeight: '400px', overflowY: 'auto', display: isOpen ? 'initial' : 'none' }}>
205+
<ul className="dropdown-menu custom-dropdown-items border bg-light show w-100" style={{ maxHeight: '400px', overflowY: 'auto', display: isOpen ? 'initial' : 'none' }}>
105206
{filteredOptions.map((chain) => (
106207
<li
107208
key={chain.chainId}

Diff for: apps/remix-ide/src/assets/css/themes/remix-black_undtds.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -2895,7 +2895,7 @@ input[type="submit"].btn-block {
28952895
color: var(--text);
28962896
text-align: inherit;
28972897
white-space: nowrap;
2898-
background-color: var(--text-background);
2898+
background-color: transparent;
28992899
border: 0;
29002900
}
29012901
.dropdown-item:focus,

Diff for: apps/remix-ide/src/assets/css/themes/remix-dark_tvx1s2.css

+3-3
Original file line numberDiff line numberDiff line change
@@ -2738,10 +2738,10 @@ input[type="submit"].btn-block {
27382738
padding: 0.5rem 0;
27392739
margin: 0.125rem 0 0;
27402740
font-size: 1rem;
2741-
color: var(--text);
2741+
color: #fff;
27422742
text-align: left;
27432743
list-style: none;
2744-
background-color: var(--text-background);
2744+
background-color: #fff;
27452745
background-clip: padding-box;
27462746
border: 1px solid rgba(0, 0, 0, 0.15);
27472747
border-radius: 2px;
@@ -2889,7 +2889,7 @@ input[type="submit"].btn-block {
28892889
color: var(--text);
28902890
text-align: inherit;
28912891
white-space: nowrap;
2892-
background-color: var(--text-background);
2892+
background-color: transparent;
28932893
border: 0;
28942894
}
28952895
.dropdown-item:focus,

Diff for: apps/remix-ide/src/assets/css/themes/remix-hacker_owl.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -2754,7 +2754,7 @@ input[type="submit"].btn-block {
27542754
color: var(--text);
27552755
text-align: left;
27562756
list-style: none;
2757-
background-color: var(--text-background);
2757+
background-color: transparent;
27582758
background-clip: padding-box;
27592759
border: 1px solid rgba(0, 0, 0, 0.15);
27602760
border-radius: 2px;

0 commit comments

Comments
 (0)