Skip to content
This repository was archived by the owner on Feb 19, 2025. It is now read-only.

Commit e62d7e9

Browse files
committed
fix: only check hidden if reveal is true, to correctly handle reveal changes
# Conflicts: # src/components/Input/Input.tsx
1 parent 9394b15 commit e62d7e9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Diff for: src/components/Input/Input.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ function Input({
6565
...props
6666
}: Props) {
6767
const [copyLabel, setCopyLabel] = useState('Copy')
68-
const [hidden, setHidden] = useState(reveal)
68+
const [hidden, setHidden] = useState(true)
6969

7070
const __styles = styleHandler('input')
7171

@@ -160,15 +160,15 @@ function Input({
160160
placeholder={placeholder}
161161
ref={inputRef}
162162
type={type}
163-
value={hidden ? HIDDEN_PLACEHOLDER : value}
163+
value={reveal && hidden ? HIDDEN_PLACEHOLDER : value}
164164
className={inputClasses.join(' ')}
165165
{...props}
166166
/>
167167
{icon && <InputIconContainer icon={icon} />}
168168
{copy || error || actions ? (
169169
<div className={__styles.actions_container}>
170170
{error && <InputErrorIcon size={size} />}
171-
{copy && !hidden ? (
171+
{copy && !(reveal && hidden) ? (
172172
<Button
173173
size="tiny"
174174
type="default"
@@ -178,7 +178,7 @@ function Input({
178178
{copyLabel}
179179
</Button>
180180
) : null}
181-
{hidden && reveal ? (
181+
{reveal && hidden ? (
182182
<Button size="tiny" type="default" onClick={onReveal}>
183183
Reveal
184184
</Button>

0 commit comments

Comments
 (0)