Skip to content

Commit

Permalink
feat: 금액 입력 부분 작업 진행 중
Browse files Browse the repository at this point in the history
  • Loading branch information
BearHumanS authored and kledyu committed Jul 7, 2023
1 parent 50b3138 commit afeabc9
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 3 deletions.
47 changes: 47 additions & 0 deletions src/components/modal/Expenses.tsx
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>&#x20A9;</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;
11 changes: 8 additions & 3 deletions src/components/modal/Modal.tsx
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

0 comments on commit afeabc9

Please sign in to comment.