Skip to content

Commit

Permalink
Merge branch 'daniel-schwartz-k:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
danielschwartz85 committed Jul 27, 2023
2 parents 9df5567 + 56ced02 commit a342488
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/components/encoded/encoded.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { StyledCard, StyledHeader } from '../common/common'
import { useMemo } from 'react'
import { useMemo, useState } from 'react'
import TextFieldCopy from '../common/textFieldCopy'

export interface IEncodedProps {
Expand All @@ -14,6 +14,12 @@ function isValid(encoded: string): boolean {
export default function Encoded(props: IEncodedProps) {
const { value, onChange } = props
const error = useMemo(() => !!value && !isValid(value), [value])
const [isAppStart, setIsAppStart] = useState(true)

const onBlur = () => {
setIsAppStart(false)
}

return (
<>
<StyledHeader variant="h4">{'Encoded'}</StyledHeader>
Expand All @@ -25,6 +31,8 @@ export default function Encoded(props: IEncodedProps) {
error={error}
onChange={onChange}
ariaLabel="encoded input"
inputRef={(input) => isAppStart && input?.focus()}
onBlur={onBlur}
/>
</StyledCard>
</>
Expand Down

0 comments on commit a342488

Please sign in to comment.