Skip to content

Commit

Permalink
Merge pull request #2782 from SUI-Components/feat/fx-select-with-sear…
Browse files Browse the repository at this point in the history
…ch-position

feat(components/molecule/select): fx position of select with search
  • Loading branch information
carolinamallo authored Nov 22, 2024
2 parents 9a3ad7f + f60d3eb commit df68bfa
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
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: $z-navigation;
}
&-search {
border-radius: $bdrs-molecule-select-search;
border: $bd-molecule-select-search;
Expand Down

0 comments on commit df68bfa

Please sign in to comment.