generated from redhat-developer/new-project-template
-
Notifications
You must be signed in to change notification settings - Fork 52
RHIDP-7614: Displaying the preferred username and Company Logo #1254
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
Open
jmagak
wants to merge
6
commits into
redhat-developer:main
Choose a base branch
from
jmagak:RHIDP-7614-Global-Header-Add-Company-Logo-and-User-profile-icon-support
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+154
−1
Open
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
e9b4316
Displaying the preferred username and Company Logo
invalid-email-address 2bc3691
Displaying the preferred username and Company Logo
invalid-email-address 4169455
Displaying the preferred username and Company Log
invalid-email-address e91b801
Merge branch 'main' into RHIDP-7614-Global-Header-Add-Company-Logo-an…
jmagak 77bf8a1
Merge branch 'main' into RHIDP-7614-Global-Header-Add-Company-Logo-an…
jmagak cfd7edb
Displaying the preferred username and Company Log
invalid-email-address File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
95 changes: 95 additions & 0 deletions
95
...guring-the-global-header/proc-displaying-company-logo-in-the-global-header.adoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
[id="displaying-company-logo-in-the-global-header.adoc_{context}"] | ||
= Displaying company logo in the global header | ||
|
||
You can configure a company logo in the global header of the {product} ({product-very-short}) to reflect your company's branding. The `CompanyLogo` is now part of the global header by default and offers full control over the theming, navigation behavior, sizing, and fallback options. | ||
|
||
The `CompanyLogo` ensures strict display constraints to maintain design consistency: | ||
jmagak marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
* The default maximum dimensions: `150px` wide, `40px` high. | ||
jmagak marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* The logo must retain its original proportions using `object-fit: contain` | ||
jmagak marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* The component keeps its layout fixed and you cannot move it from its mount point. | ||
jmagak marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* The `CompanyLogo` automatically scales the image down if dimensions exceed allowed size. | ||
jmagak marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
This component also supports the following props: | ||
|
||
* `logo`: The encoded logo image. | ||
jmagak marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* `to`: The redirect path for when users click the logo. | ||
* `width`: Optional width of the logo. | ||
* `height`: Optional height of the logo. | ||
|
||
.Procedure | ||
|
||
. To display a custom company logo in the global header, update the configuration with a mount point for `CompanyLogo`: | ||
+ | ||
.Example: Configuring company logo | ||
+ | ||
[source,yaml,subs="+attributes,+quotes"] | ||
---- | ||
# ...rest of the global header configuration | ||
red-hat-developer-hub.backstage-plugin-global-header: | ||
mountPoints: | ||
- mountPoint: application/header | ||
importName: GlobalHeader | ||
config: | ||
position: above-main-content # <1> | ||
|
||
- mountPoint: global.header/component | ||
importName: CompanyLogo | ||
config: | ||
priority: 200 | ||
props: | ||
to: '/catalog' # <2> | ||
width: 300 | ||
height: 200 | ||
#logo: 'data:image/png;base64,...' # <3> | ||
logo: | ||
dark: 'data:image/png;base64,...' # <4> | ||
light: 'data:image/png;base64,...' # <5> | ||
---- | ||
<1> Specify the position of the company logo in the global header. By default, the `position` is set to `above-main-content`. Supported values are `above-main-content` and `above-sidebar`. | ||
jmagak marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<2> Define the redirect path for when users click the logo. | ||
<3> Provide a single logo to apply across all themes. | ||
<4> Provide a dark mode logo in the `logo.dark`. | ||
jmagak marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<5> Provide a light mode logo in the `logo.light`. | ||
jmagak marked this conversation as resolved.
Show resolved
Hide resolved
|
||
+ | ||
You can use either a single logo for all themes or theme-specific logos (light and dark). If you define both, theme-specific logos take precedence over the single logo. | ||
jmagak marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
. (Optional) If you do not provide props to the `CompanyLogo` component, the component instead uses values defined under `app.branding` in your `{my-app-config-file}` file. You can configure both the sidebar logo and the `CompanyLogo` fallback as shown in the following configuration: | ||
jmagak marked this conversation as resolved.
Show resolved
Hide resolved
|
||
+ | ||
.Example: Fallback configuration | ||
+ | ||
[source,yaml,subs="+attributes,+quotes"] | ||
---- | ||
app: | ||
branding: | ||
fullLogoWidth: 220 # Fallback width | ||
# fullLogo: "data:image/svg+xml;base64,..." | ||
fullLogo: | ||
light: 'data:image/svg+xml;base64,...' | ||
dark: 'data:image/svg+xml;base64,...' | ||
---- | ||
+ | ||
The `CompanyLogo` uses the following configuration elements to control fallback and sizing behavior: | ||
jmagak marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
* *Logo source priority* | ||
** If you fail to provide a logo through either the `CompanyLogo` props (`logo`, `logo.light`, `logo.dark`) or the `app.branding.fullLogo`, the component displays the default {product-short} theme-specific logo. | ||
jmagak marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
* *Logo width priority* | ||
** If you fail to specify the `width` using the `CompanyLogo` prop (`props.width`) or through the `app.branding.fullLogoWidth` from the `{my-app-config-file}`, the component applies a default width. | ||
jmagak marked this conversation as resolved.
Show resolved
Hide resolved
|
||
** If your configure `width` results in a height greater than the default maximum height, the component automatically scales the logo down. | ||
jmagak marked this conversation as resolved.
Show resolved
Hide resolved
|
||
+ | ||
In some cases, changing only the width might not visibly affect the logo unless you also adjust the height. | ||
|
||
* *Logo height priority* | ||
** If you do not specify the `height` using the `CompanyLogo` prop (`props.height`), the component automatically applies a default maximum height. | ||
jmagak marked this conversation as resolved.
Show resolved
Hide resolved
|
||
+ | ||
[NOTE] | ||
==== | ||
If you increase the company logo's height, the global header height also increases, but the image never appears cropped or distorted. | ||
jmagak marked this conversation as resolved.
Show resolved
Hide resolved
|
||
==== | ||
|
||
.Verification | ||
. The logo appears correctly in the global header. | ||
. Click the logo to confirm it redirects to the path you defined in `props.to`. | ||
. Toggle between `light` and `dark` themes to ensure the correct logo loads in each. | ||
. (Optional) Temporarily remove the `CompanyLogo` props to test the fallback to `app.branding.fullLogo`. |
56 changes: 56 additions & 0 deletions
56
...g-the-global-header/proc-displaying-preferred-username-in-profile-dropdown.adoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
[id="displaying-preferred-username-in-global-header-profile-dropdown_{context}"] | ||
= Displaying the preferred username in the profile dropdown | ||
|
||
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. | ||
jmagak marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
.Procedure | ||
.Example when you configure `spec.profile.displayName` | ||
|
||
[source,yaml,subs="+attributes,+quotes"] | ||
---- | ||
apiVersion: backstage.io/v1alpha1 | ||
kind: User | ||
metadata: | ||
name: _<my_display_name>_ # <1> | ||
title: _<display_name_title>_ # <2> | ||
spec: | ||
profile: | ||
displayName: _<my_display_name>_ # <3> | ||
memberOf: [janus-authors] | ||
---- | ||
<1> Required: Specify the unique username (`metadata.name`). | ||
<2> Optional: Specify the preferred title (`metadata.title`). | ||
<3> Optional: Specify the preferred display name (`spec.profile.displayName`). This takes the highest priority. | ||
|
||
.Example when you do not configure `spec.profile.displayname` but configure `metadata.title` | ||
|
||
[source,yaml,subs="+attributes,+quotes"] | ||
---- | ||
apiVersion: backstage.io/v1alpha1 | ||
kind: User | ||
metadata: | ||
name: _<my_display_name>_ # <1> | ||
title: _<display_name_title>_ # <2> | ||
spec: | ||
memberOf: [janus-authors] | ||
---- | ||
<1> Required: Specify the unique username (`metadata.name`). | ||
<2> Optional: Specify the preferred title (`metadata.title`). | ||
|
||
.Example when you do not configure the `spec.profile.displayname` and the `metadata.title` | ||
|
||
[source,yaml,subs="+attributes,+quotes"] | ||
---- | ||
apiVersion: backstage.io/v1alpha1 | ||
kind: User | ||
metadata: | ||
name: _<my_display_name>_ # <1> | ||
spec: | ||
memberOf: [janus-authors] | ||
---- | ||
<1> Required: Specify the unique username (`metadata.name`). | ||
|
||
[NOTE] | ||
==== | ||
The application falls back to `metadata.name` when you do not register the user entity. | ||
==== |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.