@orsetra/shared-ui 1.18.3 → 1.18.5
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.
|
@@ -21,7 +21,7 @@ export function BusinessUnitSwitcher() {
|
|
|
21
21
|
disabled={loading}
|
|
22
22
|
title={label ? `${label}: change business unit` : "Change business unit"}
|
|
23
23
|
aria-haspopup="dialog"
|
|
24
|
-
className="h-8 w-
|
|
24
|
+
className="h-8 w-36 flex-shrink-0 flex items-center justify-between gap-1.5 px-2 bg-transparent text-text-primary hover:bg-ui-background transition-colors disabled:cursor-default"
|
|
25
25
|
>
|
|
26
26
|
{loading ? (
|
|
27
27
|
<span className="h-2.5 w-20 bg-gray-300 animate-pulse" aria-label="Loading business unit" />
|
|
@@ -50,7 +50,7 @@ function LayoutContent({
|
|
|
50
50
|
const pathname = usePathname()
|
|
51
51
|
const searchParams = useSearchParams()
|
|
52
52
|
const params = useParams()
|
|
53
|
-
const { setOpen } = useSidebar()
|
|
53
|
+
const { setOpen, state: secondaryState } = useSidebar()
|
|
54
54
|
const isMobile = useIsMobile()
|
|
55
55
|
const [isMainSidebarOpen, setIsMainSidebarOpen] = useState(false)
|
|
56
56
|
const [currentMenu, setCurrentMenu] = useState<string>("overview")
|
|
@@ -136,6 +136,9 @@ function LayoutContent({
|
|
|
136
136
|
// The support of the platform; '#' is the default of the build argument when it is not given.
|
|
137
137
|
const configuredSupport = process.env.NEXT_PUBLIC_SUPPORT_URL
|
|
138
138
|
const supportHref = configuredSupport && configuredSupport !== '#' ? configuredSupport : `${main_base_url}/support`
|
|
139
|
+
// With the secondary menu expanded, the start of the header takes its width: the divider before
|
|
140
|
+
// the application falls on its edge (the 1.5rem of padding of the header excepted).
|
|
141
|
+
const alignedOnMenu = !isMobile && !isMinimized && !isHidden && secondaryState === "expanded"
|
|
139
142
|
|
|
140
143
|
return (
|
|
141
144
|
<div className="flex flex-col h-screen w-full bg-white overflow-hidden">
|
|
@@ -143,20 +146,25 @@ function LayoutContent({
|
|
|
143
146
|
<header className="h-14 bg-gray-50 border-b border-ui-border flex-shrink-0">
|
|
144
147
|
<div className="h-full flex items-center justify-between gap-3 px-4 md:px-6">
|
|
145
148
|
{/* The mark, the business unit, the main menu; then the application and its environment. */}
|
|
146
|
-
<div className="min-w-0 flex items-center
|
|
147
|
-
<
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
variant="ghost"
|
|
151
|
-
size="sm"
|
|
152
|
-
onClick={handleMainSidebarToggle}
|
|
153
|
-
className="h-8 w-8 p-0 flex-shrink-0 hover:bg-ui-background text-text-secondary"
|
|
154
|
-
title="Menu principal"
|
|
149
|
+
<div className="min-w-0 flex items-center">
|
|
150
|
+
<div
|
|
151
|
+
className="flex-shrink-0 flex items-center gap-2"
|
|
152
|
+
style={alignedOnMenu ? { width: "calc(var(--sidebar-width) - 1.5rem)" } : undefined}
|
|
155
153
|
>
|
|
156
|
-
<
|
|
157
|
-
|
|
154
|
+
<Logo href={main_base_url} iconOnly className="flex-shrink-0" />
|
|
155
|
+
<BusinessUnitSwitcher />
|
|
156
|
+
<Button
|
|
157
|
+
variant="ghost"
|
|
158
|
+
size="sm"
|
|
159
|
+
onClick={handleMainSidebarToggle}
|
|
160
|
+
className="h-8 w-8 p-0 flex-shrink-0 hover:bg-ui-background text-text-secondary"
|
|
161
|
+
title="Menu principal"
|
|
162
|
+
>
|
|
163
|
+
<Menu className="h-5 w-5" />
|
|
164
|
+
</Button>
|
|
165
|
+
</div>
|
|
158
166
|
{appTitle && (
|
|
159
|
-
<span className=
|
|
167
|
+
<span className={`hidden md:inline-flex items-center gap-2 min-w-0 ${alignedOnMenu ? "" : "ml-2 "}pl-4 border-l border-ui-border text-sm font-normal text-text-primary`}>
|
|
160
168
|
{AppIcon && <AppIcon className="h-4 w-4 flex-shrink-0 text-text-secondary" aria-hidden />}
|
|
161
169
|
<span className="truncate">{appTitle}</span>
|
|
162
170
|
</span>
|