Skip to content
This repository was archived by the owner on Mar 4, 2020. It is now read-only.

Commit 359fea1

Browse files
author
Silviu Avram
committed
removed no items text from component, added to examples
1 parent f4a146e commit 359fea1

8 files changed

+21
-15
lines changed

docs/src/examples/components/Dropdown/Types/DropdownExampleMultipleSearch.shorthand.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class DropdownExample extends React.Component {
2121
search
2222
getA11ySelectionMessage={getA11ySelectionMessage}
2323
getA11yStatusMessage={getA11yStatusMessage}
24+
noResultsMessage={`We couldn't find any matches.`}
2425
placeholder="Start typing a name"
2526
items={inputItems}
2627
/>

docs/src/examples/components/Dropdown/Variations/DropdownExampleMultipleSearchFluid.shorthand.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class DropdownExample extends React.Component {
2020
multiple
2121
getA11ySelectionMessage={getA11ySelectionMessage}
2222
getA11yStatusMessage={getA11yStatusMessage}
23+
noResultsMessage={`We couldn't find any matches.`}
2324
search
2425
fluid
2526
placeholder="Start typing a name"

docs/src/examples/components/Dropdown/Variations/DropdownExampleMultipleSearchImageAndContent.shorthand.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ class DropdownExample extends React.Component {
5757
getA11yStatusMessage={getA11yStatusMessage}
5858
search
5959
getA11ySelectionMessage={getA11ySelectionMessage}
60+
noResultsMessage={`We couldn't find any matches.`}
6061
placeholder="Start typing a name"
6162
items={inputItems}
6263
/>

docs/src/examples/components/Dropdown/Variations/DropdownExampleMultipleSearchToggleButton.shorthand.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class DropdownExample extends React.Component {
2020
multiple
2121
getA11yStatusMessage={getA11yStatusMessage}
2222
getA11ySelectionMessage={getA11ySelectionMessage}
23+
noResultsMessage={`We couldn't find any matches.`}
2324
search
2425
placeholder="Start typing a name"
2526
toggleButton

src/components/Dropdown/Dropdown.tsx

+9-10
Original file line numberDiff line numberDiff line change
@@ -312,13 +312,14 @@ export default class Dropdown extends AutoControlledComponent<
312312
{...accessibilityMenuPropsRest}
313313
styles={styles.list}
314314
aria-hidden={!isOpen}
315-
items={isOpen ? this.renderItems(variables, getItemProps, highlightedIndex) : []}
315+
items={isOpen ? this.renderItems(styles, variables, getItemProps, highlightedIndex) : []}
316316
/>
317317
</Ref>
318318
)
319319
}
320320

321321
private renderItems(
322+
styles: ComponentSlotStylesInput,
322323
variables: ComponentVariablesInput,
323324
getItemProps: (options: GetItemPropsOptions<ShorthandValue>) => any,
324325
highlightedIndex: number,
@@ -349,15 +350,13 @@ export default class Dropdown extends AutoControlledComponent<
349350
}
350351
// render no match message.
351352
return [
352-
{
353-
key: 'people-picker-no-results-item',
354-
content: (
355-
<Text weight="bold" content={noResultsMessage || `We couldn't find any matches.`} />
356-
),
357-
variables: {
358-
backgroundColor: variables.listItemBackgroundColor,
359-
},
360-
},
353+
noResultsMessage
354+
? {
355+
key: 'dropdown-no-results',
356+
content: <Text weight="bold" content={noResultsMessage} />,
357+
styles: styles.emptyListItem,
358+
}
359+
: null,
361360
]
362361
}
363362

src/themes/teams/components/Dropdown/dropdownItemStyles.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const dropdownItemStyles: ComponentSlotStylesInput<DropdownItemProps, DropdownVa
1010
...(active && {
1111
[`&.${ListItem.className}`]: {
1212
backgroundColor: v.listItemHighlightedBackgroundColor,
13-
color: v.listItemTextColor,
13+
color: v.listItemHighlightedTextColor,
1414
},
1515
}),
1616
}),

src/themes/teams/components/Dropdown/dropdownStyles.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const dropdownStyles: ComponentSlotStylesInput<DropdownProps, DropdownVariables>
3737
}),
3838
}),
3939

40-
activeListLabel: (): ICSSInJSStyle => ({
40+
label: (): ICSSInJSStyle => ({
4141
margin: '.4rem 0 0 .4rem',
4242
}),
4343

@@ -50,6 +50,10 @@ const dropdownStyles: ComponentSlotStylesInput<DropdownProps, DropdownVariables>
5050
top: 'calc(100% + 2px)', // leave room for container + its border
5151
}),
5252

53+
emptyListItem: ({ variables: { listItemBackgroundColor } }) => ({
54+
backgroundColor: listItemBackgroundColor,
55+
}),
56+
5357
toggleButton: ({ variables: { toggleButtonSize, width }, props: { fluid } }): ICSSInJSStyle => ({
5458
position: 'absolute',
5559
height: toggleButtonSize,

src/themes/teams/components/Dropdown/dropdownVariables.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export interface DropdownVariables {
1010
editTextFlexBasis: string
1111
listItemBackgroundColor: string
1212
listItemHighlightedBackgroundColor: string
13-
listItemTextColor: string
13+
listItemHighlightedTextColor: string
1414
listMaxHeight: string
1515
toggleButtonSize: string
1616
width: string
@@ -27,12 +27,11 @@ export default (siteVars): DropdownVariables => ({
2727
containerDivColor: siteVars.bodyColor,
2828
containerDivFocusBorderColor: siteVars.brand,
2929
containerDivFocusBorderRadius: `${_3px_asRem} ${_3px_asRem} ${_2px_asRem} ${_2px_asRem}`,
30-
3130
editTextFlexBasis: '100px',
3231

33-
listItemTextColor: siteVars.white,
3432
listItemBackgroundColor: siteVars.white,
3533
listItemHighlightedBackgroundColor: siteVars.brand,
34+
listItemHighlightedTextColor: siteVars.white,
3635
listMaxHeight: '20rem',
3736

3837
toggleButtonSize: pxToRem(30),

0 commit comments

Comments
 (0)