-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
50b3138
commit afeabc9
Showing
2 changed files
with
55 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import React, {useState} from 'react' | ||
import styled from 'styled-components' | ||
|
||
function Expenses() { | ||
const [expenses, setExpenses] = useState(''); | ||
|
||
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => { | ||
const input = event.target.value; | ||
const numericInput = Number(input.replace(/[^0-9]/g, '')).toLocaleString() | ||
setExpenses(numericInput); | ||
}; | ||
|
||
return ( | ||
<> | ||
<Container> | ||
<ExpensesInputBox> | ||
<span>₩</span> | ||
<StyledInput type="text" value={expenses} onChange={handleChange} /> | ||
</ExpensesInputBox> | ||
|
||
</Container> | ||
</> | ||
); | ||
} | ||
|
||
const Container = styled.form ` | ||
` | ||
|
||
const ExpensesInputBox = styled.div ` | ||
display: flex; | ||
justify-content: space-around; | ||
width: 200px; | ||
border: 1px solid; | ||
` | ||
|
||
const StyledInput = styled.input ` | ||
border: none; | ||
text-align: right; | ||
&:focus { | ||
outline: none; | ||
` | ||
|
||
export default Expenses; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
function modal() { | ||
return <div>modal</div>; | ||
import React from 'react' | ||
import Expenses from './Expenses' | ||
|
||
function Modal() { | ||
return ( | ||
<Expenses /> | ||
) | ||
} | ||
|
||
export default modal; | ||
export default Modal |