-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
42 add typescript #104
42 add typescript #104
Changes from 10 commits
27f0fe3
2c56b72
a575a23
2d2cded
66093b4
d73a084
be5124a
a57fa3c
f176d13
46dfa9e
2518158
3d9086d
b27eac6
b181f3b
92992d9
88a6776
c16364d
eff476e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
{ | ||
"compilerOptions": { | ||
"jsx": "react", | ||
"baseUrl": ".", | ||
"paths": { | ||
"@": ["src"], | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import React from 'react' | ||
import S from 'styled-components' | ||
|
||
interface ErrorMessageProps { | ||
id: string; | ||
errorMessage: string; | ||
} | ||
|
||
const ErrorMessage:React.FC<ErrorMessageProps> = ({ id, errorMessage }) => <StyledErrorMessage id={id}>{errorMessage}</StyledErrorMessage> | ||
|
||
const StyledErrorMessage = S.p` | ||
display: none; | ||
margin-top: 0.5rem; | ||
color: red; | ||
font-size: 13px; | ||
font-family: Arial, Helvetica, sans-serif; | ||
` | ||
|
||
export default ErrorMessage |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,33 @@ | ||
import React from 'react'; | ||
import { deviceBrakepoints } from '../config/device-brakepoints' | ||
import Label from './Label.jsx' | ||
import S from 'styled-components' | ||
import { deviceBrakepoints } from '@config/device-brakepoints.jsx' | ||
|
||
const Input = ({ type = 'text', id, help, helpText, disabled, width, label, value, whenChanged }) => ( | ||
interface InputProps { | ||
type?: string; | ||
id: string; | ||
help: string; | ||
helpText: string; | ||
disabled?: boolean; | ||
width: number; | ||
label: string; | ||
value: string | number; | ||
whenChanged: (e:any) => void; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
}; | ||
|
||
const Input:React.FC<InputProps> = ({ type = 'text', id, help, helpText, disabled, width, label, value, whenChanged }) => ( | ||
<Container width={width} > | ||
<Label label={label} for={id}/> | ||
<Label label={label} forId={id}/> | ||
<InnerInput type={type} name={id} id={id} aria-describedby={help} disabled={disabled} value={value} onChange={whenChanged} /> | ||
<span hidden id={help}>{helpText}</span> | ||
</Container> | ||
) | ||
|
||
const Container = S.div` | ||
interface ContainerProps { | ||
width: number; | ||
}; | ||
|
||
const Container = S.div<ContainerProps>` | ||
display: inline-block; | ||
text-align: left; | ||
margin-bottom: 7px; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,22 @@ | ||
import ErrorMessage from './ErrorMessage.jsx' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove .jsx |
||
import React from 'react' | ||
import ErrorMessage from './ErrorMessage.js' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove .js |
||
import S from 'styled-components' | ||
import { useState } from 'react' | ||
import { InputsProps } from './SplittedInput.js'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove.js There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @itmilos I do not know why is that happening. The app is constantly injecting .jsx imports |
||
|
||
const InputGroup = ({ input, index }) => { | ||
interface InputGroupProps { | ||
input: InputsProps; | ||
index: number; | ||
} | ||
|
||
const InputGroup:React.FC<InputGroupProps> = ({ input, index }) => { | ||
const [focused, setFocused] = useState(false) | ||
|
||
const handleFocus = event => { | ||
const handleFocus = (event: React.FocusEvent<HTMLInputElement>) => { | ||
setFocused(true) | ||
if (input?.appendZeros && event.target.value.length < 13) input.appendZeros(event.target.value) | ||
} | ||
|
||
return ( | ||
<StyledInputGroup width={input.width}> | ||
<StyledInput | ||
|
@@ -27,7 +35,11 @@ const InputGroup = ({ input, index }) => { | |
) | ||
} | ||
|
||
const StyledInputGroup = S.div` | ||
interface StyledInputGroup { | ||
width: number; | ||
}; | ||
|
||
const StyledInputGroup = S.div<StyledInputGroup>` | ||
width: ${props => (props.width ? props.width : '100')}%; | ||
display: inline-block; | ||
` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove .jsx