fix Unexpected any.
This commit is contained in:
parent
4473ed56de
commit
8b6175eb71
@ -20,7 +20,7 @@ services:
|
||||
image: node:20
|
||||
restart: always
|
||||
working_dir: /app
|
||||
command: bash -c "npm install && npm run build && npm run start"
|
||||
command: bash -c "npm ci --force && npm run build && npm run start"
|
||||
environment:
|
||||
MYSQL_USER: ${MYSQL_USER}
|
||||
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
|
||||
@ -28,5 +28,7 @@ services:
|
||||
MYSQL_DATABASE_NAME: ${MYSQL_DATABASE_NAME}
|
||||
volumes:
|
||||
- ./:/app
|
||||
ports:
|
||||
- '3000:80'
|
||||
networks:
|
||||
reverse_proxy:
|
||||
@ -1,9 +1,11 @@
|
||||
import {BodyTypeItem} from "@/api/context/BodyType";
|
||||
|
||||
export async function list () {
|
||||
const response = await fetch('/api/v1/body-types');
|
||||
return (await response.json()).results.rows;
|
||||
}
|
||||
|
||||
export async function add (params: any) {
|
||||
export async function add (params: BodyTypeItem) {
|
||||
const response = await fetch('/api/v1/body-types', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
@ -14,7 +16,7 @@ export async function add (params: any) {
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
export async function update (params: any) {
|
||||
export async function update (params: BodyTypeItem) {
|
||||
const response = await fetch('/api/v1/body-types', {
|
||||
method: 'PUT',
|
||||
headers: {
|
||||
@ -30,7 +32,7 @@ export async function update (params: any) {
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
export async function remove (params: any) {
|
||||
export async function remove (params: BodyTypeItem) {
|
||||
const response = await fetch('/api/v1/body-types', {
|
||||
method: 'DELETE',
|
||||
headers: {
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
import {CarBrandItem} from "@/api/context/CarBrand";
|
||||
|
||||
export async function list () {
|
||||
const response = await fetch('/api/v1/car-brands');
|
||||
return (await response.json()).results.rows;
|
||||
}
|
||||
|
||||
export async function add (params: any) {
|
||||
export async function add (params: CarBrandItem) {
|
||||
const response = await fetch('/api/v1/car-brands', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
@ -14,7 +16,7 @@ export async function add (params: any) {
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
export async function update (params: any) {
|
||||
export async function update (params: CarBrandItem) {
|
||||
const response = await fetch('/api/v1/car-brands', {
|
||||
method: 'PUT',
|
||||
headers: {
|
||||
@ -30,7 +32,7 @@ export async function update (params: any) {
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
export async function remove (params: any) {
|
||||
export async function remove (params: CarBrandItem) {
|
||||
const response = await fetch('/api/v1/car-brands', {
|
||||
method: 'DELETE',
|
||||
headers: {
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
import {CarColorItem} from "@/api/context/CarColor";
|
||||
|
||||
export async function list () {
|
||||
const response = await fetch('/api/v1/car-colors');
|
||||
return (await response.json()).results.rows;
|
||||
}
|
||||
|
||||
export async function add (params: any) {
|
||||
export async function add (params: CarColorItem) {
|
||||
const response = await fetch('/api/v1/car-colors', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
@ -14,7 +16,7 @@ export async function add (params: any) {
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
export async function update (params: any) {
|
||||
export async function update (params: CarColorItem) {
|
||||
const response = await fetch('/api/v1/car-colors', {
|
||||
method: 'PUT',
|
||||
headers: {
|
||||
@ -30,7 +32,7 @@ export async function update (params: any) {
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
export async function remove (params: any) {
|
||||
export async function remove (params: CarColorItem) {
|
||||
const response = await fetch('/api/v1/car-colors', {
|
||||
method: 'DELETE',
|
||||
headers: {
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
import {CarModelItem} from "@/api/context/CarModel";
|
||||
|
||||
export async function list () {
|
||||
const response = await fetch('/api/v1/car-models');
|
||||
return (await response.json()).results.rows;
|
||||
}
|
||||
|
||||
export async function add (params: any) {
|
||||
export async function add (params: CarModelItem) {
|
||||
const response = await fetch('/api/v1/car-models', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
@ -14,7 +16,7 @@ export async function add (params: any) {
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
export async function update (params: any) {
|
||||
export async function update (params: CarModelItem) {
|
||||
const response = await fetch('/api/v1/car-models', {
|
||||
method: 'PUT',
|
||||
headers: {
|
||||
@ -30,7 +32,7 @@ export async function update (params: any) {
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
export async function remove (params: any) {
|
||||
export async function remove (params: CarModelItem) {
|
||||
const response = await fetch('/api/v1/car-models', {
|
||||
method: 'DELETE',
|
||||
headers: {
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
import {CarItem} from "@/api/context/Car";
|
||||
|
||||
export async function list () {
|
||||
const response = await fetch('/api/v1/cars');
|
||||
return (await response.json()).results.rows;
|
||||
}
|
||||
|
||||
export async function add (params: any) {
|
||||
export async function add (params: CarItem) {
|
||||
const response = await fetch('/api/v1/cars', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
@ -14,7 +16,7 @@ export async function add (params: any) {
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
export async function update (params: any) {
|
||||
export async function update (params: CarItem) {
|
||||
const response = await fetch('/api/v1/cars', {
|
||||
method: 'PUT',
|
||||
headers: {
|
||||
@ -30,7 +32,7 @@ export async function update (params: any) {
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
export async function remove (params: any) {
|
||||
export async function remove (params: CarItem) {
|
||||
const response = await fetch('/api/v1/cars', {
|
||||
method: 'DELETE',
|
||||
headers: {
|
||||
|
||||
@ -3,13 +3,11 @@
|
||||
import React, { createContext, useContext, useState, useEffect, ReactNode } from 'react';
|
||||
import { list } from "@/api/bodyTypes";
|
||||
|
||||
interface BodyTypeItem {
|
||||
export interface BodyTypeItem {
|
||||
id: string;
|
||||
name: string;
|
||||
country: string;
|
||||
}
|
||||
|
||||
|
||||
interface BodyTypeContextType {
|
||||
bodyTypes: BodyTypeItem[] | null;
|
||||
setBodyTypes: (content: BodyTypeItem[] | null) => void;
|
||||
@ -19,7 +17,7 @@ interface BodyTypeContextType {
|
||||
const BodyTypeContext = createContext<BodyTypeContextType | undefined>(undefined);
|
||||
|
||||
export const BodyTypeProvider = ({ children }: { children: ReactNode }) => {
|
||||
const [bodyTypes, setBodyTypes] = useState<any | null>(null);
|
||||
const [bodyTypes, setBodyTypes] = useState<BodyTypeItem[] | null>(null);
|
||||
|
||||
const fetchData = async () => {
|
||||
setBodyTypes(await list());
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
import React, { createContext, useContext, useState, useEffect, ReactNode } from 'react';
|
||||
import { list } from "@/api/cars";
|
||||
|
||||
interface CarItem {
|
||||
export interface CarItem {
|
||||
id: string,
|
||||
car_models_id: string,
|
||||
engines_id: string,
|
||||
@ -22,7 +22,7 @@ interface CarContextType {
|
||||
const CarContext = createContext<CarContextType | undefined>(undefined);
|
||||
|
||||
export const CarProvider = ({ children }: { children: ReactNode }) => {
|
||||
const [car, setCar] = useState<any | null>(null);
|
||||
const [car, setCar] = useState<CarItem[] | null>(null);
|
||||
|
||||
const fetchData = async () => {
|
||||
setCar(await list());
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
import React, { createContext, useContext, useState, useEffect, ReactNode } from 'react';
|
||||
import { list } from "@/api/carBrands";
|
||||
|
||||
interface CarBrandItem {
|
||||
export interface CarBrandItem {
|
||||
id: string;
|
||||
name: string;
|
||||
country: string;
|
||||
@ -18,7 +18,7 @@ interface CarBrandContextType {
|
||||
const CarBrandContext = createContext<CarBrandContextType | undefined>(undefined);
|
||||
|
||||
export const CarBrandProvider = ({ children }: { children: ReactNode }) => {
|
||||
const [carBrands, setCarBrands] = useState<any | null>(null);
|
||||
const [carBrands, setCarBrands] = useState<CarBrandItem[] | null>(null);
|
||||
|
||||
const fetchData = async () => {
|
||||
setCarBrands(await list());
|
||||
|
||||
@ -3,8 +3,7 @@
|
||||
import React, { createContext, useContext, useState, useEffect, ReactNode } from 'react';
|
||||
import { list } from "@/api/carColors";
|
||||
|
||||
// Define types for carColor item
|
||||
interface CarColorItem {
|
||||
export interface CarColorItem {
|
||||
id: string;
|
||||
name: string;
|
||||
hexCode: string;
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
import React, { createContext, useContext, useState, useEffect, ReactNode } from 'react';
|
||||
import { list } from "@/api/carModels";
|
||||
|
||||
interface CarModelItem {
|
||||
export interface CarModelItem {
|
||||
id: string;
|
||||
name: string;
|
||||
yearStart: string,
|
||||
@ -20,7 +20,7 @@ interface CarModelContextType {
|
||||
const CarModelContext = createContext<CarModelContextType | undefined>(undefined);
|
||||
|
||||
export const CarModelProvider = ({ children }: { children: ReactNode }) => {
|
||||
const [carModel, setCarModel] = useState<any | null>(null);
|
||||
const [carModel, setCarModel] = useState<CarModelItem[] | null>(null);
|
||||
|
||||
const fetchData = async () => {
|
||||
setCarModel(await list());
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
import React, { createContext, useContext, useState, useEffect, ReactNode } from 'react';
|
||||
import { list } from "@/api/customers";
|
||||
|
||||
interface CustomerItem {
|
||||
export interface CustomerItem {
|
||||
id: string;
|
||||
name: string;
|
||||
phone: string;
|
||||
@ -19,7 +19,7 @@ interface CustomerContextType {
|
||||
const CustomerContext = createContext<CustomerContextType | undefined>(undefined);
|
||||
|
||||
export const CustomerProvider = ({ children }: { children: ReactNode }) => {
|
||||
const [customers, setCustomers] = useState<any | null>([]);
|
||||
const [customers, setCustomers] = useState<CustomerItem[] | []>([]);
|
||||
|
||||
const fetchData = async () => {
|
||||
setCustomers(await list());
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
import React, { createContext, useContext, useState, useEffect, ReactNode } from 'react';
|
||||
import { list } from "@/api/engines";
|
||||
|
||||
interface EngineItem {
|
||||
export interface EngineItem {
|
||||
id: string,
|
||||
type: string,
|
||||
powerHR: string,
|
||||
@ -19,7 +19,7 @@ interface EngineContextType {
|
||||
const EngineContext = createContext<EngineContextType | undefined>(undefined);
|
||||
|
||||
export const EngineProvider = ({ children }: { children: ReactNode }) => {
|
||||
const [engine, setEngine] = useState<any | null>(null);
|
||||
const [engine, setEngine] = useState<EngineItem[] | null>(null);
|
||||
|
||||
const fetchData = async () => {
|
||||
setEngine(await list());
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
import React, { createContext, useContext, useState, useEffect, ReactNode } from 'react';
|
||||
import { list } from "@/api/sales";
|
||||
|
||||
interface SaleItem {
|
||||
export interface SaleItem {
|
||||
id: string,
|
||||
date: string,
|
||||
price: string,
|
||||
@ -20,7 +20,7 @@ interface SaleContextType {
|
||||
const SaleContext = createContext<SaleContextType | undefined>(undefined);
|
||||
|
||||
export const SaleProvider = ({ children }: { children: ReactNode }) => {
|
||||
const [sale, setSale] = useState<any | null>(null);
|
||||
const [sale, setSale] = useState<SaleItem[] | null>(null);
|
||||
|
||||
const fetchData = async () => {
|
||||
setSale(await list());
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
import React, { createContext, useContext, useState, useEffect, ReactNode } from 'react';
|
||||
import { list } from "@/api/transmissions";
|
||||
|
||||
interface TransmissionItem {
|
||||
export interface TransmissionItem {
|
||||
id: string,
|
||||
type: string,
|
||||
}
|
||||
@ -17,7 +17,7 @@ interface TransmissionContextType {
|
||||
const TransmissionContext = createContext<TransmissionContextType | undefined>(undefined);
|
||||
|
||||
export const TransmissionProvider = ({ children }: { children: ReactNode }) => {
|
||||
const [transmission, setTransmission] = useState<any | null>(null);
|
||||
const [transmission, setTransmission] = useState<TransmissionItem[] | null>(null);
|
||||
|
||||
const fetchData = async () => {
|
||||
setTransmission(await list());
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
import React, { createContext, useContext, useState, useEffect, ReactNode } from 'react';
|
||||
import { list } from "@/api/trims";
|
||||
|
||||
interface TrimItem {
|
||||
export interface TrimItem {
|
||||
id: string;
|
||||
name: string,
|
||||
price: string,
|
||||
@ -19,7 +19,7 @@ interface TrimContextType {
|
||||
const TrimContext = createContext<TrimContextType | undefined>(undefined);
|
||||
|
||||
export const TrimProvider = ({ children }: { children: ReactNode }) => {
|
||||
const [trim, setTrim] = useState<any | null>(null);
|
||||
const [trim, setTrim] = useState<TrimItem[] | null>(null);
|
||||
|
||||
const fetchData = async () => {
|
||||
setTrim(await list());
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
import {CustomerItem} from "@/api/context/Customer";
|
||||
|
||||
export async function list () {
|
||||
const response = await fetch('/api/v1/customers');
|
||||
return (await response.json()).results.rows;
|
||||
}
|
||||
|
||||
export async function add (params: any) {
|
||||
export async function add (params: CustomerItem) {
|
||||
const response = await fetch('/api/v1/customers', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
@ -14,7 +16,7 @@ export async function add (params: any) {
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
export async function update (params: any) {
|
||||
export async function update (params: CustomerItem) {
|
||||
const response = await fetch('/api/v1/customers', {
|
||||
method: 'PUT',
|
||||
headers: {
|
||||
@ -30,7 +32,7 @@ export async function update (params: any) {
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
export async function remove (params: any) {
|
||||
export async function remove (params: CustomerItem) {
|
||||
const response = await fetch('/api/v1/customers', {
|
||||
method: 'DELETE',
|
||||
headers: {
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
import {EngineItem} from "@/api/context/Engine";
|
||||
|
||||
export async function list () {
|
||||
const response = await fetch('/api/v1/engines');
|
||||
return (await response.json()).results.rows;
|
||||
}
|
||||
|
||||
export async function add (params: any) {
|
||||
export async function add (params: EngineItem) {
|
||||
const response = await fetch('/api/v1/engines', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
@ -14,7 +16,7 @@ export async function add (params: any) {
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
export async function update (params: any) {
|
||||
export async function update (params: EngineItem) {
|
||||
const response = await fetch('/api/v1/engines', {
|
||||
method: 'PUT',
|
||||
headers: {
|
||||
@ -30,7 +32,7 @@ export async function update (params: any) {
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
export async function remove (params: any) {
|
||||
export async function remove (params: EngineItem) {
|
||||
const response = await fetch('/api/v1/engines', {
|
||||
method: 'DELETE',
|
||||
headers: {
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
import {SaleItem} from "@/api/context/Sale";
|
||||
|
||||
export async function list () {
|
||||
const response = await fetch('/api/v1/sales');
|
||||
return (await response.json()).results.rows;
|
||||
}
|
||||
|
||||
export async function add (params: any) {
|
||||
export async function add (params: SaleItem) {
|
||||
const response = await fetch('/api/v1/sales', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
@ -14,7 +16,7 @@ export async function add (params: any) {
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
export async function update (params: any) {
|
||||
export async function update (params: SaleItem) {
|
||||
const response = await fetch('/api/v1/sales', {
|
||||
method: 'PUT',
|
||||
headers: {
|
||||
@ -30,7 +32,7 @@ export async function update (params: any) {
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
export async function remove (params: any) {
|
||||
export async function remove (params: SaleItem) {
|
||||
const response = await fetch('/api/v1/sales', {
|
||||
method: 'DELETE',
|
||||
headers: {
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
import {TransmissionItem} from "@/api/context/Transmission";
|
||||
|
||||
export async function list () {
|
||||
const response = await fetch('/api/v1/transmissions');
|
||||
return (await response.json()).results.rows;
|
||||
}
|
||||
|
||||
export async function add (params: any) {
|
||||
export async function add (params: TransmissionItem) {
|
||||
const response = await fetch('/api/v1/transmissions', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
@ -14,7 +16,7 @@ export async function add (params: any) {
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
export async function update (params: any) {
|
||||
export async function update (params: TransmissionItem) {
|
||||
const response = await fetch('/api/v1/transmissions', {
|
||||
method: 'PUT',
|
||||
headers: {
|
||||
@ -30,7 +32,7 @@ export async function update (params: any) {
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
export async function remove (params: any) {
|
||||
export async function remove (params: TransmissionItem) {
|
||||
const response = await fetch('/api/v1/transmissions', {
|
||||
method: 'DELETE',
|
||||
headers: {
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
import {TrimItem} from "@/api/context/Trim";
|
||||
|
||||
export async function list () {
|
||||
const response = await fetch('/api/v1/trims');
|
||||
return (await response.json()).results.rows;
|
||||
}
|
||||
|
||||
export async function add (params: any) {
|
||||
export async function add (params: TrimItem) {
|
||||
const response = await fetch('/api/v1/trims', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
@ -14,7 +16,7 @@ export async function add (params: any) {
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
export async function update (params: any) {
|
||||
export async function update (params: TrimItem) {
|
||||
const response = await fetch('/api/v1/trims', {
|
||||
method: 'PUT',
|
||||
headers: {
|
||||
@ -30,7 +32,7 @@ export async function update (params: any) {
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
export async function remove (params: any) {
|
||||
export async function remove (params: TrimItem) {
|
||||
const response = await fetch('/api/v1/trims', {
|
||||
method: 'DELETE',
|
||||
headers: {
|
||||
|
||||
@ -1,6 +1,9 @@
|
||||
import './Content.css';
|
||||
import {ReactNode} from "react";
|
||||
|
||||
export default function Content({children}:any) {
|
||||
export default function Content({children}:{
|
||||
children: ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<div className="content">
|
||||
{children}
|
||||
|
||||
@ -1,7 +1,12 @@
|
||||
import React from 'react';
|
||||
import React, { ChangeEvent } from 'react';
|
||||
import './Input.css'
|
||||
|
||||
export function Input({children, name, value, onChange}: any) {
|
||||
export function Input({children, name, value, onChange}: {
|
||||
children?: string;
|
||||
name: string;
|
||||
value: string;
|
||||
onChange: (event: ChangeEvent<HTMLInputElement>) => void;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<label htmlFor={name}>{children}</label>
|
||||
|
||||
@ -1,7 +1,11 @@
|
||||
import React from 'react';
|
||||
import React, {ChangeEvent} from 'react';
|
||||
import './InputColor.css'
|
||||
|
||||
export function InputColor({children, value, onChange, name}: any) {
|
||||
export function InputColor({value, onChange, name}: {
|
||||
name: string;
|
||||
value?: string;
|
||||
onChange: (event: ChangeEvent<HTMLInputElement>) => void;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<input type="color" value={value} name={name} onChange={onChange} className="input__color"/>
|
||||
|
||||
@ -1,8 +1,13 @@
|
||||
import React from 'react';
|
||||
import React, {ChangeEvent} from 'react';
|
||||
import './InputDate.css'
|
||||
import {format} from "date-fns";
|
||||
|
||||
export function InputDate({children, value, onChange, name}: any) {
|
||||
export function InputDate({children, value, onChange, name}: {
|
||||
children?: string;
|
||||
name: string;
|
||||
value: string;
|
||||
onChange: (event: ChangeEvent<HTMLInputElement>) => void;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<label htmlFor={name}>{children}</label>
|
||||
|
||||
@ -1,7 +1,10 @@
|
||||
import './Modal.css';
|
||||
import {useModalContext} from "@/components/Modal/ModalContext";
|
||||
import {ReactNode} from "react";
|
||||
|
||||
export default function Modal({children}:any) {
|
||||
export default function Modal({children}:{
|
||||
children: ReactNode;
|
||||
}) {
|
||||
const { setContentModal } = useModalContext();
|
||||
|
||||
return (
|
||||
|
||||
@ -1,8 +1,11 @@
|
||||
"use client";
|
||||
|
||||
import './NavBar.css';
|
||||
import {ReactNode} from "react";
|
||||
|
||||
export default function NavBar({children}:any) {
|
||||
export default function NavBar({children}:{
|
||||
children: ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<ul>
|
||||
{children}
|
||||
|
||||
@ -1,12 +1,26 @@
|
||||
import React from 'react';
|
||||
import ReactSelect from "react-select";
|
||||
import ReactSelect, { SingleValue } from "react-select";
|
||||
|
||||
export function Select({options, placeholder, value, onChange, name}: any) {
|
||||
interface OptionType {
|
||||
value: string | number;
|
||||
label: string;
|
||||
}
|
||||
|
||||
interface SelectProps {
|
||||
options: OptionType[];
|
||||
placeholder: string;
|
||||
value: string | number | null;
|
||||
onChange: (selectedOption: SingleValue<OptionType>) => void;
|
||||
name: string;
|
||||
}
|
||||
|
||||
|
||||
export function Select({options, placeholder, value, onChange, name}: SelectProps) {
|
||||
return (
|
||||
<>
|
||||
<label htmlFor={name}>{placeholder}</label>
|
||||
<ReactSelect options={options} placeholder={placeholder}
|
||||
value={options.find((option: any) => option.value === value)}
|
||||
value={options.find((option) => option.value === value)}
|
||||
onChange={onChange} name={name}/>
|
||||
</>
|
||||
);
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
import React from 'react';
|
||||
import React, {ReactNode} from 'react';
|
||||
|
||||
export function Row({children}: any) {
|
||||
export function Row({children}: {
|
||||
children: ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<td>{children}</td>
|
||||
);
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
import React from 'react';
|
||||
import React, {ReactNode} from 'react';
|
||||
|
||||
export function Rows({children}: any) {
|
||||
export function Rows({children}: {
|
||||
children: ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<tr>
|
||||
{children}
|
||||
|
||||
@ -1,14 +1,17 @@
|
||||
import React from 'react';
|
||||
import React, {ReactNode} from 'react';
|
||||
import "./Table.css"
|
||||
|
||||
export function Table({ header, children }: any) {
|
||||
export function Table({ header, children }: {
|
||||
header: string[];
|
||||
children: ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<div>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
{
|
||||
header.map((item: any, index: number) => (
|
||||
header.map((item: string, index: number) => (
|
||||
<th key={index}>{item}</th>
|
||||
))
|
||||
}
|
||||
|
||||
@ -5,7 +5,6 @@ import {useModalContext} from "@/components/Modal/ModalContext";
|
||||
import SaleModal from "@/modals/Sale";
|
||||
import {Rows} from "@/components/Table/Rows";
|
||||
import {Row} from "@/components/Table/Row";
|
||||
import CarModelsModal from "@/modals/CarModel";
|
||||
import {remove} from "@/api/sales";
|
||||
import {useSaleContext} from "@/api/context/Sale";
|
||||
import {useCarContext} from "@/api/context/Car";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user