refactor(web): move all types into typings folder

This commit is contained in:
Luke
2023-02-15 13:00:09 +01:00
parent 5b4c6b8674
commit 829bec2592
42 changed files with 181 additions and 169 deletions

View File

@@ -5,19 +5,7 @@ import { useNuiEvent } from '../../hooks/useNuiEvent';
import { fetchNui } from '../../utils/fetchNui';
import { useLocales } from '../../providers/LocaleProvider';
import remarkGfm from 'remark-gfm';
export interface AlertProps {
header: string;
content: string;
centered?: boolean;
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
overflow?: boolean;
cancel?: boolean;
labels?: {
cancel?: string;
confirm?: string;
};
}
import type { AlertProps } from '../../typings';
const AlertDialog: React.FC = () => {
const { locale } = useLocales();

View File

@@ -3,18 +3,7 @@ import React from 'react';
import { useNuiEvent } from '../../hooks/useNuiEvent';
import { useLocales } from '../../providers/LocaleProvider';
import { fetchNui } from '../../utils/fetchNui';
import {
IInput,
ICheckbox,
ISelect,
INumber,
ISlider,
IColorInput,
OptionValue,
IDateInput,
ITextarea,
ITimeInput,
} from '../../interfaces/dialog';
import { OptionValue } from '../../typings';
import InputField from './components/fields/input';
import CheckboxField from './components/fields/checkbox';
import SelectField from './components/fields/select';
@@ -25,14 +14,7 @@ import ColorField from './components/fields/color';
import DateField from './components/fields/date';
import TextareaField from './components/fields/textarea';
import TimeField from './components/fields/time';
export interface InputProps {
heading: string;
rows: Array<IInput | ICheckbox | ISelect | INumber | ISlider | IColorInput | IDateInput | ITextarea | ITimeInput>;
options?: {
allowCancel?: boolean;
};
}
import type { InputProps } from '../../typings';
export type FormValues = {
test: {

View File

@@ -1,5 +1,5 @@
import { Checkbox } from '@mantine/core';
import { ICheckbox } from '../../../../interfaces/dialog';
import { ICheckbox } from '../../../../typings/dialog';
import { UseFormRegisterReturn } from 'react-hook-form';
interface Props {

View File

@@ -1,4 +1,4 @@
import { IColorInput } from '../../../../interfaces/dialog';
import { IColorInput } from '../../../../typings/dialog';
import { Control, useController } from 'react-hook-form';
import { FormValues } from '../../InputDialog';
import { ColorInput } from '@mantine/core';

View File

@@ -1,4 +1,4 @@
import { IDateInput } from '../../../../interfaces/dialog';
import { IDateInput } from '../../../../typings/dialog';
import { Control, useController } from 'react-hook-form';
import { FormValues } from '../../InputDialog';
import { DatePicker, DateRangePicker, TimeInput } from '@mantine/dates';

View File

@@ -1,7 +1,7 @@
import { createStyles, PasswordInput, TextInput } from '@mantine/core';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import React from 'react';
import { IInput } from '../../../../interfaces/dialog';
import { IInput } from '../../../../typings/dialog';
import { UseFormRegisterReturn } from 'react-hook-form';
interface Props {

View File

@@ -1,5 +1,5 @@
import { NumberInput } from '@mantine/core';
import { INumber } from '../../../../interfaces/dialog';
import { INumber } from '../../../../typings/dialog';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { Control, useController } from 'react-hook-form';
import { FormValues } from '../../InputDialog';

View File

@@ -1,5 +1,5 @@
import { MultiSelect, Select } from '@mantine/core';
import { ISelect } from '../../../../interfaces/dialog';
import { ISelect } from '../../../../typings/dialog';
import { Control, useController } from 'react-hook-form';
import { FormValues } from '../../InputDialog';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';

View File

@@ -1,5 +1,5 @@
import { Box, Slider, Text } from '@mantine/core';
import { ISlider } from '../../../../interfaces/dialog';
import { ISlider } from '../../../../typings/dialog';
import { Control, useController } from 'react-hook-form';
import { FormValues } from '../../InputDialog';

View File

@@ -1,6 +1,6 @@
import { Textarea } from '@mantine/core';
import { UseFormRegisterReturn } from 'react-hook-form';
import { ITextarea } from '../../../../interfaces/dialog';
import { ITextarea } from '../../../../typings/dialog';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import React from 'react';

View File

@@ -1,7 +1,7 @@
import { TimeInput } from '@mantine/dates';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { Control, useController } from 'react-hook-form';
import { ITimeInput } from '../../../../interfaces/dialog';
import { ITimeInput } from '../../../../typings/dialog';
import { FormValues } from '../../InputDialog';
interface Props {