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

Fixed inconsistent column spacing on the homepage #506

Merged
merged 5 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/swift-dots-happen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@blobscan/web": patch
---

Fixed inconsistent column spacing on the homepage
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const SurfaceCardBase: FC<SurfaceCardBaseProps> = function ({
className={`
dark:bg-neutral-850
${truncateText ? "truncate" : ""}
h-28
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A possible solution:

Suggested change
h-28
h-full

This allows the component to adapt to any size defined by its parent elements.

rounded-md
border
border-border-light
Expand Down
58 changes: 24 additions & 34 deletions apps/web/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ import {
const LATEST_ITEMS_LENGTH = 5;
const DAILY_STATS_TIMEFRAME = "15d";

const CARD_HEIGHT = "sm:h-28";

const Home: NextPage = () => {
const router = useRouter();
const {
Expand Down Expand Up @@ -209,20 +207,14 @@ const Home: NextPage = () => {
{Array(LATEST_ITEMS_LENGTH)
.fill(0)
.map((_, i) => (
<div className={CARD_HEIGHT} key={i}>
<BlockCard />
</div>
<BlockCard key={i} />
))}
</div>
) : (
<SlidableList
items={blocks?.map((b) => ({
id: b.hash,
element: (
<div className={CARD_HEIGHT} key={b.hash}>
<BlockCard block={b} />
</div>
),
element: <BlockCard block={b} key={b.hash} />,
}))}
/>
)}
Expand All @@ -249,31 +241,28 @@ const Home: NextPage = () => {
{Array(LATEST_ITEMS_LENGTH)
.fill(0)
.map((_, i) => (
<div className={CARD_HEIGHT} key={i}>
<BlobTransactionCard compact />
</div>
<BlobTransactionCard compact key={i} />
))}
</div>
) : (
<SlidableList
items={transactions.map((tx) => ({
id: tx.hash,
element: (
<div className={CARD_HEIGHT} key={tx.hash}>
<BlobTransactionCard
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>
<BlobTransactionCard
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
/>
),
}))}
/>
Expand All @@ -300,19 +289,20 @@ const Home: NextPage = () => {
{Array(LATEST_ITEMS_LENGTH)
.fill(0)
.map((_, i) => (
<div className={CARD_HEIGHT} key={i}>
<BlobTransactionCard compact />
</div>
<BlobTransactionCard compact key={i} />
))}
</div>
) : (
<SlidableList
items={blobs.map((b) => ({
id: b.versionedHash,
element: (
<div className={CARD_HEIGHT} key={b.versionedHash}>
<BlobCard blob={b} transactions={[b.tx]} compact />
</div>
<BlobCard
blob={b}
transactions={[b.tx]}
compact
key={b.versionedHash}
/>
),
}))}
/>
Expand Down
Loading