File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed
components/dashboard/src/components Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change 44 * See License.AGPL.txt in the project root for license information.
55 */
66
7+ import { useState } from "react" ;
8+
79export interface SelectableCardSolidProps {
810 title : string ;
911 selected : boolean ;
@@ -13,9 +15,21 @@ export interface SelectableCardSolidProps {
1315}
1416
1517function 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+
1628 return (
1729 < div
1830 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+ } ${
1933 props . selected
2034 ? "bg-gray-800 dark:bg-gray-100"
2135 : "bg-gray-100 dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-700"
@@ -31,7 +45,14 @@ function SelectableCardSolid(props: SelectableCardSolidProps) {
3145 >
3246 { props . title }
3347 </ 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+ />
3556 </ div >
3657 { props . children }
3758 </ div >
You can’t perform that action at this time.
0 commit comments