Skip to content

Commit

Permalink
v1.3-beta: cleanup 2
Browse files Browse the repository at this point in the history
  • Loading branch information
sshmatrix committed Jan 4, 2024
1 parent 69e902a commit cae20e6
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 80 deletions.
2 changes: 1 addition & 1 deletion components/Preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import Options from '../components/Options'
import Error from '../components/Error'
import Info from '../components/Info'
import Savings from '../components/WrapUp'
import Loading from './Loading'
import Loading from '../components/Loading'
import Success from '../components/Success'
import Confirm from '../components/Confirm'
import * as constants from '../utils/constants'
Expand Down
70 changes: 68 additions & 2 deletions components/BigSearch.tsx → components/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,74 @@ interface SearchBoxProps {
onSearch: (query: string) => void
}

const BigSearch: React.FC<SearchBoxProps> = ({ onSearch }) => {
export const SearchBox: React.FC<SearchBoxProps> = ({ onSearch }) => {
const [query, setQuery] = useState("")

const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => {
setQuery(event.target.value.toLowerCase())
}

const handleInputInvalid = (event: React.ChangeEvent<HTMLInputElement>) => {
event.target.setCustomValidity("Please enter a valid .eth name")
}

const handleInput = (event: React.ChangeEvent<HTMLInputElement>) => {
event.target.setCustomValidity("")
}

const handleFormSubmit = (event: React.FormEvent<HTMLFormElement>) => {
event.preventDefault()
onSearch(query)
}

return (
<form
className="flex-column-sans-justify"
onSubmit={handleFormSubmit}
>
<div
className="flex-row-sans-justify"
>
<input
type="text"
placeholder={"search".toLowerCase()}
value={query.toLowerCase()}
name=".eth search"
id="eth-search"
onChange={handleInputChange}
onInvalid={handleInputInvalid}
onInput={handleInput}
required
pattern=".*\.eth$"
title="❗ Input must end with '.eth'"
/>
<button
className="button"
style={{
height: '38px',
width: '50px',
marginLeft: '15px'
}}
type="submit"
data-tooltip='Search'
disabled={!query.length}
>
<span
className="material-icons"
style={{
fontSize: '22px',
fontWeight: '700'
}}
>
search
</span>
</button>
</div>
</form>
)
}

export const BigSearch: React.FC<SearchBoxProps> = ({ onSearch }) => {
const [query, setQuery] = useState("")

const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => {
Expand Down Expand Up @@ -88,4 +155,3 @@ const BigSearch: React.FC<SearchBoxProps> = ({ onSearch }) => {
);
};

export default BigSearch
74 changes: 0 additions & 74 deletions components/SearchBox.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion components/Stealth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Help from '../components/Help'
import Salt from '../components/Salt'
import PayTo from '../components/PayTo'
import Error from '../components/Error'
import Loading from './Loading'
import Loading from '../components/Loading'
import Success from '../components/Success'
import * as constants from '../utils/constants'
import { KEYGEN } from '../utils/keygen'
Expand Down
2 changes: 1 addition & 1 deletion pages/account.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import Gateway from '../components/Gateway'
import List from '../components/List'
import Ticker from '../components/Ticker'
import Loading from '../components/Loading'
import SearchBox from '../components/SearchBox'
import { SearchBox } from '../components/Search'
import Confirm from '../components/Confirm'
import Export from '../components/Export'
import * as constants from '../utils/constants'
Expand Down
2 changes: 1 addition & 1 deletion pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import Error from '../components/Error'
import List from '../components/List'
import GasTicker from '../components/Ticker'
import Loading from '../components/Loading'
import BigSearch from '../components/BigSearch'
import { BigSearch } from '../components/Search'
import * as constants from '../utils/constants'
import * as verifier from '../utils/verifier'
import * as ensContent from '../utils/contenthash'
Expand Down

0 comments on commit cae20e6

Please sign in to comment.