Skip to content

FloatingActionButton: added the component to be used in smaller views #2347

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

Merged
merged 8 commits into from
Sep 3, 2023

Conversation

dewanshDT
Copy link
Collaborator

@dewanshDT dewanshDT commented Aug 4, 2023

This is the part of the mobile responsive project

Changes:
Floating action button component is added, to be used in the mobile views

I have verified that this pull request:

  • has no linting errors (npm run lint)
  • has no test errors (npm run test)
  • is from a uniquely-named feature branch and is up to date with the develop branch.

@dewanshDT dewanshDT requested review from lindapaiste and raclim August 4, 2023 06:17
@dewanshDT dewanshDT changed the title Dewanshmobile/fab FloatingActionButton: added the component to be used in smaller views Aug 4, 2023
return (
<Button
data-behaviour={isPlaying ? 'stop' : 'run'}
style={{ paddingLeft: isPlaying ? 0 : remSize(5) }}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't love this but I know it's here to fix a genuine problem so it's best to keep it for now so as not to fall deep into an SVG rabbit hole. We need this because the PlayIcon does not appear visually centered within its viewbox. IMO that's a problem with the icon and we may want to modify the icon to have whitespace on the side so that it looks centered.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah exactly that's what I thought, but let's keep it for now we'll remove it when we decide to replace the Icon with a better one.

z-index: 3;
cursor: pointer;
${prop('Button.secondary.default')};
aspect-ratio: 1/1;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This property has way more support than I thought! It's not really necessary since you've defined both a width and a height but it's not hurting anything so 🤷 .

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah 😂😂

Copy link
Collaborator

Choose a reason for hiding this comment

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

Just want to note some of the ideas that we've tossed around regarding this element, potentially for future refactorings but not for right now:

  • We could export the styled part as a reusable FloatingActionButton UI component, and make this specific StartStopButton be an instance of that common FloatingActionButton. (This fits with best practices, but is kind of silly since there are no other floating action buttons anywhere else in the app.)
  • We could extract the existing StartStopButton from the desktop toolbar into its own component (see Break up Toolbar elements #2239). That component would need to take a className prop in order to be stylable with styled-components. This floating version for mobile could be a styled(StartStopButton), where we only need to specify the styles to override like the position and size. The positioning could also potentially be handled by a separate div which has the button as a child.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, the StartStopButton is a great idea and since we do not have any more floating action buttons anywhere else in the app but when I made it I thought it would be reusable and we should definitely export the styled part as a floating action button and the start-stop button should be passed in as a child element. let me know when we want to do it

@raclim raclim added the Area: Mobile For issues affecting mobile or responsive behavior label Aug 4, 2023
@dewanshDT
Copy link
Collaborator Author

hey @lindapaiste, made the suggested changes, check it out!

@dewanshDT dewanshDT requested a review from lindapaiste August 7, 2023 04:20
align-items: center;
box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;
&.stop {
${prop('Button.primary.default')}
Copy link
Collaborator

Choose a reason for hiding this comment

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

we've got a color here with no property!

width: ${remSize(60)};
z-index: 3;
padding: 0;
${prop('Button.secondary.default')};
Copy link
Collaborator

Choose a reason for hiding this comment

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

Another variable that's not assigned to any property.

Copy link
Collaborator

@lindapaiste lindapaiste left a comment

Choose a reason for hiding this comment

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

Looking good!

Two small changes and then let's merge this:

  1. Delete the two lines I noted which have a ${prop( that isn't assigned to any property.
  2. I know that hover isn't that important on small-screen but let's put a more obvious hover effect on the "stop" button for when it's on a small laptop or whatever. I'm thinking we change the background to pink. Might be as simple as changing &.stop to &.stop:not(:hover).

@dewanshDT dewanshDT mentioned this pull request Aug 17, 2023
3 tasks
@lindapaiste lindapaiste merged commit f7ace88 into processing:develop Sep 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Mobile For issues affecting mobile or responsive behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants