-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from tan12082001/AddNewCar
Add new car
- Loading branch information
Showing
18 changed files
with
310 additions
and
55 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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,65 @@ | ||
import PropTypes from 'prop-types'; | ||
import { Form, Formik } from 'formik'; | ||
import styled from '@emotion/styled'; | ||
|
||
const FormComponent2 = ({ | ||
initialValues, | ||
schema, | ||
onSubmit, | ||
children, | ||
className, | ||
}) => ( | ||
<Formik | ||
initialValues={initialValues} | ||
validationSchema={schema} | ||
onSubmit={onSubmit} | ||
> | ||
<StyledForm className={className}> | ||
{children} | ||
</StyledForm> | ||
</Formik> | ||
); | ||
|
||
FormComponent2.propTypes = { | ||
initialValues: PropTypes.shape({ | ||
name: PropTypes.string.isRequired, | ||
description: PropTypes.string.isRequired, | ||
pricePerHr: PropTypes.string.isRequired, | ||
sitting_capacity: PropTypes.number.isRequired, | ||
rental_duration: PropTypes.number.isRequired, | ||
image: PropTypes.string.isRequired, | ||
}).isRequired, | ||
schema: PropTypes.shape({ | ||
name: PropTypes.string.isRequired, | ||
description: PropTypes.string.isRequired, | ||
pricePerHr: PropTypes.string.isRequired, | ||
sitting_capacity: PropTypes.number.isRequired, | ||
rental_duration: PropTypes.number.isRequired, | ||
image: PropTypes.string.isRequired, | ||
}).isRequired, | ||
onSubmit: PropTypes.func.isRequired, | ||
children: PropTypes.node.isRequired, | ||
className: PropTypes.string.isRequired, | ||
}; | ||
|
||
const StyledForm = styled(Form)` | ||
// border: 1px solid blue; | ||
padding: 2rem; | ||
&.flex { | ||
display: flex; | ||
width: 60%; | ||
} | ||
& > .spanTwo { | ||
grid-column: span 2; | ||
} | ||
& > .margin { | ||
gird-column: span 2; | ||
margin-left: 15%; | ||
margin-right: 15%; | ||
} | ||
`; | ||
|
||
export default FormComponent2; |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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.