Attempt to at move app into app sub dir
This commit is contained in:
34
app/web/src/components/InputTextForm/InputTextForm.js
Normal file
34
app/web/src/components/InputTextForm/InputTextForm.js
Normal file
@@ -0,0 +1,34 @@
|
||||
import { getActiveClasses } from 'get-active-classes'
|
||||
import { TextField, FieldError } from '@redwoodjs/forms'
|
||||
import { useFormContext } from 'react-hook-form'
|
||||
|
||||
const InputText = ({ type = 'text', className, name, validation }) => {
|
||||
const { errors } = useFormContext()
|
||||
return (
|
||||
<>
|
||||
<div className={getActiveClasses('relative inline-block', className)}>
|
||||
<FieldError
|
||||
className="absolute -my-4 text-sm text-red-500 font-ropa-sans"
|
||||
name={name}
|
||||
/>
|
||||
<div
|
||||
className={getActiveClasses(
|
||||
'absolute inset-0 mb-2 rounded bg-gray-200 shadow-inner',
|
||||
{ 'border border-red-500': errors[name] }
|
||||
)}
|
||||
/>
|
||||
<TextField
|
||||
className={getActiveClasses(
|
||||
'pl-2 pt-1 text-indigo-800 font-medium mb-px pb-px bg-transparent relative w-full'
|
||||
)}
|
||||
name={name}
|
||||
readOnly={false}
|
||||
type={type}
|
||||
validation={validation}
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export default InputText
|
||||
@@ -0,0 +1,7 @@
|
||||
import InputTextForm from './InputTextForm'
|
||||
|
||||
export const generated = () => {
|
||||
return <InputTextForm />
|
||||
}
|
||||
|
||||
export default { title: 'Components/InputTextForm' }
|
||||
11
app/web/src/components/InputTextForm/InputTextForm.test.js
Normal file
11
app/web/src/components/InputTextForm/InputTextForm.test.js
Normal file
@@ -0,0 +1,11 @@
|
||||
import { render } from '@redwoodjs/testing'
|
||||
|
||||
import InputTextForm from './InputTextForm'
|
||||
|
||||
describe('InputTextForm', () => {
|
||||
it('renders successfully', () => {
|
||||
expect(() => {
|
||||
render(<InputTextForm />)
|
||||
}).not.toThrow()
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user