Skip to content

Commit

Permalink
fix: adjust layout and spacing in Home/SlidableList (#632)
Browse files Browse the repository at this point in the history
* fix: adjust layout and spacing in Home/SlidableList

* fix: update layout for card headers to support 2xl breakpoint

* chore: update changeset

* fix: tailwind typo
  • Loading branch information
luis-herasme authored Nov 25, 2024
1 parent 6512745 commit b89af3a
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 96 deletions.
5 changes: 5 additions & 0 deletions .changeset/rude-news-glow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@blobscan/web": patch
---

Improved the home lists spacing
2 changes: 1 addition & 1 deletion apps/web/src/components/SlidableList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const SlidableList: FC<SlidableListProps> = function ({
}, [itemsProp]);

return (
<div className="relative flex h-full w-full flex-col gap-3 overflow-hidden">
<div className="relative flex h-full w-full flex-col gap-3">
{transitions((style, item) => (
<animated.div
style={{
Expand Down
180 changes: 85 additions & 95 deletions apps/web/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ const Home: NextPage = () => {
<div className="grid grid-cols-1 items-stretch justify-stretch gap-6 lg:grid-cols-3">
<Card
header={
<div className=" flex flex-wrap items-center justify-between gap-5">
<div className="flex-wrap flex flex-col justify-between gap-3 2xl:flex-row 2xl:items-center">
<div>Latest Blocks</div>
<Button
variant="outline"
Expand All @@ -203,34 +203,28 @@ const Home: NextPage = () => {
}
emptyState="No blocks"
>
<div className="h-[660px] sm:h-[630px]">
{latestBlocksLoading ? (
<div className="flex flex-col gap-4">
{Array(LATEST_ITEMS_LENGTH)
.fill(0)
.map((_, i) => (
<BlockCard className={CARD_HEIGHT} key={i} />
))}
</div>
) : (
<SlidableList
items={blocks?.map((b) => ({
id: b.hash,
element: (
<BlockCard
className={CARD_HEIGHT}
block={b}
key={b.hash}
/>
),
}))}
/>
)}
</div>
{latestBlocksLoading ? (
<div className="flex flex-col gap-4">
{Array(LATEST_ITEMS_LENGTH)
.fill(0)
.map((_, i) => (
<BlockCard className={CARD_HEIGHT} key={i} />
))}
</div>
) : (
<SlidableList
items={blocks?.map((b) => ({
id: b.hash,
element: (
<BlockCard className={CARD_HEIGHT} block={b} key={b.hash} />
),
}))}
/>
)}
</Card>
<Card
header={
<div className="flex-warp flex items-center justify-between gap-5">
<div className="flex-wrap flex flex-col justify-between gap-3 2xl:flex-row 2xl:items-center">
<div>Latest Blob Transactions</div>
<Button
variant="outline"
Expand All @@ -243,48 +237,46 @@ const Home: NextPage = () => {
}
emptyState="No transactions"
>
<div className="h-[630px]">
{latestBlocksLoading ? (
<div className="flex flex-col gap-3">
{Array(LATEST_ITEMS_LENGTH)
.fill(0)
.map((_, i) => (
<BlobTransactionCard
className={CARD_HEIGHT}
compact
key={i}
/>
))}
</div>
) : (
<SlidableList
items={transactions.map((tx) => ({
id: tx.hash,
element: (
<BlobTransactionCard
className={CARD_HEIGHT}
key={tx.hash}
transaction={{
from: tx.from,
to: tx.to,
hash: tx.hash,
rollup: tx.rollup,
blockTimestamp: tx.blockTimestamp,
blobGasBaseFee: tx.blobGasBaseFee,
blobGasMaxFee: tx.blobGasMaxFee,
}}
blobs={tx.blobs}
compact
/>
),
}))}
/>
)}
</div>
{latestBlocksLoading ? (
<div className="flex flex-col gap-3">
{Array(LATEST_ITEMS_LENGTH)
.fill(0)
.map((_, i) => (
<BlobTransactionCard
className={CARD_HEIGHT}
compact
key={i}
/>
))}
</div>
) : (
<SlidableList
items={transactions.map((tx) => ({
id: tx.hash,
element: (
<BlobTransactionCard
className={CARD_HEIGHT}
key={tx.hash}
transaction={{
from: tx.from,
to: tx.to,
hash: tx.hash,
rollup: tx.rollup,
blockTimestamp: tx.blockTimestamp,
blobGasBaseFee: tx.blobGasBaseFee,
blobGasMaxFee: tx.blobGasMaxFee,
}}
blobs={tx.blobs}
compact
/>
),
}))}
/>
)}
</Card>
<Card
header={
<div className="flex items-center justify-between gap-5">
<div className="flex-wrap flex flex-col justify-between gap-3 2xl:flex-row 2xl:items-center">
<div>Latest Blobs</div>
<Button
variant="outline"
Expand All @@ -296,36 +288,34 @@ const Home: NextPage = () => {
}
emptyState="No blobs"
>
<div className="h-[650px] sm:h-[630px]">
{latestBlocksLoading ? (
<div className="flex flex-col gap-3">
{Array(LATEST_ITEMS_LENGTH)
.fill(0)
.map((_, i) => (
<BlobTransactionCard
className={CARD_HEIGHT}
compact
key={i}
/>
))}
</div>
) : (
<SlidableList
items={blobs.map((b) => ({
id: b.versionedHash,
element: (
<BlobCard
blob={b}
transactions={[b.tx]}
compact
key={b.versionedHash}
className={CARD_HEIGHT}
/>
),
}))}
/>
)}
</div>
{latestBlocksLoading ? (
<div className="flex flex-col gap-3">
{Array(LATEST_ITEMS_LENGTH)
.fill(0)
.map((_, i) => (
<BlobTransactionCard
className={CARD_HEIGHT}
compact
key={i}
/>
))}
</div>
) : (
<SlidableList
items={blobs.map((b) => ({
id: b.versionedHash,
element: (
<BlobCard
blob={b}
transactions={[b.tx]}
compact
key={b.versionedHash}
className={CARD_HEIGHT}
/>
),
}))}
/>
)}
</Card>
</div>
</div>
Expand Down

0 comments on commit b89af3a

Please sign in to comment.