Skip to content

Commit

Permalink
Merge pull request #323 from supabase/fix/hidden-reveal
Browse files Browse the repository at this point in the history
fix: only check `hidden` if `reveal` is true, to correctly handle `reveal` changes
  • Loading branch information
MildTomato authored Feb 17, 2022
2 parents 6dc46ee + a854563 commit 743b294
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 @@ -61,7 +61,7 @@ function Input({
...props
}: Props) {
const [copyLabel, setCopyLabel] = useState('Copy')
const [hidden, setHidden] = useState(reveal)
const [hidden, setHidden] = useState(true)

// if `type` is not assigned, default to text input
if (!type) {
Expand Down Expand Up @@ -125,7 +125,7 @@ function Input({
placeholder={placeholder}
ref={inputRef}
type={type}
value={hidden ? hiddenPlaceholder : value}
value={reveal && hidden ? hiddenPlaceholder : value}
className={inputClasses.join(' ')}
{...props}
/>
Expand All @@ -136,7 +136,7 @@ function Input({
size={1}
>
{error && <InputErrorIcon size={size} />}
{copy && !hidden ? (
{copy && !(reveal && hidden) ? (
<Button
size="tiny"
type="default"
Expand All @@ -146,7 +146,7 @@ function Input({
{copyLabel}
</Button>
) : null}
{hidden && reveal ? (
{reveal && hidden ? (
<Button size="tiny" type="default" onClick={onReveal}>
Reveal
</Button>
Expand Down

1 comment on commit 743b294

@vercel
Copy link

@vercel vercel bot commented on 743b294 Mar 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.