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

refactor(send-form): remove custom dropdown type #4975

Merged
merged 3 commits into from
Feb 27, 2024

Conversation

kyranjamie
Copy link
Collaborator

@kyranjamie kyranjamie commented Feb 23, 2024

Try out this version of Leather — Extension build, Test report

Making a separate PR so changes are easier to review. Related to #4960.

This PR removes the custom dropdown we had implemented for the recipient type dropdown: address or bns name. This simplifies our code in removing a duplicate component, and using a legit dropdown component. @fbwoolf knows how thrilled I will be to remove it haha.

Unable to use custom trigger
Our Dropdown component assumes we'll always use the same trigger. In this instance we need a custom trigger. Temp solution here is to export an Unstyled trigger and use that instead. But curious to hear ideas how we might do better than this? Should we never assume the trigger styles and always pass it in?

From the looks of the designs, the normal trigger is just a button with an arrow in it. Should we could make a separate <DropdownButton /> component and pass that into <Dropdown.Trigger />? Leaving Trigger unstyled in the core dropdown? Pretty sure we'll need custom trigger dropdowns again in future.

2024-02-23-000105@2x

Added reverse prop to <Flag />
Per definition of Flag object, it can have a reverse prop, which I wanted to utilise for this bit of UI, so I just added it.

2024-02-23-000104@2x

@@ -1,7 +1,7 @@
import { fetchBtcNameOwner } from '@app/query/stacks/bns/bns.utils';

import { GenericRecipientField } from '../../../components/recipient-fields/generic-recipient-field';
import { RecipientField } from '../../../components/recipient-fields/recipient-field';
Copy link
Contributor

Choose a reason for hiding this comment

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

It'd be nice to refactor the path while we're here ../../../

Copy link
Contributor

@pete-watters pete-watters left a comment

Choose a reason for hiding this comment

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

This LGTM. It might be nice to wrap the Dropdown and then pass the trigger in a slot prop

@kyranjamie kyranjamie changed the base branch from fix/memo to dev February 23, 2024 14:28
@fbwoolf
Copy link
Contributor

fbwoolf commented Feb 23, 2024

@kyranjamie I think commits are included here that you didn't intend to be reviewed again? Will just review the dropdown changes here.

@kyranjamie
Copy link
Collaborator Author

Yep, fixing now

