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(components/molecule/select): fx position of select with search #2782

Merged
merged 2 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions components/molecule/select/src/components/SingleSelection.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import PropTypes from 'prop-types'

import AtomInput, {inputTypes} from '@s-ui/react-atom-input'
import MoleculeDropdownList from '@s-ui/react-molecule-dropdown-list'
import {CLASS_SEARCH_CONTAINER} from './config.js'

import {
useDropdown,
Expand Down Expand Up @@ -73,16 +74,18 @@ const MoleculeSelectSingleSelection = ({
>
<AtomInput inputMode={inputTypes.NONE} />
</MoleculeInputSelect>
{hasSearch && <Search />}
<MoleculeDropdownList
size={size}
visible={isOpen}
onSelect={handleSelection}
value={value}
onKeyDown={handleKeyDown}
>
{children}
</MoleculeDropdownList>
<div className={CLASS_SEARCH_CONTAINER}>
{hasSearch && <Search />}
<MoleculeDropdownList
size={size}
visible={isOpen}
onSelect={handleSelection}
value={value}
onKeyDown={handleKeyDown}
>
{children}
</MoleculeDropdownList>
</div>
</>
)
}
Expand Down
1 change: 1 addition & 0 deletions components/molecule/select/src/components/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {BASE_CLASS as ROOT_BASE_CLASS} from '../config.js'

export const BASE_CLASS = `${ROOT_BASE_CLASS}-inputSelect`
const CLASS_SEARCH = `${BASE_CLASS}-search`
export const CLASS_SEARCH_CONTAINER = `${BASE_CLASS}-search-container`
export const getClassSearch = isOpen =>
cx(CLASS_SEARCH, {
[`${CLASS_SEARCH}--hidden`]: !isOpen
Expand Down
5 changes: 5 additions & 0 deletions components/molecule/select/src/styles/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ $class-select-atom-input-tags: '#{$class-select-atom-input}--withTags';
}

&-inputSelect {
&-search-container {
position: absolute;
width: 100%;
z-index: 800;
carolinamallo marked this conversation as resolved.
Show resolved Hide resolved
}
&-search {
border-radius: $bdrs-molecule-select-search;
border: $bd-molecule-select-search;
Expand Down
Loading