-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[Wave8] Search Input component #32439
[Wave8] Search Input component #32439
Conversation
@aimane-chnaif Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
@aimane-chnaif ready for review. This PR is an extracted Search Input from #32103 |
src/styles/styles.ts
Outdated
@@ -3017,6 +3017,25 @@ const styles = (theme: ThemeColors) => | |||
flex: 1, | |||
}, | |||
|
|||
searchContainer: { | |||
backgroundColor: theme.highlightBG, | |||
borderRadius: 999, |
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.
why not just be 20?
src/styles/styles.ts
Outdated
minHeight: 40, | ||
maxHeight: 40, |
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.
Why minHeight, maxHeight needed?
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.
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.
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.
Adding height
on parent Pressable
works nicely though. Going for it.
src/components/Search.tsx
Outdated
onPress={onPress} | ||
> | ||
{({hovered}) => ( | ||
<View style={[styles.flex1, styles.flexRow, styles.gap2, styles.ph6, styles.alignItemsCenter, styles.searchContainer, hovered && styles.searchContainerHovered, style]}> |
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.
seems like lots of style definition. can we define new style name in styles.ts?
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.
Moving everything to styles.searchContainer
. I thought reusing the existing styles is good though.
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.
Is this a good combo?
<View style={[styles.gap2, styles.ph6, styles.searchContainer, hovered && styles.searchContainerHovered, style]}>
searchContainer: {
flex: 1,
flexDirection: 'row',
alignItems: 'center',
backgroundColor: theme.highlightBG,
borderRadius: variables.componentBorderRadiusRounded,
},
Or everything moved to styles?
<View style={[styles.searchContainer, hovered && styles.searchContainerHovered, style]}>
searchContainer: {
flex: 1,
flexDirection: 'row',
alignItems: 'center',
gap: 8,
paddingHorizontal: 24,
backgroundColor: theme.highlightBG,
borderRadius: variables.componentBorderRadiusRounded,
},
src/components/Search.tsx
Outdated
onPress: (event?: GestureResponderEvent | KeyboardEvent) => void; | ||
|
||
// Text explaining what the user can search for | ||
prompt: string; |
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 prefer title to prompt
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.
placeholder ot title
|
||
return ( | ||
<Tooltip text={tooltip ?? translate('common.search')}> | ||
<PressableWithFeedback |
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.
no background color when press/long press on mobile. Is it expected?
ios.hover.mov
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.
Hey @aimane-chnaif . If you change the sidebar background color from sidebar: colors.productDark200,
to sidebar: colors.productDark100,
you will see the touchable feedback in action. It's visible on onPress
. There's no style change when onPress
becomes onLongPress
.
@dannymcclain @shawnborton LMK if this looks good.
Screen.Recording.2023-12-13.at.16.07.48.mov
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.
Ah yeah a couple of things here:
- At some point we need to change this entire sidebar to use the same color100 (appBG) color. Not sure when or where we plan to do that.
- The search input should technically be using color300 (same as rowHover) as the background color. I don't think we've decided anything for the search inputs :hover or :active but I suppose it could be color400 for hover and color500 for active/press?
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.
Same concern on light theme. There's no visual feedback on background color on press/long press. (not blocker)
light.mov
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.
Asked Maciej to address this in the follow up PRs
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.
Oh, the color of the search input from figma (#07271F) seems to be gone from the repo after recent changes in the theme. So I'll do 300/400/500 @shawnborton. Although our app now suggests something like that:
componentBG: colors.productDark100,
hoverComponentBG: colors.productDark200,
activeComponentBG: colors.productDark400,
But I know it can change as currently we have the wrong background color in the sidebar, while ideal-nav will have bg200 if I remember correctly
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.
While on the buttons currently we have:
buttonDefaultBG: colors.productDark400,
buttonHoveredBG: colors.productDark500,
buttonPressedBG: colors.productDark600,
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.
300/400/500:
Screen.Recording.2023-12-15.at.17.20.54.mov
Screen.Recording.2023-12-15.at.17.24.20.mov
src/components/Search.tsx
Outdated
onPress: (event?: GestureResponderEvent | KeyboardEvent) => void; | ||
|
||
// Text explaining what the user can search for | ||
prompt: string; |
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.
placeholder ot title
@aimane-chnaif ready for re-review |
@aimane-chnaif Could you please rereview this PR? Thanks! |
reviewing |
Code looks good. |
src/components/Search.tsx
Outdated
<Tooltip text={tooltip ?? translate('common.search')}> | ||
<PressableWithFeedback | ||
accessibilityLabel={tooltip ?? translate('common.search')} | ||
role={CONST.ACCESSIBILITY_ROLE.BUTTON} |
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.
role={CONST.ACCESSIBILITY_ROLE.BUTTON} | |
role={CONST.ROLE.BUTTON} |
Reviewer Checklist
Screenshots/VideosAndroid: Nativeandroid.movAndroid: mWeb Chromemchrome.moviOS: Nativeios.moviOS: mWeb Safarimsafari.movMacOS: Chrome / Safariweb.movMacOS: Desktopdesktop.mov |
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.
This is not used anywhere yet so I think we can go ahead and merge, all yours @hayata-suenaga
|
||
return ( | ||
<Tooltip text={tooltip ?? translate('common.search')}> | ||
<PressableWithFeedback |
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.
Asked Maciej to address this in the follow up PRs
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.
LGTM!
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/hayata-suenaga in version: 1.4.14-0 🚀
|
🚀 Deployed to staging by https://github.com/hayata-suenaga in version: 1.4.14-0 🚀
|
🚀 Deployed to production by https://github.com/jasperhuangg in version: 1.4.14-6 🚀
|
Details
This PR creates a new
<Search />
component and it's storybook. It's not used in the cody. To render it, use:Change the bg color of the sidebar for proper testing:
becomes
Storybook:
Fixed Issues
$ #31766
PROPOSAL:
Tests
Offline tests
Tests
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.No screenshots - usage only in Storybook.