Skip to content

Commit

Permalink
Stateless implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
microbit-robert committed Nov 18, 2024
1 parent 9936711 commit bfc291b
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/components/NewPageChoice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
IconButton,
Stack,
} from "@chakra-ui/react";
import { ReactElement, ReactNode, useCallback, useState } from "react";
import { ReactElement, ReactNode, useCallback } from "react";

interface NewPageChoice extends BoxProps {
children: ReactNode;
Expand All @@ -29,9 +29,8 @@ const NewPageChoice = ({
onClick();
}
}, [disabled, onClick]);
const [isFocused, setIsFocused] = useState(false);
return (
<Box boxShadow="lg" flex="1">
<Box boxShadow="lg" flex="1" role="group">
<HStack
spacing={0}
borderRadius="md"
Expand All @@ -46,8 +45,9 @@ const NewPageChoice = ({
_hover={{
bgColor: disabled ? undefined : "brand.50",
}}
boxShadow={isFocused ? "outline" : "none"}
role="group"
_groupFocusWithin={{
boxShadow: "outline",
}}
{...props}
>
<Stack as="section" py={5} px={5} minH={40} flex="1 1 auto">
Expand All @@ -73,9 +73,6 @@ const NewPageChoice = ({
_focusVisible={{
boxShadow: "none",
}}
onFocus={() => setIsFocused(true)}
onBlur={() => setIsFocused(false)}
boxShadow="none"
_hover={{
bgColor: "brand.700",
}}
Expand Down

0 comments on commit bfc291b

Please sign in to comment.