Skip to content

Commit

Permalink
feat #218 - Address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
sam-dassana committed Feb 19, 2021
1 parent 34b1035 commit b6a08b9
Show file tree
Hide file tree
Showing 5 changed files with 175 additions and 72 deletions.
202 changes: 159 additions & 43 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"dependencies": {
"@ant-design/icons": "^4.2.2",
"@dassana-io/web-utils": "^0.7.6",
"@dassana-io/web-utils": "^0.7.9",
"@fortawesome/fontawesome-svg-core": "^1.2.32",
"@fortawesome/free-solid-svg-icons": "^5.15.1",
"@fortawesome/react-fontawesome": "^0.1.14",
Expand Down
5 changes: 1 addition & 4 deletions src/components/Form/FormInput/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { Input as AntDInput } from 'antd'
import { BaseFieldProps } from '../types'
import cn from 'classnames'
import FieldError from '../FieldError'
Expand All @@ -7,7 +6,7 @@ import { getFormFieldDataTag } from '../utils'
import { Controller, useFormContext } from 'react-hook-form'
import FieldContext, { FieldContextProps } from '../FieldContext'
import { Input, InputProps } from 'components/Input'
import React, { FC, KeyboardEvent, useContext, useRef } from 'react'
import React, { FC, KeyboardEvent, useContext } from 'react'

export interface FormInputProps
extends BaseFieldProps,
Expand All @@ -27,7 +26,6 @@ const FormInput: FC<FormInputProps> = ({
rules = {},
...rest
}: FormInputProps) => {
const inputRef = useRef<AntDInput>(null)
const { clearErrors, control, errors } = useFormContext()
const { loading } = useContext<FieldContextProps>(FieldContext)

Expand Down Expand Up @@ -66,7 +64,6 @@ const FormInput: FC<FormInputProps> = ({
error={errors[name]}
focused={focused}
fullWidth={fullWidth}
inputRef={inputRef}
loading={loading}
onChange={onChange}
onFocus={onInputFocus}
Expand Down
14 changes: 8 additions & 6 deletions src/components/Form/FormSubmitButton/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@ export const getUseShortcutProps = ({
callback,
useShortcutProps
}: Params): UseShortcutConfig => {
const defaultConfig: UseShortcutConfig = {
const commonShortcutConfigProps = {
additionalConditionalFn,
callback,
callback
}

const defaultConfig: UseShortcutConfig = {
...commonShortcutConfigProps,
key: 'Enter',
keyEvent: 'keydown'
}
Expand All @@ -25,8 +29,7 @@ export const getUseShortcutProps = ({
const { key, keyEvent } = useShortcutProps

return {
additionalConditionalFn,
callback,
...commonShortcutConfigProps,
key,
keyEvent
}
Expand All @@ -36,8 +39,7 @@ export const getUseShortcutProps = ({
const { keys } = useShortcutProps

return {
additionalConditionalFn,
callback,
...commonShortcutConfigProps,
keys
}
}
Expand Down
Loading

0 comments on commit b6a08b9

Please sign in to comment.