Skip to content

Commit 3ffb8fa

Browse files
committed
Turn off temp. strict. Dropdown to ContractDropdown. Style ContractDropdown
1 parent 5346453 commit 3ffb8fa

File tree

6 files changed

+40
-31
lines changed

6 files changed

+40
-31
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.disabled-cursor {
2+
cursor: not-allowed;
3+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import React from 'react'
2+
import './ContractDropdown.css'
3+
interface ContractDropdownItem {
4+
value: string
5+
name: string
6+
}
7+
8+
interface ContractDropdownProps {
9+
label: string
10+
contractNames: ContractDropdownItem[]
11+
id: string
12+
}
13+
14+
export const ContractDropdown: React.FC<ContractDropdownProps> = ({label, contractNames, id}) => {
15+
const hasContracts = contractNames && contractNames.length > 0
16+
return (
17+
<div className="form-group">
18+
<label htmlFor={id}>{label}</label>
19+
20+
<select className={`form-control custom-select pr-4 ${!hasContracts ? 'disabled-cursor' : ''}`} id={id} disabled={!hasContracts}>
21+
{hasContracts ? (
22+
contractNames.map((item, index) => (
23+
<option value={item.value} key={index}>
24+
{item.name}
25+
</option>
26+
))
27+
) : (
28+
<option>No Compiled Contracts. Please compile and select a contract</option>
29+
)}
30+
</select>
31+
</div>
32+
)
33+
}

apps/contract-verification/src/app/components/Dropdown.tsx

Lines changed: 0 additions & 27 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
export {NavMenu} from './NavMenu'
2-
export {Dropdown} from './Dropdown'
2+
export {ContractDropdown} from './ContractDropdown'
33
export {SearchableDropdown} from './SearchableDropdown'

apps/contract-verification/src/app/views/HomeView.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import React from 'react'
22

33
import {AppContext} from '../AppContext'
4-
import {Dropdown} from '../components'
54
import {SearchableDropdown} from '../components'
5+
import {ContractDropdown} from '../components/ContractDropdown'
66

77
export const HomeView = () => {
88
const {chains, selectedChain, setSelectedChain, compilationOutput} = React.useContext(AppContext)
@@ -41,7 +41,7 @@ export const HomeView = () => {
4141
<input type="text" className="form-control" id="contract-address" placeholder="0x2738d13E81e..." />
4242
</div>
4343

44-
{contractNames && contractNames.length > 0 ? <Dropdown label="Contract Name" items={contractNames.map((item) => ({value: item, name: item}))} id="contract-name-dropdown" /> : <div> No compiled contracts </div>}
44+
<ContractDropdown label="Contract Name" contractNames={contractNames?.map((item) => ({value: item, name: item}))} id="contract-name-dropdown" />
4545
<div>
4646
<div>Constructor Arguments</div>
4747
{/* TODO: Add input fields for constructor arguments */}

apps/contract-verification/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"allowJs": true,
66
"esModuleInterop": true,
77
"allowSyntheticDefaultImports": true,
8-
"strict": true
8+
// "strict": true
99
},
1010
"files": [],
1111
"include": [],

0 commit comments

Comments
 (0)