Adds styling to the form inputs

This commit is contained in:
Vazhin Tayeb 2021-01-15 16:01:25 +03:00 committed by Muhammad Azeez
parent 4e9bdb7876
commit 544876ac55
7 changed files with 74 additions and 17 deletions

View File

@ -8280,6 +8280,14 @@
"brorand": "^1.0.1" "brorand": "^1.0.1"
} }
}, },
"milligram": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/milligram/-/milligram-1.4.1.tgz",
"integrity": "sha512-RCgh/boHhcXWOUfKJWm3RJRoUeaEguoipDg0mJ31G0tFfvcpWMUlO1Zlqqr12K4kAXfDlllaidu0x7PaL2PTFg==",
"requires": {
"normalize.css": "~8.0.1"
}
},
"mime": { "mime": {
"version": "2.4.4", "version": "2.4.4",
"resolved": "https://registry.npmjs.org/mime/-/mime-2.4.4.tgz", "resolved": "https://registry.npmjs.org/mime/-/mime-2.4.4.tgz",
@ -8700,6 +8708,11 @@
"sort-keys": "^1.0.0" "sort-keys": "^1.0.0"
} }
}, },
"normalize.css": {
"version": "8.0.1",
"resolved": "https://registry.npmjs.org/normalize.css/-/normalize.css-8.0.1.tgz",
"integrity": "sha512-qizSNPO93t1YUuUhP22btGOo3chcvDFqFaj2TRybP0DMxkHOCTYwp3n34fel4a31ORXy4m1Xq0Gyqpb5m33qIg=="
},
"npm-run-path": { "npm-run-path": {
"version": "2.0.2", "version": "2.0.2",
"resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz",

View File

@ -4,6 +4,7 @@
"private": true, "private": true,
"dependencies": { "dependencies": {
"axios": "^0.19.0", "axios": "^0.19.0",
"milligram": "^1.4.1",
"oidc-client": "^1.9.1", "oidc-client": "^1.9.1",
"react": "^16.10.0", "react": "^16.10.0",
"react-dom": "^16.10.0", "react-dom": "^16.10.0",

View File

@ -1,6 +1,6 @@
import React from 'react'; import React from "react";
import ReactDOM from 'react-dom'; import ReactDOM from "react-dom";
import 'milligram/dist/milligram.min.css' import "milligram/dist/milligram.min.css";
import App from './App'; import App from "./App";
ReactDOM.render(<App />, document.getElementById('root')); ReactDOM.render(<App />, document.getElementById("root"));

View File

@ -1,10 +1,10 @@
import React from "react"; import React from "react";
const Card = ({ children, styles = {} }) => { const Card = ({ children, classes = "", styles = {} }) => {
return ( return (
<div <div
style={{ ...styles }} style={{ ...styles }}
className="xl:w-1/3 lg:w-5/12 md:w-2/4 sm:w-9/12 w-11/12 flex flex-col justify-center shadow md:px-32 sm:px-28 md:py-36 sm:py-36 px-20 py-16 my-20" className={`xl:w-1/3 lg:w-5/12 md:w-2/4 sm:w-9/12 w-11/12 flex flex-col justify-center shadow md:px-32 sm:px-28 md:py-36 sm:py-36 px-20 py-16 my-20 ${classes}`}
> >
{children} {children}
</div> </div>

View File

@ -28,7 +28,7 @@ const VehicleRegisterForm = () => {
} }
return ( return (
<Card styles={{ padding: "60px" }}> <Card styles={{ padding: "60px" }} classes="xl:w-2/5">
<form onSubmit={(e) => e.preventDefault()} className="m-0 flex flex-col"> <form onSubmit={(e) => e.preventDefault()} className="m-0 flex flex-col">
<Heading3 styles={{ marginTop: "0" }}>Register A Vehicle</Heading3> <Heading3 styles={{ marginTop: "0" }}>Register A Vehicle</Heading3>
@ -37,18 +37,21 @@ const VehicleRegisterForm = () => {
label="Model" label="Model"
value={model} value={model}
name="model" name="model"
placeholder="Model"
onChangeEvent={(e) => setModel(e.target.value)} onChangeEvent={(e) => setModel(e.target.value)}
/> />
<InputText <InputText
label="License Plate" label="License Plate"
value={licensePlate} value={licensePlate}
name="licensePlate" name="licensePlate"
placeholder="License Plate"
onChangeEvent={(e) => setlicensePlate(e.target.value)} onChangeEvent={(e) => setlicensePlate(e.target.value)}
/> />
<InputText <InputText
label="Color" label="Color"
value={color} value={color}
name="color" name="color"
placeholder="Color"
onChangeEvent={(e) => setColor(e.target.value)} onChangeEvent={(e) => setColor(e.target.value)}
/> />
<InputSelect <InputSelect
@ -63,7 +66,11 @@ const VehicleRegisterForm = () => {
]} ]}
/> />
</div> </div>
<Button text="Register" onClickEvent={registerVehicle} /> <Button
text="Register"
onClickEvent={registerVehicle}
classes="mt-10"
/>
</form> </form>
</Card> </Card>
); );

View File

@ -1,10 +1,31 @@
import React from "react"; import React from "react";
const InputSelect = ({ label, value, name, onChangeEvent, options }) => { const InputSelect = ({
label,
value,
name,
placeholder,
onChangeEvent,
options,
}) => {
return ( return (
<div> <div className="flex flex-col items-start">
<label>{label}</label> <label className="font-inter font-semibold text-2xl text-black-custom mb-4">
<select value={value} name={name} onChange={onChangeEvent}> {label}
</label>
<select
value={value}
name={name}
onChange={onChangeEvent}
className="font-normal font-inter text-2xl text-black-custom mb-10 cursor-pointer"
style={{
borderRadius: ".25rem",
border: "none",
boxShadow: `0 1px 1px rgba(0, 0, 0, 0.2), 0 0 4px rgba(0, 0, 0, 0.1)`,
background: "none",
appearance: "auto",
}}
>
{options.map((option, i) => ( {options.map((option, i) => (
<option key={i} value={option.value}> <option key={i} value={option.value}>
{option.text} {option.text}

View File

@ -1,10 +1,25 @@
import React from "react"; import React from "react";
const InputText = ({ label, value, name, onChangeEvent }) => { const InputText = ({ label, value, name, onChangeEvent, placeholder }) => {
return ( return (
<div> <div className="flex flex-col items-start">
<label>{label}</label> <label className="font-inter font-semibold text-2xl text-black-custom mb-4">
<input value={value} type="text" name={name} onChange={onChangeEvent} /> {label}
</label>
<input
value={value}
type="text"
name={name}
onChange={onChangeEvent}
className="font-normal font-inter text-2xl text-black-custom mb-10"
placeholder={placeholder}
autoComplete="off"
style={{
borderRadius: ".25rem",
border: "none",
boxShadow: `0 1px 1px rgba(0, 0, 0, 0.2), 0 0 4px rgba(0, 0, 0, 0.1)`,
}}
/>
</div> </div>
); );
}; };