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

explorer: Fix CTAs on the details page #1741

Merged
merged 1 commit into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ exports[`Block Details > renders the Block Details component 1`] = `
</h1>

<button
class="dusk-button dusk-button--type--button dusk-button--variant--secondary dusk-button--size--normal"
class="dusk-button dusk-button--type--button dusk-button--variant--tertiary dusk-button--size--normal"
type="button"
>
<span
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ exports[`Transaction Details > renders the Transaction Details component 1`] = `
</h1>

<button
class="dusk-button dusk-button--type--button dusk-button--variant--secondary dusk-button--size--normal"
class="dusk-button dusk-button--type--button dusk-button--variant--tertiary dusk-button--size--normal"
type="button"
>
<span
Expand Down Expand Up @@ -369,7 +369,7 @@ exports[`Transaction Details > renders the Transaction Details component with th
</h1>

<button
class="dusk-button dusk-button--type--button dusk-button--variant--secondary dusk-button--size--normal"
class="dusk-button dusk-button--type--button dusk-button--variant--tertiary dusk-button--size--normal"
type="button"
>
<span
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
action: () => history.back(),
disabled: false,
label: "Back",
variant: "tertiary",
}}
>
<dl class="block-details__list">
Expand Down
18 changes: 10 additions & 8 deletions explorer/src/lib/components/data-card/DataCard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
/** @type {String}*/
export let title;

/** @type {{action:(e: MouseEvent) => void, disabled:boolean, label: String}}*/
export let headerButtonDetails;
/** @type {{action:(e: MouseEvent) => void, disabled: boolean, label: String, variant?: ButtonVariant } | undefined}*/
export let headerButtonDetails = undefined;

/** @type {string | Undefined} */
export let className = undefined;
Expand All @@ -33,12 +33,14 @@
<Card className={classes}>
<header slot="header" class="data-card__header">
<h1 class="data-card__header-title">{title}</h1>
<Button
on:click={headerButtonDetails.action}
text={headerButtonDetails.label}
variant="secondary"
disabled={headerButtonDetails.disabled}
/>
{#if headerButtonDetails}
<Button
on:click={headerButtonDetails.action}
text={headerButtonDetails.label}
variant={headerButtonDetails.variant || "secondary"}
disabled={headerButtonDetails.disabled}
/>
{/if}
</header>
{#if loading && data === null}
<p class="data-card__loading-notice">Loading...</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
/** @type {number} */
let clientWidth;

/** @type {Boolean} */
export let isOnHomeScreen = true;

$: classes = makeClassName(["latest-transactions-card", className]);
</script>

Expand All @@ -35,11 +38,14 @@
{loading}
className={classes}
title="Transactions"
headerButtonDetails={{
action: () => goto("/transactions"),
disabled: false,
label: "All Transactions",
}}
headerButtonDetails={isOnHomeScreen
? {
action: () => goto("/transactions"),
disabled: false,
label: "All Transactions",
variant: "secondary",
}
: undefined}
>
{#if clientWidth > 768}
<TransactionsTable data={txs} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
action: () => history.back(),
disabled: false,
label: "Back",
variant: "tertiary",
}}
>
<dl class="transaction-details__list">
Expand Down
1 change: 1 addition & 0 deletions explorer/src/routes/blocks/block/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
txs={data?.transactions.data}
{error}
loading={isLoading}
isOnHomeScreen={false}
/>
</div>
</section>
Expand Down
Loading