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

LF-3750 Add search to dashboard #2945

Merged
merged 12 commits into from
Nov 7, 2023
Merged

Conversation

kathyavini
Copy link
Collaborator

@kathyavini kathyavini commented Nov 3, 2023

Description

This PR creates the new <PureCollapsibleSearchbar /> component (Storybook) and adds it to the Finances dashboard.

Note:

  • The button background is correct in app but often -- not always! -- doesn't show up in Storybook (it looks like the <TextButton /> native transparent takes precedent). If you know why that is, could you let me know 🙏

Jira link: https://lite-farm.atlassian.net/browse/LF-3750

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • Passes test case
  • UI components visually reviewed on desktop view
  • UI components visually reviewed on mobile view
  • Other (please explain)

Checklist:

  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • The precommit and linting ran successfully
  • I have added or updated language tags for text that's part of the UI
  • I have added "MISSING" for all new language tags to languages I don't speak
  • I have added the GNU General Public License to all new files

@kathyavini kathyavini added the enhancement New feature or request label Nov 3, 2023
@kathyavini kathyavini self-assigned this Nov 3, 2023
@kathyavini kathyavini requested review from a team as code owners November 3, 2023 20:42
@kathyavini kathyavini requested review from antsgar and Duncan-Brain and removed request for a team November 3, 2023 20:42
}

.dateRangeSelector {
max-width: 360px;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is actually larger than what is shown in Figma, but I was worried about the text not fitting.

@SayakaOno SayakaOno requested review from SayakaOno and removed request for Duncan-Brain November 3, 2023 20:46
Copy link
Collaborator

@antsgar antsgar left a comment

Choose a reason for hiding this comment

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

Working great, it's beautiful! ❤️ I left a couple of small comments

<div className={styles.circleContainer}>
<div className={styles.circle} />
</div>
<SearchIcon className={styles.searchIcon} onClick={onSearchOpen} />
Copy link
Collaborator

Choose a reason for hiding this comment

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

Here the onClick should actually be on the button instead of the icon -- currently if you try to click on the little edges of the button right outside of the icon, even though it seems clickable it won't open the search.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

THANK YOU!!! This is why the onClick was mysteriously failing at times 😁

setModalStyle({
position: 'absolute',
top: `${rect.top}px`,
left: ref === searchRef.current ? undefined : `${rect.left}px`,
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 understand the bit where it checks if the ref is actually the searchRef and sets different values in that case, can you explain that case a bit more? 🙏

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If a containerRef isn't provided from the parent component, this sets the position of the modal searchbar directly on top of the search button -- so it grabs a vertical position, but does not grab a horizontal position or width (as the horizontal position and width of the button itself is irrelevant). Not supplying a left keeps the modal default of centering horizontally, and the searchbar width will always be 95vw.

I think overlaying the button is a pretty good default (so that a container ref doesn't always have to be created in the parent), but if it makes the code too unreadable, I can remove it. Alternatively... if you have a suggestion for writing the same in a more readable style, that would be great!

Copy link
Collaborator

Choose a reason for hiding this comment

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

That makes sense to me! I'd keep it and if possible just add a small comment indicating if a container ref isn't passed in the position will be calculated to overlay the button 🙂

antsgar
antsgar previously approved these changes Nov 6, 2023
Copy link
Collaborator

@SayakaOno SayakaOno left a comment

Choose a reason for hiding this comment

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

Looks great! I left one small comment!

@@ -78,4 +80,8 @@ const FinanceDateRangeSelector = () => {
);
};

FinanceDateRangeSelector.PropTypes = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

There is a warning about the "P" in "PropTypes" being capitalized!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thank you!

SayakaOno
SayakaOno previously approved these changes Nov 6, 2023
@antsgar antsgar merged commit a613d17 into integration Nov 7, 2023
2 checks passed
@antsgar antsgar deleted the LF-3750-add-search-to-dashboard branch November 7, 2023 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants