diff --git a/src/Containers/Chair/Chair.tsx b/src/Containers/Chair/Chair.tsx index 1050a6bc..623a3917 100644 --- a/src/Containers/Chair/Chair.tsx +++ b/src/Containers/Chair/Chair.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useState } from 'react'; import styled, { css, useTheme } from 'styled-components'; import { Eye, EyeSlash } from '@styled-icons/bootstrap'; @@ -70,6 +70,8 @@ export interface IChair { chairIndex: number, selectedIndex: number, ) => void; + + } /** @@ -86,9 +88,21 @@ export const Chair: React.FC = ({ tableIndex = -1, chairIndex = -1, selectedIndex = -1, + + onChairClick, ...props -}) => { +}):React.ReactElement => { + /** + * Use useState to change state of isFocusedActive and highlite + * the chair. + */ + const [isFocusedActive, setIsFocusedActive] = useState(false); + + onChairClick =() => { + setIsFocusedActive(true) + } + /** * Returns a JSX.Element for the Chair with RoundChair styles * @returns {JSX.Element} @@ -101,6 +115,8 @@ export const Chair: React.FC = ({ isSeated={isSeated} tableUse={tableUse} isVisible={isVisible} + tabIndex={0} + isFocusedActive={isFocusedActive} > {getChairText()} @@ -110,7 +126,6 @@ export const Chair: React.FC = ({ /** * Returns a JSX.Element for the Chair with the correct styles based on position * @returns {JSX.Element} - * */ const getPositionChair: getPositionChairType = () => (
@@ -120,6 +135,8 @@ export const Chair: React.FC = ({ position={position} tableUse={tableUse} isVisible={isVisible} + tabIndex={0} + isFocusedActive={isFocusedActive} > {getChairText()} @@ -183,18 +200,18 @@ export const Chair: React.FC = ({ onChairClick(tableIndex, chairIndex, selectedIndex); }; - if (tableUse === 'TableForEditCanvas') { - return ( - - {isRound ? getRoundChair() : getPositionChair()} - - ); - } + + return ( + + {isRound ? getRoundChair() : getPositionChair()} + + ); + return isRound ? getRoundChair() : getPositionChair(); }; @@ -399,6 +416,7 @@ interface IBaseChair { isSeated: boolean; tableUse: tableUseTypes; isVisible: boolean; + isFocusedActive: boolean; } const BaseChair = styled.div` @@ -422,6 +440,10 @@ const RoundChair = styled(BaseChair)>` relativeSize * BASE_BORDER_WIDTH_FOR_ROUND_CHAIR }px solid black;`; }} + + box-shadow: ${({ isFocusedActive + }) => (isFocusedActive && + '0 0 0 2px')}; `; const RectangleChair = styled(BaseChair)< @@ -434,6 +456,10 @@ const RectangleChair = styled(BaseChair)< left: VerticalChairStyle, right: VerticalChairStyle, }[position])}; + + box-shadow: ${({ isFocusedActive + }) => (isFocusedActive && + '0 0 0 2px')}; `; const RectangleChairText = styled.div<