Skip to content
This repository has been archived by the owner on Jun 2, 2022. It is now read-only.

Commit

Permalink
apply requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
tlgimenes committed Mar 11, 2022
1 parent d17cd52 commit 32bbc42
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- useWindowDimensions hook

### Removed
- Hooks folder
- Removing hooks folder and migrating these hooks to sdk ou inline them on components
- gatsby-plugin-offline due to CLS on recurrent users
- useWindowDimensions hook
- Removes unused `<FacetedFilter/>` component
Expand Down
13 changes: 8 additions & 5 deletions src/components/common/PostalCode/PostalCodeInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,17 @@ const POSTAL_CODE_STORAGE_KEY = 'main::store::postalCode'
const POSTAL_CODE_INPUT_ID = 'postal-code-input'

export default function PostalCodeInput() {
const [code, setPostalCode] = useStorage<string>(POSTAL_CODE_STORAGE_KEY, '')
const ref = useRef<HTMLInputElement>(null)
const [postalCode, setPostalCode] = useStorage<string>(
POSTAL_CODE_STORAGE_KEY,
''
)

const handleSubmit = (event: KeyboardEvent<HTMLInputElement>) => {
const val = ref.current?.value
const value = ref.current?.value

if (event.key === 'Enter' && typeof val === 'string') {
setPostalCode(val)
if (event.key === 'Enter' && typeof value === 'string') {
setPostalCode(value)
}
}

Expand All @@ -27,7 +30,7 @@ export default function PostalCodeInput() {
id={POSTAL_CODE_INPUT_ID}
ref={ref}
onKeyDown={handleSubmit}
defaultValue={code}
defaultValue={postalCode}
/>
</div>
)
Expand Down

0 comments on commit 32bbc42

Please sign in to comment.