-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
[search ui] Display asset search on asset landing page #20373
[search ui] Display asset search on asset landing page #20373
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. Join @clairelin135 and the rest of your teammates on Graphite |
Deploy preview for dagit-core-storybook ready! ✅ Preview Built with commit 457bb25. |
c5d9429
to
9ce9f77
Compare
efb1513
to
8755137
Compare
445969c
to
104a5dd
Compare
8755137
to
9de78a1
Compare
1bdc7f9
to
e477c43
Compare
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 the approach of reusing SearchDialog
with a separate render branch for each use case isn't quite right.
I think instead, SearchDialog
and this new UI should share common components.
isAssetSearch: boolean; | ||
displayAsOverlay?: boolean; |
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.
The addition of isAssetSearch
is an indication that this isn't really the right component for this UI to use. I see that that's from another branch, so I'll take a look at that one.
); | ||
|
||
if (displayAsOverlay) { |
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 reusing SearchDialog
with overriding props is quite the right approach. There are some similarities between global search and this UI, but I think the way to approach this is to have separate components that share common components and hooks.
That is, I would suggest that SearchDialog
be left effectively as-is, without additional props or rendering branches, and some of its pieces could be factored out to be used by both (existing) global search and a new asset search component.
104a5dd
to
2c06f1d
Compare
b6ce9a5
to
0fec26d
Compare
2c06f1d
to
1010eea
Compare
0fec26d
to
4c23fcf
Compare
searchAndHandleSecondary(queryString); | ||
}, DEBOUNCE_MSEC); | ||
return (queryString: string) => { | ||
if (!firstSearchTrace.current && isFirstSearch.current) { |
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.
not sure what this trace logic is, but it existed in the global search dialog so I added similar logic here?
@hellendag thanks for the feedback and the explanation here. I agree that it's cleaner to make asset search live in its own component. I added this refactor and I think this logic is looking better :) I wasn't entirely sure whether callbacks that mutate state should exist as shared functions or not, but aired on not sharing to make the state transitions per component clearer, though this does create some duplicate logic. The new changes include:
Let me know how this looks. |
1010eea
to
ecffd16
Compare
4c23fcf
to
5f2434c
Compare
ecffd16
to
ce41857
Compare
8ea6b1f
to
eeea70d
Compare
return (queryString: string) => { | ||
if (!firstSearchTrace.current && isFirstSearch.current) { | ||
isFirstSearch.current = false; | ||
const trace = createTrace('SearchDialog:FirstSearch'); |
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.
Can you rename this to AssetSearch:FirstSearch
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.
✅
font-weight: 500; | ||
`; | ||
|
||
const SearchResultBoldedLabel = styled.span` | ||
font-weight: 800; | ||
`; | ||
|
||
const SearchResultLabel = styled.span` | ||
font-weight: 300; | ||
`; |
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.
Generally you should not need to set font-weight
in CSS. All of the styles used in figma should be defined here
export const Subheading = styled(Text)` |
The figma should specify whether it's Body2, Subheading2, etc.
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.
makes sense, updated
c92d186
to
1cdabc9
Compare
eeea70d
to
e30c186
Compare
Deploy preview for dagit-storybook ready! ✅ Preview Built with commit 457bb25. |
export const CaptionBolded = styled(Text)` | ||
font-family: ${FontFamily.default}; | ||
font-size: 12px; | ||
font-weight: 900; |
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 assume this comes from figma?
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.
yes
<Label isHighlight={isHighlight}>{item.label}</Label> | ||
<Description isHighlight={isHighlight}>{item.description}</Description> | ||
</div> | ||
<Box flex={{direction: 'row', alignItems: 'center'}} style={{width: '100%'}}> |
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 you want grow: 1
instead of width: 100%
@@ -249,6 +249,7 @@ const fuseOptions = { | |||
keys: ['label', 'segments', 'tags', 'type'], | |||
threshold: 0.3, | |||
useExtendedSearch: true, | |||
includeMatches: true, |
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 find
1cdabc9
to
289c094
Compare
49feb08
to
3c7a44f
Compare
3c7a44f
to
457bb25
Compare
Walkthrough of the UI: https://www.loom.com/share/182595e3ba40415694343c6d786720d7?sid=ecb71bf9-0a87-44e4-bb78-4673d6d06495 Changes included: - Allows the `SearchDialog` to accept a prop indicating whether the search displays as an overlay, or on the page - Displays the fuzzy matches in the label in bold - Displays filter results, alongside the # of assets Next steps: - Handle typeaheads (i.e. `asset is:`/`sensor is:`/etc)
Walkthrough of the UI: https://www.loom.com/share/182595e3ba40415694343c6d786720d7?sid=ecb71bf9-0a87-44e4-bb78-4673d6d06495 Changes included: - Allows the `SearchDialog` to accept a prop indicating whether the search displays as an overlay, or on the page - Displays the fuzzy matches in the label in bold - Displays filter results, alongside the # of assets Next steps: - Handle typeaheads (i.e. `asset is:`/`sensor is:`/etc)
Walkthrough of the UI: https://www.loom.com/share/182595e3ba40415694343c6d786720d7?sid=ecb71bf9-0a87-44e4-bb78-4673d6d06495
Changes included:
SearchDialog
to accept a prop indicating whether the search displays as an overlay, or on the pageNext steps:
asset is:
/sensor is:
/etc)