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

feat(schema-hints): Add search functionality to drawer #87201

Merged
merged 7 commits into from
Mar 18, 2025

Conversation

nikkikapadia
Copy link
Member

I've added a simple search function on the drawer which allows users to search for tags. The search input is invisible until clicked on and the logic resembles the breadcrumbs search logic found here. Here's what it looks like:

Screen.Recording.2025-03-17.at.2.19.09.PM.mov

Closes #87029

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Mar 17, 2025
@nikkikapadia nikkikapadia marked this pull request as ready for review March 17, 2025 19:47
@nikkikapadia nikkikapadia requested a review from a team as a code owner March 17, 2025 19:47
// Find the last item that fits within the container
let lastVisibleIndex =
items.findIndex(item => {
const itemRect = item.getBoundingClientRect();
return itemRect.right > containerRect.right - (seeFullListTagRect?.width ?? 0);
return itemRect.right > measureDivRect.right - (seeFullListTagRect?.width ?? 0);
Copy link
Member Author

Choose a reason for hiding this comment

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

for some reason i wasn't seeing the see full list option with the new nav expanded so this fixes that

Copy link
Member

@shruthilayaj shruthilayaj left a comment

Choose a reason for hiding this comment

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

a couple small comments, but otherwise looks good

return sortedHints;
}

const searchFor = JSON.stringify(searchQuery)
Copy link
Member

Choose a reason for hiding this comment

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

why do we need to do this JSON.stringify here? search input should return the right thing, no?

Copy link
Member Author

Choose a reason for hiding this comment

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

ah yes good point. I was trying to ensure that both the options and the search were formatted the same but to your point this is probably not necessary. I'll make that change

Comment on lines 100 to 104
css={css`
@media (max-width: ${theme.breakpoints.medium}) {
max-width: 175px;
}
`}
Copy link
Member

Choose a reason for hiding this comment

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

Do we still need this now that the drawer width is fixed? Also, can this just be a styled component?

Copy link
Member Author

Choose a reason for hiding this comment

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

we still need this because the drawer width technically isn't "fixed" it changes with the screen size to be proportional, but yes I'll put this into a styled component instead.

Comment on lines 121 to 131
const hintFieldDefinition = getFieldDefinition(
hint.key,
'span',
hint.kind
);
const hintType =
hintFieldDefinition?.valueType === FieldValueType.BOOLEAN
? t('boolean')
: hint.kind === FieldKind.MEASUREMENT
? t('number')
: t('string');
Copy link
Member

Choose a reason for hiding this comment

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

nit: I wonder if we could memoize field definitions and hint types when we build the initial list so we don't have to recompute it on every filter change

@nikkikapadia nikkikapadia merged commit d3371a2 into master Mar 18, 2025
41 checks passed
@nikkikapadia nikkikapadia deleted the nikki/feat/schema-hints-search branch March 18, 2025 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Frontend Automatically applied to PRs that change frontend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Search functionality for schema hints slideout
2 participants