Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added : from filter #31

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open
14 changes: 13 additions & 1 deletion components/Bundles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export default function Bundles({ bundles }) {
const [openModal, setOpenModal] = useState(false);
const [bundle, setBundle] = useState(undefined);
const [searchValue, setSearch] = useState(undefined);
const [fromAddress, setFromAddress] = useState(undefined);

useEffect(() => {
if (router.query.block) {
Expand Down Expand Up @@ -40,9 +41,15 @@ export default function Bundles({ bundles }) {
}
};

const findBundleByAddress = _add => {
if (_add !== undefined) {
router.push(`/?from=${_add}`, undefined, { shallow: true });
}
};

const submit = e => {
e.preventDefault();
findBundleAndOpen(searchValue);
findBundleByAddress(fromAddress);
};

return <div className="w-10/12 self-center text-center">
Expand All @@ -52,6 +59,11 @@ export default function Bundles({ bundles }) {
<input type="number" onChange={ e => setSearch(e.target.value) } />
<button type="submit"> 🔍</button>
</form>
<form className={styles.search} onSubmit={ submit }>
<span>Filter by from address</span>
<input type="text" onChange={ e => setFromAddress(e.target.value) } />
<button type="submit"> 🔍</button>
</form>
<div className="-my-2 overflow-x-auto sm:-mx-6 lg:-mx-8">
<div className="py-2 align-middle inline-block min-w-full sm:px-6 lg:px-8">
<div className="shadow overflow-hidden border-b border-gray-200 sm:rounded-lg">
Expand Down
1 change: 1 addition & 0 deletions styles/Home.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
@apply inline-flex self-center bg-gray-200 items-center mb-7;
padding: 0 0 0 1.3rem;
border-radius: 2rem;
margin-left: 0.3rem;
}

.search span {
Expand Down