Skip to content

Commit

Permalink
fix: only check hidden if reveal is true, to correctly handle `re…
Browse files Browse the repository at this point in the history
…veal` changes

# Conflicts:
#	src/components/Input/Input.tsx
  • Loading branch information
thebengeu committed Mar 2, 2022
1 parent 9394b15 commit e62d7e9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/components/Input/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function Input({
...props
}: Props) {
const [copyLabel, setCopyLabel] = useState('Copy')
const [hidden, setHidden] = useState(reveal)
const [hidden, setHidden] = useState(true)

const __styles = styleHandler('input')

Expand Down Expand Up @@ -160,15 +160,15 @@ function Input({
placeholder={placeholder}
ref={inputRef}
type={type}
value={hidden ? HIDDEN_PLACEHOLDER : value}
value={reveal && hidden ? HIDDEN_PLACEHOLDER : value}
className={inputClasses.join(' ')}
{...props}
/>
{icon && <InputIconContainer icon={icon} />}
{copy || error || actions ? (
<div className={__styles.actions_container}>
{error && <InputErrorIcon size={size} />}
{copy && !hidden ? (
{copy && !(reveal && hidden) ? (
<Button
size="tiny"
type="default"
Expand All @@ -178,7 +178,7 @@ function Input({
{copyLabel}
</Button>
) : null}
{hidden && reveal ? (
{reveal && hidden ? (
<Button size="tiny" type="default" onClick={onReveal}>
Reveal
</Button>
Expand Down

0 comments on commit e62d7e9

Please sign in to comment.