Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
interface
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
LuckySwap
interface
Commits
536de89a
Unverified
Commit
536de89a
authored
May 20, 2020
by
Noah Zinsmeister
Committed by
GitHub
May 20, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replace commas with periods (#815)
* replace commas with periods * add pattern attribute
parent
199eb8bf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
index.tsx
src/components/CurrencyInputPanel/index.tsx
+0
-1
index.tsx
src/components/NumericalInput/index.tsx
+7
-6
No files found.
src/components/CurrencyInputPanel/index.tsx
View file @
536de89a
...
@@ -27,7 +27,6 @@ const CurrencySelect = styled.button<{ selected: boolean }>`
...
@@ -27,7 +27,6 @@ const CurrencySelect = styled.button<{ selected: boolean }>`
align-items: center;
align-items: center;
height: 2.2rem;
height: 2.2rem;
font-size: 20px;
font-size: 20px;
font-family: 'Inter';
font-weight: 500;
font-weight: 500;
background-color:
${({
selected
,
theme
})
=>
(
selected
?
theme
.
bg1
:
theme
.
primary1
)}
;
background-color:
${({
selected
,
theme
})
=>
(
selected
?
theme
.
bg1
:
theme
.
primary1
)}
;
color:
${({
selected
,
theme
})
=>
(
selected
?
theme
.
text1
:
theme
.
white
)}
;
color:
${({
selected
,
theme
})
=>
(
selected
?
theme
.
text1
:
theme
.
white
)}
;
...
...
src/components/NumericalInput/index.tsx
View file @
536de89a
...
@@ -3,18 +3,15 @@ import styled from 'styled-components'
...
@@ -3,18 +3,15 @@ import styled from 'styled-components'
import
{
escapeRegExp
}
from
'
../../utils
'
import
{
escapeRegExp
}
from
'
../../utils
'
const
StyledInput
=
styled
.
input
<
{
error
?:
boolean
;
fontSize
?:
string
;
align
?:
string
}
>
`
const
StyledInput
=
styled
.
input
<
{
error
?:
boolean
;
fontSize
?:
string
;
align
?:
string
}
>
`
color:
${({
error
,
theme
})
=>
error
&&
theme
.
red1
}
;
color:
${({
error
,
theme
})
=>
(
error
?
theme
.
red1
:
theme
.
text1
)}
;
color:
${({
theme
})
=>
theme
.
text1
}
;
width: 0;
width: 0;
position: relative;
position: relative;
font-size: 24px;
font-weight: 500;
font-weight: 500;
font-family: 'Inter', sans-serif;
outline: none;
outline: none;
border: none;
border: none;
flex: 1 1 auto;
flex: 1 1 auto;
background-color:
${({
theme
})
=>
theme
.
bg1
}
;
background-color:
${({
theme
})
=>
theme
.
bg1
}
;
font-size:
${({
fontSize
})
=>
fontSize
&&
fontSize
}
;
font-size:
${({
fontSize
})
=>
fontSize
??
'
24px
'
};
text
-
align
:
$
{({
align
})
=>
align
&&
align
};
text
-
align
:
$
{({
align
})
=>
align
&&
align
};
white
-
space
:
nowrap
;
white
-
space
:
nowrap
;
overflow
:
hidden
;
overflow
:
hidden
;
...
@@ -65,7 +62,8 @@ export const Input = React.memo(function InnerInput({
...
@@ -65,7 +62,8 @@ export const Input = React.memo(function InnerInput({
{
...
rest
}
{
...
rest
}
value=
{
value
}
value=
{
value
}
onChange=
{
event
=>
{
onChange=
{
event
=>
{
enforcer
(
event
.
target
.
value
)
// replace commas with periods, because uniswap exclusively uses period as the decimal separator
enforcer
(
event
.
target
.
value
.
replace
(
/,/g
,
'
.
'
))
}
}
}
}
// universal input options
// universal input options
inputMode=
"decimal"
inputMode=
"decimal"
...
@@ -74,6 +72,7 @@ export const Input = React.memo(function InnerInput({
...
@@ -74,6 +72,7 @@ export const Input = React.memo(function InnerInput({
autoCorrect=
"off"
autoCorrect=
"off"
// text-specific options
// text-specific options
type=
"text"
type=
"text"
pattern=
"^[0-9]*[.,]?[0-9]*$"
placeholder=
{
placeholder
||
'
0.0
'
}
placeholder=
{
placeholder
||
'
0.0
'
}
minLength=
{
1
}
minLength=
{
1
}
maxLength=
{
79
}
maxLength=
{
79
}
...
@@ -83,3 +82,5 @@ export const Input = React.memo(function InnerInput({
...
@@ -83,3 +82,5 @@ export const Input = React.memo(function InnerInput({
})
})
export
default
Input
export
default
Input
// const inputRegex = RegExp(`^\\d*(?:\\\\[.])?\\d*$`) // match escaped "." characters via in a non-capturing group
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment