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: added doc for search-box #1248

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

feat: added doc for search-box #1248

wants to merge 2 commits into from

Conversation

harish-viswa
Copy link
Contributor

closes #1247

Copy link

netlify bot commented Mar 13, 2025

Deploy Preview for harness-design ready!

Name Link
🔨 Latest commit cb2ae7d
🔍 Latest deploy log https://app.netlify.com/sites/harness-design/deploys/67e54744379ea10008c38312
😎 Deploy Preview https://deploy-preview-1248--harness-design.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Mar 13, 2025

Deploy Preview for harness-xd-review ready!

Name Link
🔨 Latest commit cb2ae7d
🔍 Latest deploy log https://app.netlify.com/sites/harness-xd-review/deploys/67e54744dfb4740008b5fea3
😎 Deploy Preview https://deploy-preview-1248--harness-xd-review.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Collaborator

@knagurski knagurski left a 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'

Copy link
Collaborator

Choose a reason for hiding this comment

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

Remember the ellipsis

Suggested change
// ...

className="custom-class"
/>
)

Copy link
Collaborator

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

Comment on lines +18 to +20
width="fixed"
textSize="text-sm"
showOnFocus={false}
Copy link
Collaborator

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

Suggested change
width="fixed"
textSize="text-sm"
showOnFocus={false}

Comment on lines +12 to +22
code={`<SearchBox.Root
placeholder="Search..."
hasSearchIcon={true}
hasShortcut={true}
shortcutLetter="K"
shortcutModifier="alt"
width="fixed"
textSize="text-sm"
showOnFocus={false}
/>
`}
Copy link
Collaborator

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

Suggested change
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}
/>`}

Comment on lines +51 to +65
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
Copy link
Collaborator

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]

Suggested change
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

Comment on lines +57 to +59
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
Copy link
Collaborator

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?

Suggested change
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Document Search-box component
2 participants