Skip to content

Commit

Permalink
Merge pull request #1741 from dusk-network/feature-1740
Browse files Browse the repository at this point in the history
explorer: Fix CTAs on the details page
  • Loading branch information
nortonandreev authored May 17, 2024
2 parents 36e1946 + 9a1244f commit 6fe9afe
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 16 deletions.
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

0 comments on commit 6fe9afe

Please sign in to comment.