@@ -33,13 +34,23 @@ interface FlagProps extends FlexProps {
export function Flag({
spacing = 'space.03',
align = 'middle',
reverse = false,
Copy link
Contributor

Choose a reason for hiding this comment

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

This will be helpful, was thinking about this yesterday with the Callout.

Copy link
Contributor

@fbwoolf fbwoolf left a comment

Choose a reason for hiding this comment

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

It prob does make sense to make the trigger customizable. 👍

@kyranjamie kyranjamie force-pushed the refactor/recipient-address-type-dropdown branch from 361ff1d to d17861e Compare February 23, 2024 14:50
@kyranjamie
Copy link
Collaborator Author

kyranjamie commented Feb 23, 2024

It prob does make sense to make the trigger customizable. 👍

see 3b57aa2 and LMK what you think. Now thinking it should be a Button instead with some custom styles?

@kyranjamie kyranjamie force-pushed the refactor/recipient-address-type-dropdown branch from d17861e to 3b57aa2 Compare February 23, 2024 14:51
Copy link
Contributor

@alter-eggo alter-eggo left a comment

Choose a reason for hiding this comment

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

lgtm 👍
re: unstyled trigger, I'm ok with the current solution, just think we can put this trigger you created to a "DefaultDropdownTrigger" variable or smth like that. so we don't copy paste it in future?

also think it would be nice to add rotate animation there

@fbwoolf
Copy link
Contributor

fbwoolf commented Feb 23, 2024

see 3b57aa2 and LMK what you think. Now thinking it should be a Button instead with some custom styles?

If that ends up working better, def fine with it.

@kyranjamie kyranjamie force-pushed the refactor/recipient-address-type-dropdown branch from 9e0ed71 to e9f211e Compare February 23, 2024 16:27
@kyranjamie
Copy link
Collaborator Author

kyranjamie commented Feb 23, 2024

I've made some updates to the dropdown animations:

Before

2024-02-23-000109.mp4

After

2024-02-23-000111.mp4

Improvements

  • Fixed exit animation: Previously, the dropdown would only animate in, and on closing disappear instantly.
  • Added user-select: none: Prevents highlighting of text which often happens when clicking on button, seen in before video
  • Rotating chevron on open/close: Per @alter-eggo suggestion. It's an improvement, but not in love with it. @fabric-8 challenge you to come up with something fun ⚔️ Too much, killed
  • Removed custom bezier curve: @fbwoolf not sure where this came from but a simple fade in up/out down with ease-in-out works okay. Open to adding back other easing suggestions.
  • Remove min-width: Cc @mica000 to confirm. Previously we had min width 256px, but that is pretty big when used for the tiny dropdown.
  • Removed focus state: Bad for accessibility but was super ugly with default outline. Open to adding back something better.
Before After
2024-02-23-000108@2x 2024-02-23-000107@2x

@kyranjamie kyranjamie force-pushed the refactor/recipient-address-type-dropdown branch from e9f211e to 1c28777 Compare February 23, 2024 17:06
@fbwoolf
Copy link
Contributor

fbwoolf commented Feb 23, 2024

@kyranjamie your improvements lgtm, I think I just wasn't sure what we wanted or where it would be applied when implemented ...so, I believe I used the primitive example properties from Radix dropdown menu for the animations.

@fbwoolf
Copy link
Contributor

fbwoolf commented Feb 23, 2024

In regards to the focused state, we do seem to have a really bold focused state everywhere, I wonder if that should be less emphasized overall and NOT a bright blue? It was in the designs for the ItemInteractive too.

@fabric-8
Copy link
Contributor

Nice! I'd recommend to remove the open/close animation for the chevron here, it's too much. Fine to just leave it stay static, sometimes, less is more — How about adding a hover state using component-background-hover?

@mica000
Copy link

mica000 commented Feb 26, 2024

@kyranjamie awesome improvements!! love it!

Wondering if updating to this would make sense? If so, let me know as we need to review the design with the team.

https://www.figma.com/file/FlmF7ropcijOb7iVSDqNn0/%F0%9F%9F%A7-Web-App-Explorations-2024-H1?type=design&node-id=1214-134266&mode=design&t=vjpn8FdOAx69G198-4
image

image

@kyranjamie kyranjamie force-pushed the refactor/recipient-address-type-dropdown branch from 1c28777 to b35e5c0 Compare February 27, 2024 14:03
@kyranjamie
Copy link
Collaborator Author

I will make a new issue for this work @mica000 so we can merge this one as is

@kyranjamie kyranjamie force-pushed the refactor/recipient-address-type-dropdown branch from b35e5c0 to 604e0b4 Compare February 27, 2024 14:04
@kyranjamie kyranjamie enabled auto-merge February 27, 2024 14:05
@kyranjamie kyranjamie added this pull request to the merge queue Feb 27, 2024
Merged via the queue into dev with commit 6656e05 Feb 27, 2024
28 checks passed
@kyranjamie kyranjamie deleted the refactor/recipient-address-type-dropdown branch February 27, 2024 14:37
userSelect: 'none',
'[data-state=open] &': { bg: 'ink.component-background-pressed' },
});
function Button({ children, ...props }: HTMLStyledProps<'div'>) {
Copy link
Contributor

Choose a reason for hiding this comment

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

@kyranjamie rebased on these changes and slightly confused bc this doesn't appear to be used? You coming back to it?

Copy link
Contributor

Choose a reason for hiding this comment

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

Nvm, I see what is happening here, you used the 'unstyled' trigger in code and left this for use as the styled button. I am working on fixing the settings menu trigger button in Pete's work, so in this code a bit.

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.

6 participants