-
Notifications
You must be signed in to change notification settings - Fork 7
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: added doc for search-box #1248
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for harness-design ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for harness-xd-review ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
88b1e36
to
a3f016b
Compare
49e119d
to
cb2ae7d
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.
Some things to look at
|
||
````typescript jsx | ||
import { SearchBox } from '@harnessio/ui/components' | ||
|
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.
Remember the ellipsis
// ... | |
className="custom-class" | ||
/> | ||
) | ||
|
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.
Missing closing backticks for code block
width="fixed" | ||
textSize="text-sm" | ||
showOnFocus={false} |
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 can omit things that are defaults
width="fixed" | |
textSize="text-sm" | |
showOnFocus={false} |
code={`<SearchBox.Root | ||
placeholder="Search..." | ||
hasSearchIcon={true} | ||
hasShortcut={true} | ||
shortcutLetter="K" | ||
shortcutModifier="alt" | ||
width="fixed" | ||
textSize="text-sm" | ||
showOnFocus={false} | ||
/> | ||
`} |
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.
Looks like there's a lot of trailing white space
code={`<SearchBox.Root | |
placeholder="Search..." | |
hasSearchIcon={true} | |
hasShortcut={true} | |
shortcutLetter="K" | |
shortcutModifier="alt" | |
width="fixed" | |
textSize="text-sm" | |
showOnFocus={false} | |
/> | |
`} | |
code={`<SearchBox.Root | |
placeholder="Search..." | |
hasSearchIcon={true} | |
hasShortcut={true} | |
shortcutLetter="K" | |
shortcutModifier="alt" | |
width="fixed" | |
textSize="text-sm" | |
showOnFocus={false} | |
/>`} |
width="fixed" // [Optional] Width of the search box ('full' | 'fixed') | ||
hasShortcut={true} // [Optional] Show keyboard shortcut indicator | ||
hasSearchIcon={true} // [Optional] Show search icon | ||
shortcutLetter="k" // [Optional] Keyboard shortcut key | ||
shortcutModifier="cmd" // [Optional] Keyboard shortcut modifier ('cmd' | 'ctrl' | 'alt' | 'shift') | ||
textSize={TextSize['text-sm']} // [Optional] Text size of the input | ||
onSearch={() => searchHandler()} // [Optional] Callback when search is triggered | ||
onFocus={() => focusHandler()} // [Optional] Callback when input is focused | ||
handleChange={e => handleChange(e)} // [Optional] Callback when input value changes | ||
showOnFocus={false} // [Optional] Trigger search on focus | ||
inputClassName="h-8" // [Optional] Additional classes for the input | ||
placeholder="Search..." // [Optional] Placeholder text | ||
value="" // [Optional] Controlled input value | ||
defaultValue="" // [Optional] Default input value | ||
theme="default" // [Optional] Theme variant |
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 we set the optional stuff as [OPTIONAL]
instead of [Optional]
width="fixed" // [Optional] Width of the search box ('full' | 'fixed') | |
hasShortcut={true} // [Optional] Show keyboard shortcut indicator | |
hasSearchIcon={true} // [Optional] Show search icon | |
shortcutLetter="k" // [Optional] Keyboard shortcut key | |
shortcutModifier="cmd" // [Optional] Keyboard shortcut modifier ('cmd' | 'ctrl' | 'alt' | 'shift') | |
textSize={TextSize['text-sm']} // [Optional] Text size of the input | |
onSearch={() => searchHandler()} // [Optional] Callback when search is triggered | |
onFocus={() => focusHandler()} // [Optional] Callback when input is focused | |
handleChange={e => handleChange(e)} // [Optional] Callback when input value changes | |
showOnFocus={false} // [Optional] Trigger search on focus | |
inputClassName="h-8" // [Optional] Additional classes for the input | |
placeholder="Search..." // [Optional] Placeholder text | |
value="" // [Optional] Controlled input value | |
defaultValue="" // [Optional] Default input value | |
theme="default" // [Optional] Theme variant | |
width="fixed" // [OPTIONAL] Width of the search box ('full' | 'fixed') | |
hasShortcut={true} // [OPTIONAL] Show keyboard shortcut indicator | |
hasSearchIcon={true} // [OPTIONAL] Show search icon | |
shortcutLetter="k" // [OPTIONAL] Keyboard shortcut key | |
shortcutModifier="cmd" // [OPTIONAL] Keyboard shortcut modifier ('cmd' | 'ctrl' | 'alt' | 'shift') | |
textSize={TextSize['text-sm']} // [OPTIONAL] Text size of the input | |
onSearch={() => searchHandler()} // [OPTIONAL] Callback when search is triggered | |
onFocus={() => focusHandler()} // [OPTIONAL] Callback when input is focused | |
handleChange={e => handleChange(e)} // [OPTIONAL] Callback when input value changes | |
showOnFocus={false} // [OPTIONAL] Trigger search on focus | |
inputClassName="h-8" // [OPTIONAL] Additional classes for the input | |
placeholder="Search..." // [OPTIONAL] Placeholder text | |
value="" // [OPTIONAL] Controlled input value | |
defaultValue="" // [OPTIONAL] Default input value | |
theme="default" // [OPTIONAL] Theme variant |
onSearch={() => searchHandler()} // [Optional] Callback when search is triggered | ||
onFocus={() => focusHandler()} // [Optional] Callback when input is focused | ||
handleChange={e => handleChange(e)} // [Optional] Callback when input value changes |
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 we remove the inline anonymous functions?
onSearch={() => searchHandler()} // [Optional] Callback when search is triggered | |
onFocus={() => focusHandler()} // [Optional] Callback when input is focused | |
handleChange={e => handleChange(e)} // [Optional] Callback when input value changes | |
onSearch={searchHandler} // [Optional] Callback when search is triggered | |
onFocus={focusHandler} // [Optional] Callback when input is focused | |
handleChange={handleChange} // [Optional] Callback when input value changes |
closes #1247