@orsetra/shared-ui 1.5.25 → 1.5.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -25,6 +25,8 @@ export interface DetailPageHeaderProps {
|
|
|
25
25
|
backHref?: string
|
|
26
26
|
/** Back breadcrumb label */
|
|
27
27
|
backLabel?: string
|
|
28
|
+
/** Callback used instead of backHref when you want router.back() behaviour */
|
|
29
|
+
backAction?: () => void
|
|
28
30
|
/** Optional icon rendered in a blue square container */
|
|
29
31
|
icon?: ReactNode
|
|
30
32
|
/** Page title – truncated to one line */
|
|
@@ -50,6 +52,7 @@ export interface DetailPageHeaderProps {
|
|
|
50
52
|
export function DetailPageHeader({
|
|
51
53
|
backHref,
|
|
52
54
|
backLabel,
|
|
55
|
+
backAction,
|
|
53
56
|
icon,
|
|
54
57
|
title,
|
|
55
58
|
titleNode,
|
|
@@ -61,16 +64,20 @@ export function DetailPageHeader({
|
|
|
61
64
|
enableTabs = true,
|
|
62
65
|
className,
|
|
63
66
|
}: DetailPageHeaderProps) {
|
|
67
|
+
const backCls = "inline-flex items-center gap-1.5 text-xs text-ibm-gray-50 hover:text-ibm-blue-60 transition-colors mb-3"
|
|
64
68
|
return (
|
|
65
69
|
<div className={cn("border-ibm-gray-20", className)}>
|
|
66
70
|
<div className="px-4 sm:px-2 pt-1 pb-0">
|
|
67
71
|
|
|
68
72
|
{/* Breadcrumb */}
|
|
69
|
-
{
|
|
70
|
-
<
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
>
|
|
73
|
+
{backAction && backLabel && (
|
|
74
|
+
<button type="button" onClick={backAction} className={backCls}>
|
|
75
|
+
<ArrowLeft className="h-3 w-3" />
|
|
76
|
+
{backLabel}
|
|
77
|
+
</button>
|
|
78
|
+
)}
|
|
79
|
+
{!backAction && backHref && backLabel && (
|
|
80
|
+
<Link href={backHref} className={backCls}>
|
|
74
81
|
<ArrowLeft className="h-3 w-3" />
|
|
75
82
|
{backLabel}
|
|
76
83
|
</Link>
|