Skip to content
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

feat(fab): update fab content #258

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

debsmita1
Copy link
Member

@debsmita1 debsmita1 commented Jan 8, 2025

Resolves:
https://issues.redhat.com/browse/RHIDP-5398

GIF/Screenshots:

Added slide transition
https://github.com/user-attachments/assets/1b27522e-c0db-48d4-8a4c-ab623b442552

The below screenshot shows the following:

  • Show an icon or an icon with a label, but not only a label
  • Truncating text longer than 20 characters
  • Have set default colors of the sub-menu buttons to be Secondary -pf-tglobalbackgroundcolorsecondary-default , text to be --pf-t--global--text--color--regular and icon color to be --pf-t--global--icon--color--regular
  • Kept 16px from the bottom and the left and right sides. Keep the button on the bottom-right or bottom left and remove middle alignment.
  • Buttons leading to external links has icon to indicate that the link opens externally

Screenshot 2025-01-08 at 8 31 23 PM

Added instructions to recommend users to use only filled icons from the Material Design library

✔️ Checklist

  • A changeset describing the change and affected packages. (more info)
  • Added or Updated documentation
  • Tests for new functionality and regression tests for bug fixes
  • Screenshots attached (for UI changes)

@rhdh-gh-app
Copy link

rhdh-gh-app bot commented Jan 8, 2025

Changed Packages

Package Name Package Path Changeset Bump Current Version
app workspaces/global-floating-action-button/packages/app none v0.0.1
@red-hat-developer-hub/backstage-plugin-global-floating-action-button workspaces/global-floating-action-button/plugins/global-floating-action-button patch v0.0.2

Copy link
Member

@christoph-jerolimov christoph-jerolimov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Some minor changes, but mostly I don't like to see the PatternFly dependency here.

Comment on lines +51 to +59
const getColor = () => {
if (actionButton.color) {
return actionButton.color;
}
if (!className) {
return 'info';
}
return undefined;
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just asking myself: Why are you mixing className and color here?

Couldn't we use info always as fallback?

Comment on lines +82 to +86
{(actionButton.slot === Slot.PAGE_END || !actionButton.slot) && (
<>
{isExternal && (
<OpenInNewIcon className={styles.openInNew} sx={{ mr: 1 }} />
)}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why couldn't we render this as before and just apply different CSS to change the order of the child elements?

<Tooltip title="Menu" placement="left">
<Tooltip
title="Menu"
placement={slot === Slot.PAGE_END ? 'left' : 'right'}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we maybe somewhere have a "Slot to X" configuration option like this.

const slotOptions = {
  [Slot.PAGE_START]: {
    tooltipDirection: "right",
  },
  [Slot.PAGE_END]: {
    tooltipDirection: "left",
  },
} as const;

So that we can use it here like:

Suggested change
placement={slot === Slot.PAGE_END ? 'left' : 'right'}
placement={slotOptions[slot].tooltipDirection}

Comment on lines +82 to +86
style={
slot === Slot.PAGE_END
? { textAlign: 'right' }
: { textAlign: 'left' }
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then we could use it here as well:

Suggested change
style={
slot === Slot.PAGE_END
? { textAlign: 'right' }
: { textAlign: 'left' }
}
style={{ textAlign: slotOptions[slot].textAlignment }}

The benefit is that you see all options then close together and doesn't need more if statements if we add a 3rd option.

@@ -13,6 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import '@patternfly/react-core/dist/styles/base.css';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is PatternFly CSS needed here?

@@ -39,6 +39,7 @@
"@mui/icons-material": "^5.15.17",
"@mui/material": "^5.15.17",
"@mui/styles": "5.16.13",
"@patternfly/react-core": "6.0.0-prerelease.21",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is PatternFly CSS needed here? I don't think that should needed here.

<Fab
{...(newWindow ? { target: '_blank', rel: 'noopener' } : {})}
style={{ color: 'var(--pf-t--global--icon--color--regular)' }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, but that isn't acceptable. We should respect the MUI theme.

If we really need other colors for this we should add that to the theme palette, but always fallback to a useful default.

With this code, we couldn't contribute that plugin to the Backstage community, and it's not reasonable to load PF CSS file for one color.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe I caused some confusion, and I apologize for that. Since this is a new component, I requested the use of theme colors which is based on the PF color guidelines. How can we ensure it aligns well with our theme?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants