Fix coding style

This commit is contained in:
2023-10-26 16:57:09 +07:00
parent bd407bb933
commit b0703ffdd3
3 changed files with 25 additions and 14 deletions
+7 -5
View File
@@ -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 };
+7 -5
View File
@@ -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 };
+11 -4
View File
@@ -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,
};