fix(ui): make SearchAutocomplete background-aware
Signed-off-by: Johan Persson <johanopersson@gmail.com>
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
---
|
||||
'@backstage/ui': patch
|
||||
---
|
||||
|
||||
Made `SearchAutocomplete` background-aware. The input now adapts its background color based on its parent container's background level.
|
||||
|
||||
**Affected components:** SearchAutocomplete
|
||||
@@ -2159,6 +2159,7 @@ export const SearchAutocompleteDefinition: {
|
||||
readonly styles: {
|
||||
readonly [key: string]: string;
|
||||
};
|
||||
readonly bg: 'consumer';
|
||||
readonly classNames: {
|
||||
readonly root: 'bui-SearchAutocomplete';
|
||||
readonly searchField: 'bui-SearchAutocompleteSearchField';
|
||||
|
||||
@@ -38,6 +38,18 @@
|
||||
--search-autocomplete-item-height: 2.5rem;
|
||||
height: 2.5rem;
|
||||
}
|
||||
|
||||
&[data-on-bg='neutral-1'] {
|
||||
background-color: var(--bui-bg-neutral-2);
|
||||
}
|
||||
|
||||
&[data-on-bg='neutral-2'] {
|
||||
background-color: var(--bui-bg-neutral-3);
|
||||
}
|
||||
|
||||
&[data-on-bg='neutral-3'] {
|
||||
background-color: var(--bui-bg-neutral-4);
|
||||
}
|
||||
}
|
||||
|
||||
.bui-SearchAutocompleteSearchField {
|
||||
|
||||
@@ -124,7 +124,7 @@ export function SearchAutocomplete(props: SearchAutocompleteProps) {
|
||||
<div
|
||||
ref={triggerRef}
|
||||
className={classes.root}
|
||||
data-size={dataAttributes['data-size']}
|
||||
{...dataAttributes}
|
||||
style={style}
|
||||
>
|
||||
<div aria-hidden="true">
|
||||
|
||||
@@ -28,6 +28,7 @@ import styles from './SearchAutocomplete.module.css';
|
||||
export const SearchAutocompleteDefinition =
|
||||
defineComponent<SearchAutocompleteOwnProps>()({
|
||||
styles,
|
||||
bg: 'consumer',
|
||||
classNames: {
|
||||
root: 'bui-SearchAutocomplete',
|
||||
searchField: 'bui-SearchAutocompleteSearchField',
|
||||
|
||||
Reference in New Issue
Block a user