File tree 1 file changed +22
-1
lines changed
components/dashboard/src/components
1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change 4
4
* See License.AGPL.txt in the project root for license information.
5
5
*/
6
6
7
+ import { useState } from "react" ;
8
+
7
9
export interface SelectableCardSolidProps {
8
10
title : string ;
9
11
selected : boolean ;
@@ -13,9 +15,21 @@ export interface SelectableCardSolidProps {
13
15
}
14
16
15
17
function SelectableCardSolid ( props : SelectableCardSolidProps ) {
18
+ const [ isFocused , setIsFocused ] = useState ( false ) ;
19
+
20
+ const handleFocus = ( ) => {
21
+ setIsFocused ( true ) ;
22
+ } ;
23
+
24
+ const handleBlur = ( ) => {
25
+ setIsFocused ( false ) ;
26
+ } ;
27
+
16
28
return (
17
29
< div
18
30
className = { `rounded-xl px-3 py-3 flex flex-col cursor-pointer group transition ease-in-out ${
31
+ isFocused ? "ring-2 ring-blue-500" : ""
32
+ } ${
19
33
props . selected
20
34
? "bg-gray-800 dark:bg-gray-100"
21
35
: "bg-gray-100 dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-700"
@@ -31,7 +45,14 @@ function SelectableCardSolid(props: SelectableCardSolidProps) {
31
45
>
32
46
{ props . title }
33
47
</ p >
34
- < input className = "opacity-0" type = "radio" checked = { props . selected } />
48
+ < input
49
+ className = "opacity-0"
50
+ type = "radio"
51
+ checked = { props . selected }
52
+ onFocus = { handleFocus }
53
+ onBlur = { handleBlur }
54
+ aria-label = { props . title }
55
+ />
35
56
</ div >
36
57
{ props . children }
37
58
</ div >
You can’t perform that action at this time.
0 commit comments