Skip to content

Commit 26ab2b5

Browse files
authored
fix: Empty space before SelectFiltered placeholder (#171)
1 parent 0801f28 commit 26ab2b5

File tree

1 file changed

+2
-3
lines changed
  • packages/fuselage/src/components/Select

1 file changed

+2
-3
lines changed

packages/fuselage/src/components/Select/Select.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ export const Select = ({
2828
}) => {
2929
const [internalValue, setInternalValue] = useState(value);
3030

31-
3231
const currentValue = value !== undefined ? value : internalValue;
3332
const option = options.find((option) => getValue(option) === currentValue);
3433
const index = options.indexOf(option);
@@ -68,7 +67,7 @@ export const Select = ({
6867

6968
const valueLabel = getLabel(option);
7069

71-
const visibleText = (filter === undefined || visible === AnimatedVisibility.HIDDEN) && (valueLabel || placeholder);
70+
const visibleText = (filter === undefined || visible === AnimatedVisibility.HIDDEN) && (valueLabel || (placeholder || typeof placeholder === 'string'));
7271
return (
7372
<Container disabled={disabled} ref={containerRef} onClick={() => ref.current.focus() & show()} className={
7473
[
@@ -82,7 +81,7 @@ export const Select = ({
8281
<Flex.Container>
8382
<Margins inline='neg-x4'>
8483
<Wrapper mod-hidden={!!visibleText}>
85-
{ (typeof placeholder === 'string' || !!valueLabel) && <Flex.Item grow={1}>
84+
{ visibleText && <Flex.Item grow={1}>
8685
<Margins inline='x4'>
8786
<Box is='span' textStyle='p2' textColor={ valueLabel ? 'default' : 'hint' }>{visibleText}</Box>
8887
</Margins>

0 commit comments

Comments
 (0)