mirror of
https://github.com/Nezumi-2711/react-training.git
synced 2026-09-22 20:01:59 +00:00
Fix coding style
This commit is contained in:
@@ -1,28 +1,30 @@
|
|||||||
export interface IMenusContext {
|
interface IMenusContext {
|
||||||
openId?: string;
|
openId?: string;
|
||||||
close?: () => void;
|
close?: () => void;
|
||||||
open?: React.Dispatch<React.SetStateAction<string>>;
|
open?: React.Dispatch<React.SetStateAction<string>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IButton {
|
interface IButton {
|
||||||
children?: string;
|
children?: string;
|
||||||
icon?: JSX.Element;
|
icon?: JSX.Element;
|
||||||
onClick?: () => void;
|
onClick?: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ITable {
|
interface ITable {
|
||||||
columns?: string;
|
columns?: string;
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ITableBody<T> {
|
interface ITableBody<T> {
|
||||||
data?: T[];
|
data?: T[];
|
||||||
render?: (value: T) => JSX.Element;
|
render?: (value: T) => JSX.Element;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IDialogProps {
|
interface IDialogProps {
|
||||||
title?: string;
|
title?: string;
|
||||||
children?: JSX.Element[] | JSX.Element;
|
children?: JSX.Element[] | JSX.Element;
|
||||||
onClose?: () => void;
|
onClose?: () => void;
|
||||||
ref?: React.MutableRefObject<HTMLDialogElement | undefined>;
|
ref?: React.MutableRefObject<HTMLDialogElement | undefined>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type { IMenusContext, IButton, ITable, ITableBody, IDialogProps };
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
export type TUser = {
|
type TUser = {
|
||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
identifiedCode: string;
|
identifiedCode: string;
|
||||||
@@ -7,20 +7,20 @@ export type TUser = {
|
|||||||
roomId: string;
|
roomId: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type TStateSchema = {
|
type TStateSchema = {
|
||||||
[key: string]: {
|
[key: string]: {
|
||||||
value?: string;
|
value?: string;
|
||||||
error?: string;
|
error?: string;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export type TKeyValue = {
|
type TKeyValue = {
|
||||||
[key: string]: string | undefined | boolean;
|
[key: string]: string | undefined | boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type TPropValues = 'value' | 'error' | boolean;
|
type TPropValues = 'value' | 'error' | boolean;
|
||||||
|
|
||||||
export type TValidator = {
|
type TValidator = {
|
||||||
[key: string]: {
|
[key: string]: {
|
||||||
required?: boolean;
|
required?: boolean;
|
||||||
validator?: {
|
validator?: {
|
||||||
@@ -29,3 +29,5 @@ export type TValidator = {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type { TUser, TStateSchema, TKeyValue, TPropValues, TValidator };
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { TKeyValue, TPropValues, TStateSchema } from '../globals/types';
|
import { TKeyValue, TPropValues, TStateSchema } from '../globals/types';
|
||||||
|
|
||||||
export const VALUE = 'value';
|
const VALUE = 'value';
|
||||||
export const ERROR = 'error';
|
const ERROR = 'error';
|
||||||
export const REQUIRED_FIELD_ERROR = 'This is required field';
|
const REQUIRED_FIELD_ERROR = 'This is required field';
|
||||||
|
|
||||||
function isBool(value: unknown) {
|
function isBool(value: unknown) {
|
||||||
return typeof value === 'boolean';
|
return typeof value === 'boolean';
|
||||||
@@ -27,4 +27,11 @@ const getPropValues = (stateSchema: TStateSchema, prop?: TPropValues) => {
|
|||||||
}, {} as TKeyValue);
|
}, {} as TKeyValue);
|
||||||
};
|
};
|
||||||
|
|
||||||
export { isObject, isRequired, getPropValues };
|
export {
|
||||||
|
isObject,
|
||||||
|
isRequired,
|
||||||
|
getPropValues,
|
||||||
|
VALUE,
|
||||||
|
ERROR,
|
||||||
|
REQUIRED_FIELD_ERROR,
|
||||||
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user