Skip to content

Commit 0424052

Browse files
author
GitHub Actions
committed
Displaying the preferred username and Company Logo
1 parent c12f7a6 commit 0424052

File tree

3 files changed

+117
-1
lines changed

3 files changed

+117
-1
lines changed

assemblies/assembly-configuring-the-global-header.adoc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,10 @@ By default, the {product-short} global header includes the following components:
1616
include::modules/configuring-the-global-header/proc-customize-rhdh-global-header.adoc[leveloffset=+1]
1717

1818

19-
include::modules/configuring-the-global-header/proc-mount-points.adoc[leveloffset=+1]
19+
include::modules/configuring-the-global-header/proc-mount-points.adoc[leveloffset=+1]
20+
21+
22+
include::modules/configuring-the-global-header/proc-displaying-company-logo-in-the-global-header.adoc[leveloffset=+1]
23+
24+
25+
include::modules/configuring-the-global-header/proc-displaying-preferred-username-in-profile-dropdown.adoc[leveloffset=+1]
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
[id="displaying-company-logo-in-the-global-header.adoc_{context}"]
2+
= Displaying company logo in the global header
3+
4+
You can configure a company logo in the *Global Header* of the {product} ({product-very-short}) to reflect your company's branding.
5+
6+
The `CompanyLogo` supports strict display constraints to ensure visual consistency:
7+
8+
* Maximum dimensions: 150px wide, 40px high.
9+
* The logo must retain its original proportions.
10+
* The component layout remains fixed and cannot be moved from its mount point.
11+
* Supports the following props:
12+
** `logo`: Encoded logo image.
13+
** `to`: The redirect path where the logo is clicked.
14+
15+
.Procedure
16+
17+
To display a custom company logo in the *Global Header*, update the configuration with a mount point for `CompanyLogo`:
18+
19+
.Example: Configuring company logo
20+
21+
[source,yaml,subs="+attributes,+quotes"]
22+
----
23+
red-hat-developer-hub.backstage-plugin-global-header:
24+
mountPoints:
25+
- mountPoint: global.header/component
26+
importName: CompanyLogo
27+
config:
28+
priority: 200 # <1>
29+
props:
30+
logo:
31+
fullLogo:
32+
to: '/' # <2>
33+
#...Rest of the Global Header Configuration
34+
----
35+
<1> Specify the position of the company logo in the global header.
36+
<2> The redirect path. The logo should display the custom image or icon.
37+
38+
To ensure the logo appears in the correct location, configure the Global Header’s `position` value as shown in the example below:
39+
40+
[source,yaml]
41+
----
42+
red-hat-developer-hub.backstage-plugin-global-header:
43+
mountPoints:
44+
- mountPoint: application/header
45+
importName: GlobalHeader
46+
config:
47+
position: above-sidebar
48+
----
49+
50+
By default, `position` is set to `above-main-content`.
51+
52+
.Verification
53+
. The logo appears correctly in the Global Header.
54+
. Click the logo to confirm it redirects to the path you defined in `props.to`.
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
[id="displaying-preferred-username-in-global-header-profile-dropdown_{context}"]
2+
= Displaying the preferred username in the profile dropdown
3+
4+
You can display the preferred username in the global header's profile dropdown by configuring `spec.profile.displayName` in the user entity. When not configured, the application falls back to a `metadata.title`. If neither is configured, it defaults to a user-friendly name generated by the `useProfileInfo` hook.
5+
6+
.Procedure
7+
.Example when you configure `spec.profile.displayName`
8+
9+
[source,yaml,subs="+attributes,+quotes"]
10+
----
11+
apiVersion: backstage.io/v1alpha1
12+
kind: User
13+
metadata:
14+
name: _<my_display_name>_ # <1>
15+
title: _<display_name_title>_ # <2>
16+
spec:
17+
profile:
18+
displayName: _<my_display_name>_ # <3>
19+
memberOf: [janus-authors]
20+
----
21+
<1> Required: Specify the unique username (`metadata.name`).
22+
<2> Optional: Specify the preferred title (`metadata.title`).
23+
<3> Optional: Specify the preferred display name (`spec.profile.displayName`). This takes the highest priority.
24+
25+
.Example when you do not configure `spec.profile.displayname` but configure `metadata.title`
26+
27+
[source,yaml,subs="+attributes,+quotes"]
28+
----
29+
apiVersion: backstage.io/v1alpha1
30+
kind: User
31+
metadata:
32+
name: _<my_display_name>_ # <1>
33+
title: _<display_name_title>_ # <2>
34+
spec:
35+
memberOf: [janus-authors]
36+
----
37+
<1> Required: Specify the unique username (`metadata.name`).
38+
<2> Optional: Specify the preferred title (`metadata.title`).
39+
40+
.Example when you do not configure the `spec.profile.displayname` and the `title`
41+
42+
[source,yaml,subs="+attributes,+quotes"]
43+
----
44+
apiVersion: backstage.io/v1alpha1
45+
kind: User
46+
metadata:
47+
name: _<my_display_name>_ # <1>
48+
spec:
49+
memberOf: [janus-authors]
50+
----
51+
<1> Required: Specify the unique username (`metadata.name`).
52+
53+
[NOTE]
54+
====
55+
The application falls back to `metadata.name` when you do not register the user entity.
56+
====

0 commit comments

Comments
 (0)