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