Remove unused components and models for improved maintainability
- Deleted redundant components (`AddActionButton`, `AlertBox`, `AlertStack`, `BackButton`, `CancelButton`, and `CollapsableArea`) and related files. - Removed unused models (`Book`, `BookSerie`, `BookTables`, `Character`, and `Chapter`) to reduce codebase clutter. - Updated project structure and references to reflect these removals.
This commit is contained in:
@@ -1,12 +1,26 @@
|
||||
import {ChangeEvent} from "react";
|
||||
import {SelectBoxProps} from "@/shared/interface";
|
||||
import React, {ChangeEvent} from "react";
|
||||
import {useTranslations} from '@/lib/i18n';
|
||||
|
||||
export interface SelectBoxProps {
|
||||
label: string;
|
||||
value: string;
|
||||
}
|
||||
|
||||
type InputSize = 'sm' | 'md' | 'lg';
|
||||
const sizeClasses: Record<InputSize, string> = {
|
||||
sm: 'px-3 py-1.5 text-xs rounded-lg',
|
||||
md: 'px-4 py-2.5 text-sm rounded-xl',
|
||||
lg: 'px-5 py-3 text-base rounded-xl',
|
||||
};
|
||||
|
||||
export interface SelectBoxFormProps {
|
||||
onChangeCallBack: (event: ChangeEvent<HTMLSelectElement>) => void,
|
||||
data: SelectBoxProps[],
|
||||
defaultValue: string | null | undefined,
|
||||
placeholder?: string,
|
||||
disabled?: boolean
|
||||
disabled?: boolean,
|
||||
size?: InputSize,
|
||||
translate?: boolean
|
||||
}
|
||||
|
||||
export default function SelectBox(
|
||||
@@ -15,26 +29,24 @@ export default function SelectBox(
|
||||
data,
|
||||
defaultValue,
|
||||
placeholder,
|
||||
disabled
|
||||
disabled,
|
||||
size = 'md',
|
||||
translate = false
|
||||
}: SelectBoxFormProps) {
|
||||
const t = useTranslations();
|
||||
return (
|
||||
<select
|
||||
onChange={onChangeCallBack}
|
||||
disabled={disabled}
|
||||
key={defaultValue || 'placeholder'}
|
||||
defaultValue={defaultValue || '0'}
|
||||
className={`w-full text-text-primary bg-secondary/50 hover:bg-secondary px-4 py-2.5 rounded-xl
|
||||
border border-secondary/50
|
||||
focus:border-primary focus:ring-4 focus:ring-primary/20 focus:bg-secondary
|
||||
hover:border-secondary
|
||||
outline-none transition-all duration-200 cursor-pointer
|
||||
${disabled ? 'opacity-50 cursor-not-allowed' : ''}`}
|
||||
className={`input-base ${sizeClasses[size]}`}
|
||||
>
|
||||
{placeholder && <option value={'0'}>{placeholder}</option>}
|
||||
{
|
||||
data.map((item: SelectBoxProps) => (
|
||||
<option key={item.value} value={item.value} className="bg-tertiary text-text-primary">
|
||||
{item.label}
|
||||
{translate ? t(item.label) : item.label}
|
||||
</option>
|
||||
))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user