Attempt to at move app into app sub dir
This commit is contained in:
46
app/web/src/components/InputText/InputText.js
Normal file
46
app/web/src/components/InputText/InputText.js
Normal file
@@ -0,0 +1,46 @@
|
||||
import { getActiveClasses } from 'get-active-classes'
|
||||
|
||||
const InputText = ({
|
||||
value,
|
||||
isEditable,
|
||||
onChange,
|
||||
className,
|
||||
isInvalid = false,
|
||||
}) => {
|
||||
return (
|
||||
<>
|
||||
<div
|
||||
className={getActiveClasses(
|
||||
'relative inline-block',
|
||||
{ hidden: !isEditable },
|
||||
className
|
||||
)}
|
||||
>
|
||||
<div
|
||||
className={getActiveClasses(
|
||||
'absolute inset-0 mb-2 rounded bg-gray-200 shadow-inner',
|
||||
{ 'border border-red-500': isInvalid }
|
||||
)}
|
||||
/>
|
||||
<input
|
||||
className="pl-2 pt-1 text-indigo-800 font-medium mb-px pb-px bg-transparent relative"
|
||||
onChange={onChange}
|
||||
value={value}
|
||||
readOnly={!onChange}
|
||||
type="text"
|
||||
/>
|
||||
</div>
|
||||
<span
|
||||
className={getActiveClasses(
|
||||
'pl-2 text-indigo-800 font-medium mb-px pb-px',
|
||||
{ hidden: isEditable },
|
||||
className
|
||||
)}
|
||||
>
|
||||
{value}
|
||||
</span>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export default InputText
|
||||
7
app/web/src/components/InputText/InputText.stories.js
Normal file
7
app/web/src/components/InputText/InputText.stories.js
Normal file
@@ -0,0 +1,7 @@
|
||||
import InputText from './InputText'
|
||||
|
||||
export const generated = () => {
|
||||
return <InputText />
|
||||
}
|
||||
|
||||
export default { title: 'Components/InputText' }
|
||||
11
app/web/src/components/InputText/InputText.test.js
Normal file
11
app/web/src/components/InputText/InputText.test.js
Normal file
@@ -0,0 +1,11 @@
|
||||
import { render } from '@redwoodjs/testing'
|
||||
|
||||
import InputText from './InputText'
|
||||
|
||||
describe('InputText', () => {
|
||||
it('renders successfully', () => {
|
||||
expect(() => {
|
||||
render(<InputText />)
|
||||
}).not.toThrow()
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user