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

fix(rbac): fixed ui issues #2061

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ciiay
Copy link
Contributor

@ciiay ciiay commented Nov 22, 2024

Hey, I just made a Pull Request!

For fix of UI issues of RBAC plugin.

✔️ 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)
  • All your commits have a Signed-off-by line in the message. (more info)

image
image
image

image
image

@ciiay ciiay requested a review from a team as a code owner November 22, 2024 06:54
@backstage-goalie
Copy link
Contributor

backstage-goalie bot commented Nov 22, 2024

Changed Packages

Package Name Package Path Changeset Bump Current Version
@backstage-community/plugin-rbac workspaces/rbac/plugins/rbac patch v1.33.0

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.

Hi @ciiay, thanks, for the UI improvements! 👍

It would be nice if you can take a look into the comments. I think in some spots we can simplify the code and make it more theme-aware by using the special features of sx, like sx={{ p: 2 }}

See https://mui.com/system/getting-started/the-sx-prop/

On the other side we should be careful when enforcing any color. I think we shouldn't do it at all because we want that this plugin works well with the default Backstage theme and other really-customized themes.

Comment on lines +102 to +103
style={{ padding: '0.5rem', borderRadius: '50%' }}
sx={{ '&:hover': { borderRadius: '50%' } }}

Choose a reason for hiding this comment

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

Do we need both?

Fyi, with sx you can also define a padding, and there are also theme-aware properties like p that uses the theme gaps:

Suggested change
style={{ padding: '0.5rem', borderRadius: '50%' }}
sx={{ '&:hover': { borderRadius: '50%' } }}
sx={{ p: 2, borderRadius: '50%', '&:hover': { borderRadius: '50%' } }}

The 2 means 2x gap-size here, not 2px.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @christoph-jerolimov , if only set the hover to have borderRadius, when you hover it the ripple effect will be a square first then become a circle.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also if I specify in sx, it will be overwritten by Mui global css styles. So I had to use style to keep some styles in higher priority.

@@ -66,6 +66,7 @@ function DownloadCSVLink() {
sx={{
color: theme => theme.palette.link,
textDecoration: 'underline',
marginTop: '1rem',

Choose a reason for hiding this comment

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

Suggested change
marginTop: '1rem',
mt: 2,

(I didn't checked if 2 x theme-gap-sizes matches what you tried here, but 2 is a common gap I guess.)

Comment on lines +51 to +52
style={{ padding: '0.5rem', color: 'inherit', borderRadius: '50%' }}
sx={{ '&:hover': { borderRadius: '50%' } }}

Choose a reason for hiding this comment

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

Suggested change
style={{ padding: '0.5rem', color: 'inherit', borderRadius: '50%' }}
sx={{ '&:hover': { borderRadius: '50%' } }}
sx={{ p: 1, color: 'inherit', borderRadius: '50%', '&:hover': { borderRadius: '50%' } }}

(I didn't checked it visually, but also here a theme-based-gap would be better than 0.5rem, so that the theme can configure the gaps.

Comment on lines +66 to +68
const dialogBackgroundColor = (theme: { palette: { mode: string } }) =>
theme.palette.mode === 'dark' ? '#1b1d21' : '#fff';

Choose a reason for hiding this comment

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

That's to specific. Is there no property that you can use from theme.palette.... ?

This might be an issue with our theme. We should not enforce (our) colors here.

style={{ marginTop: '24px' }}
sx={{
marginTop: '24px',
backgroundColor: `${dialogBackgroundColor} !important`,

Choose a reason for hiding this comment

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

Nope. I think its a theme issue on our side.

If you really* want pick up the background color of the DialogContent you can make it transparent. But I think it's to risky to have bad contrast between the text color and the background color.

@@ -66,7 +66,7 @@ export const RolesListToolbar = ({
sx={{
display: 'flex',
justifyContent: 'end',
marginBottom: '24px',
marginBottom: '24px !important',

Choose a reason for hiding this comment

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

Is this really needed? Can you try

Suggested change
marginBottom: '24px !important',
mb: 3,

However, it should be the same CSS specificity. Hmm. I must take a look into the browser dev tools myself.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This won't work as inline sx styles will be overridden by Mui global styles.

Signed-off-by: Yi Cai <[email protected]>
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.

2 participants