generated from Code-the-Dream-School/react-node-practicum-front-template
-
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
0fda49d
commit a449f66
Showing
10 changed files
with
3,585 additions
and
134 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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,66 @@ | ||
import React from 'react'; | ||
import { useEffect, useRef } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import styled from 'styled-components' | ||
|
||
|
||
const AddMedicineForm = ({ id, value, handleMedChange, placeholder, children }) => { | ||
const inputRef = useRef(); | ||
|
||
useEffect(() => { | ||
inputRef.current.focus(); | ||
}, [value]) | ||
|
||
return ( | ||
<div> | ||
|
||
<StyleInput | ||
type={id === 'expirationDate' ? 'date' : 'text'} | ||
key={id} | ||
id={id} | ||
value={value} // Directly use value passed as a prop | ||
onChange={handleMedChange} | ||
placeholder={placeholder} | ||
ref={inputRef} | ||
/> | ||
|
||
</div> | ||
) | ||
} | ||
/* | ||
AddMedicineForm.propTypes = { | ||
id: PropTypes.string.isRequired, | ||
value: PropTypes.string.isRequired, | ||
handleMedChange: PropTypes.func.isRequired, | ||
placeholder: PropTypes.string.isRequired, | ||
children: PropTypes.node.isRequired, | ||
} | ||
*/ | ||
|
||
export default AddMedicineForm; | ||
|
||
export const FormField = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
gap: 0.4rem; /* Adjust spacing between label and input */ | ||
`; | ||
|
||
|
||
export const StyleInput = styled.input` | ||
text-size: 1rem; | ||
width: 100%; | ||
border: 1.5px solid #000; | ||
border-radius: 4px; | ||
display: flex; | ||
flex-direction: column; | ||
align-items:flex-start; | ||
padding: 1em; | ||
margin: 0rem; | ||
color: #000; | ||
/* Placeholder text color */ | ||
&::placeholder { | ||
color: black; /* Set placeholder text to black */ | ||
} | ||
`; |
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 |
---|---|---|
|
@@ -73,6 +73,10 @@ body { | |
line-height: 1; | ||
} | ||
|
||
body.active-modal { | ||
overflow: hidden; | ||
} | ||
|
||
h1, | ||
h2, | ||
h3, | ||
|
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
Oops, something went wrong.