fix: make course cover control actionable
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import React, { useState, useEffect } from 'react';
|
import React, { useState, useEffect, useRef } from 'react';
|
||||||
import {
|
import {
|
||||||
Plus,
|
Plus,
|
||||||
Settings,
|
Settings,
|
||||||
@@ -44,6 +44,7 @@ const CourseModal: React.FC<{
|
|||||||
const [category, setCategory] = useState('');
|
const [category, setCategory] = useState('');
|
||||||
const [status, setStatus] = useState<Course['status']>('draft');
|
const [status, setStatus] = useState<Course['status']>('draft');
|
||||||
const [thumbnailPreview, setThumbnailPreview] = useState<string>('');
|
const [thumbnailPreview, setThumbnailPreview] = useState<string>('');
|
||||||
|
const coverUrlRef = useRef<HTMLInputElement>(null);
|
||||||
const [categories, setCategories] = useState<string[]>([]);
|
const [categories, setCategories] = useState<string[]>([]);
|
||||||
|
|
||||||
// Lesson Management
|
// Lesson Management
|
||||||
@@ -344,6 +345,11 @@ const CourseModal: React.FC<{
|
|||||||
<div>
|
<div>
|
||||||
<label className="text-xs text-gray-400 uppercase font-bold tracking-wider mb-2 block">Imagem de Capa (16:9)</label>
|
<label className="text-xs text-gray-400 uppercase font-bold tracking-wider mb-2 block">Imagem de Capa (16:9)</label>
|
||||||
<div
|
<div
|
||||||
|
onClick={() => coverUrlRef.current?.focus()}
|
||||||
|
onKeyDown={(event) => { if (event.key === 'Enter' || event.key === ' ') coverUrlRef.current?.focus(); }}
|
||||||
|
role="button"
|
||||||
|
tabIndex={0}
|
||||||
|
aria-label="Informar URL da imagem de capa"
|
||||||
className="w-full aspect-video rounded-2xl border-2 border-dashed border-white/10 bg-black/40 flex flex-col items-center justify-center cursor-pointer hover:border-orange-500/50 transition-colors relative overflow-hidden group"
|
className="w-full aspect-video rounded-2xl border-2 border-dashed border-white/10 bg-black/40 flex flex-col items-center justify-center cursor-pointer hover:border-orange-500/50 transition-colors relative overflow-hidden group"
|
||||||
>
|
>
|
||||||
{thumbnailPreview ? (
|
{thumbnailPreview ? (
|
||||||
@@ -356,15 +362,16 @@ const CourseModal: React.FC<{
|
|||||||
) : (
|
) : (
|
||||||
<div className="text-center p-6">
|
<div className="text-center p-6">
|
||||||
<ImageIcon className="w-10 h-10 text-orange-400/60 mx-auto mb-2" />
|
<ImageIcon className="w-10 h-10 text-orange-400/60 mx-auto mb-2" />
|
||||||
<p className="text-gray-300 text-xs font-medium">Add a hosted cover image URL below</p>
|
<p className="text-gray-300 text-xs font-medium">Clique para informar a URL da imagem de capa</p>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<input
|
<input
|
||||||
|
ref={coverUrlRef}
|
||||||
type="url"
|
type="url"
|
||||||
value={thumbnailPreview}
|
value={thumbnailPreview}
|
||||||
onChange={(event) => setThumbnailPreview(event.target.value)}
|
onChange={(event) => setThumbnailPreview(event.target.value)}
|
||||||
placeholder="Hosted cover image URL"
|
placeholder="Cole a URL pública da imagem de capa"
|
||||||
className="w-full mt-2 bg-black/50 text-white text-xs border border-white/10 rounded-xl px-4 py-3 focus:outline-none focus:border-orange-500/50"
|
className="w-full mt-2 bg-black/50 text-white text-xs border border-white/10 rounded-xl px-4 py-3 focus:outline-none focus:border-orange-500/50"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user