27 lines
872 B
TypeScript
27 lines
872 B
TypeScript
// * Other
|
|
import SimpleString from "@/back/Components/Inputs/SimpleString";
|
|
import str from "@/hooks/use-string";
|
|
import useTrans from "@/hooks/use-translations";
|
|
|
|
type SimpleYoutubeIdProps = {
|
|
className?: string;
|
|
name: string;
|
|
value?: string;
|
|
id?: string;
|
|
required?: boolean;
|
|
disabled?: boolean;
|
|
parentErrors?: Record<string, string> | null;
|
|
// eslint-disable-next-line no-unused-vars
|
|
setData: (name: string, value: string) => void;
|
|
};
|
|
|
|
export default function SimpleYoutubeId(props: SimpleYoutubeIdProps) {
|
|
const pattern = "^[0-9A-Za-z_\\-]{10}[048AEIMQUYcgkosw]$";
|
|
const label = str(useTrans("validation.custom.youtube_id"))
|
|
.ucFirst()
|
|
.value();
|
|
const localProps = { pattern, label, ...props };
|
|
|
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
return <SimpleString {...localProps} />;
|
|
}
|