Skip to content

Commit

Permalink
fix: Empty space before SelectFiltered placeholder (#171)
Browse files Browse the repository at this point in the history
  • Loading branch information
gabriellsh authored Mar 20, 2020
1 parent 0801f28 commit 26ab2b5
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions packages/fuselage/src/components/Select/Select.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export const Select = ({
}) => {
const [internalValue, setInternalValue] = useState(value);


const currentValue = value !== undefined ? value : internalValue;
const option = options.find((option) => getValue(option) === currentValue);
const index = options.indexOf(option);
Expand Down Expand Up @@ -68,7 +67,7 @@ export const Select = ({

const valueLabel = getLabel(option);

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

0 comments on commit 26ab2b5

Please sign in to comment.