-
Notifications
You must be signed in to change notification settings - Fork 84
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 4083 add search to animal list #3152
Conversation
@Duncan-Brain no I think the idea of moving it was nixed altogether, since it was about maintaining the same structure as transactions (and keeping the container/component distinction) which were both deemed arbitrary. If we aren't worried about either of those two points there is no need to move where the data gets manipulated (there will some more passing of callbacks maybe but it's doable). |
So did you and Loïc decide not to implement the modal effect when clicking into the searchbar on mobile? That's what all that resize observer code and I actually don't mind not having the effect (and wouldn't mind removing it for transactions, as we should be consistent and the need for resize observer is kind of annoying -- you can see how all that logic bulked up that component file), but if you aren't going for the modal effect then is no need to use Personally I vote for removing the modal effect in both places -- I mean after discussing with Loïc of course!! -- but I'm curious what the team thinks. |
@kathyavini Good question, I think I missed that screen haha. I agree I don't need it personally but I will make it the same for now! |
@Duncan-Brain I dunno; it's kind of a mess as written, isn't it? It's my component so I take responsibility 😅 I'm thinking of trying to re-write it so the modal functionality and the collapsing functionality reside in separate components; I assumed when I made it that this was going to be a new pattern for all searches so I made those two things too dependent on each other. Edit: Or maybe that's not possible because the modal IS the collapsed state's searchbar 😭 Messy. Probably a fresh component for modal functionality would be easier. |
Took @kathyavini advice and just copied and cut the non desired pieces for refactoring another day! |
packages/webapp/src/components/PopupFilter/PureCollapsibleSearch/styles.module.scss
Outdated
Show resolved
Hide resolved
packages/webapp/src/components/PopupFilter/PureSearchWithBackdrop/index.jsx
Outdated
Show resolved
Hide resolved
packages/webapp/src/components/PopupFilter/PureSearchWithBackdrop/styles.module.scss
Outdated
Show resolved
Hide resolved
packages/webapp/src/components/PopupFilter/PureSearchWithBackdrop/index.jsx
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
packages/webapp/src/components/PopupFilter/PureCollapsibleSearch/index.jsx
Outdated
Show resolved
Hide resolved
@kathyavini Yeah thanks I def missed that weird behaviour. It's because of the Table I didn't update that to the mobile behaviour in line with the designs -- fixed now. I will remove the collapse and update stories but then rename it from Collapsible to Collapsing so as not to be misleading. But it raised some interesting issues there that I will ignore for now haha, but collapsible icon does not seem to be responsive to the menu, and layout should probably overflow right creating a scrollbar instead of forcing the flex state of the menu. |
packages/webapp/src/stories/PureSearchBarWithBackdrop/PureSearchBarWithBackdrop.stories.jsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's working well!
I'm wondering:
- whether we should use the
isDesktop
prop rather than breakpoints in scss? - switching with or without the table header at 1200px seems a bit wide to me. (but I understand < 1200px is considered as tablet size) Can we find the requirement in Figma? (this is a general question...)
value, | ||
isSearchActive, | ||
onChange, | ||
placeholderText, | ||
className, | ||
containerRef, | ||
isDesktop, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't use the breakpoint?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was a media query -- no we should not use media query I don't think.
-
mixin.scss
has breakpoints that are OK since we can change the whole app at the same time. If this is the preferred choice I can change 🤷 . -
isDesktop is nice in my personal opinion because:
- we copied MUI breakpoints to make the
mixin.scss
so now we have 2 copies of source of truth - Using good CSS class naming like BEM I think javascript files can be slightly more readable versus hidden in CSS (I thought this was blocker so I rushed naming but fixed to BEM)
- sometimes we want to use isDesktop for in page content or design decisions too so I enjoy letting MUI control our design system as a whole (since they are the experts)
- we copied MUI breakpoints to make the
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really like having the breakpoints being controlled by JS/TS and no longer the mixins... those multiple methods and sources of truth (when finances was created we weren't yet unified around the MUI breakpoints) made it really hard to reason about e.g. the CollapsibleSearch.
But GOSH I hate those BEM underscores... do we have to?? 🤣
Edit: and more in the spirit of logic and not just knee-jerk underscore dislike, I don't think we want to adopt a new CSS naming convention like this without discussion + deciding if it's something we'll use moving forward; a mix of naming conventions is pretty confusing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol no not necessary -- but its a good architecture vs "willy nilly" haha
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I was in favour of using CSS. I don't think we have discussed which strategy to stick with? I added to the tech daily agenda!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SayakaOno sounds awesome! I don't have a strong opinion between mixins and inline breakpoints just no more media queries haha
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we made a decision today. @SayakaOno can I make a tech debt ticket to choose ? That way search bar can go through.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought we wouldn't need any further discussion 😅 It's up to you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be nice to choose a direction haha: https://lite-farm.atlassian.net/browse/LF-4143
packages/webapp/src/stories/PureSearchBarWithBackdrop/PureSearchBarWithBackdrop.stories.jsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a couple of comments re the CSS naming conventions! Other than that it works great, excellent work 🙌
/> | ||
<div | ||
className={clsx( | ||
isDesktop ? styles.SearchAndFilter_container___desktop : styles.SearchAndFilter_container, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like BEM overall, but since we haven't made a decision to go for that throughout the app, I'd advocate for consistency here and naming the styles more similarly to how classes are currently named in other files. In general I'm all for BEM but I think these will be out of place unless there's overall consensus to go with BEM from now on. If we do make a decision to go with BEM from now on, I think the convention would actually be something like search-and-filter__container--desktop
. Unless this is a different one and not BEM?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there are some react problems with the - or something. I linked the article I used to try to apply it but it may be out of date.
I just added it to discuss the isDesktop inline breakpoints readability.
/> | ||
<div | ||
className={clsx( | ||
isDesktop ? styles.SearchResults___marginLeft8 : styles.SearchResults___textAlignCenter, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd try to give these classes more generic names rather than names that specifically point out the styling applied. The reason for that is, it leaves little flexibility to update the styling and reuse that selector without having to change the name of the class. Even if we went for BEM, the "modifiers" used are usually things like "compact", "disabled", "active", "big" rather than calling out specific styles
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. I would only call out specific styles if it is the only style on the property. I don't see value in making the modifier less readable (in JS) when there is just one style.
But yeah anyone wanting to add another style would probably rename it to be more generic. Most just showcasing the inline breakpoints readability -- I haven't mastered BEM by any means ahha so what your seeing is my interpretation .. but BEM is nice overall
@antsgar BEM is gone! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙌
{hasSearchResults ? ( | ||
<Table | ||
kind={TableKind.V2} | ||
alternatingRowColor={true} | ||
columns={animalsColumns} | ||
data={filteredInventory} | ||
shouldFixTableLayout={isDesktop} | ||
minRows={filteredInventory.length} | ||
dense={false} | ||
showHeader={isDesktop} | ||
/> | ||
) : ( | ||
<NoSearchResults | ||
className={clsx(isDesktop ? styles.noSearchResultsDesktop : styles.noSearchResults)} | ||
searchTerm={searchString} | ||
includeFiltersInClearSuggestion | ||
/> | ||
)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I looked into "+ Load more" button being shown sometimes.
In Table
, minRows
is the initial value of data.length
and won't change.
In Inventory
component, if you have 10 animals and filter out 6 animals and refresh the page, minRows
is 4
and when you clear filters, "Load more" button shows up.
The same thing happens after hasSearchResults
is changed to false
to true
here since Table
is re-rendered.
(I hope it makes sense)
I will make a change to pass inventory.length
as minRows
from the container in my PR later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Right that makes sense I think it doesn't need to be dynamic unless data is refetched.
Description
Adds search bar to Inventory page.
Does not:
Jira link: LF-4083
Type of change
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Checklist: