Skip to content

Commit

Permalink
fix: styling (#138)
Browse files Browse the repository at this point in the history
Co-authored-by: Daniel N <2color@users.noreply.github.com>
  • Loading branch information
2color and 2color authored May 3, 2024
1 parent f6a399d commit 2246b25
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions js-peer/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,12 @@ export default function Home() {
[setMultiaddr],
)

const handleDisconnectPeer = useCallback((peerId: PeerId) => {
libp2p.hangUp(peerId)
}, [libp2p])
const handleDisconnectPeer = useCallback(
(peerId: PeerId) => {
libp2p.hangUp(peerId)
},
[libp2p],
)

return (
<>
Expand Down Expand Up @@ -192,12 +195,19 @@ export default function Home() {
Connected peers ({getFormattedConnections(peerStats.connections).length}) 👇
</h3>

<ul className="divide-y divide-gray-100">
<ul className="divide-y divide-gray-200">
{getFormattedConnections(peerStats.connections).map((pair) => (
<li key={pair.peerId.toString()} className="py-1 flex justify-between items-center">
<span>{`${pair.peerId} (${pair.protocols.join(', ')})`}</span>
<button onClick={() => handleDisconnectPeer(pair.peerId)} className="bg-red-500 hover:bg-red-600 text-white font-bold py-2 px-4 rounded flex flex-row">
<XCircleIcon className="w-6 h-6" /> Disconnect
<li
key={pair.peerId.toString()}
className="py-1 flex flex-wrap justify-between items-center break-all"
>
<span>{`${pair.peerId.toString()} (${pair.protocols.join(', ')})`}</span>
<button
onClick={() => handleDisconnectPeer(pair.peerId)}
className="bg-red-500 hover:bg-red-600 text-white font-bold py-2 px-4 rounded flex flex-row"
>
<XCircleIcon className="w-6 h-6" />
<span className="pl-1">Disconnect</span>
</button>
</li>
))}
Expand Down

0 comments on commit 2246b25

Please sign in to comment.