Skip to content
This repository has been archived by the owner on Feb 23, 2022. It is now read-only.

CEM-2507_Chair Highlight #373

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/Containers/Chair/Chair.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ export interface IChair {
chairIndex: number,
selectedIndex: number,
) => void;

/**
* Number for atribute tabindex to make possible to focus on the chair
*/
tabIndex: number;
Yurii-Zhuk marked this conversation as resolved.
Show resolved Hide resolved
}

/**
Expand All @@ -86,6 +91,7 @@ export const Chair: React.FC<IChair> = ({
tableIndex = -1,
chairIndex = -1,
selectedIndex = -1,
tabIndex= 1,
onChairClick,
...props
}) => {
Expand All @@ -101,6 +107,8 @@ export const Chair: React.FC<IChair> = ({
isSeated={isSeated}
tableUse={tableUse}
isVisible={isVisible}
isFocusActive={true}
tabIndex={1}
Yurii-Zhuk marked this conversation as resolved.
Show resolved Hide resolved
>
{getChairText()}
</RoundChair>
Expand All @@ -120,6 +128,8 @@ export const Chair: React.FC<IChair> = ({
position={position}
tableUse={tableUse}
isVisible={isVisible}
isFocusActive={true}
tabIndex={1}
>
{getChairText()}
</RectangleChair>
Expand Down Expand Up @@ -399,6 +409,7 @@ interface IBaseChair {
isSeated: boolean;
tableUse: tableUseTypes;
isVisible: boolean;
isFocusActive: boolean;
}

const BaseChair = styled.div<IBaseChair>`
Expand All @@ -407,6 +418,10 @@ const BaseChair = styled.div<IBaseChair>`
isVisible,
)};
background-color: ${getChairColor(isSeated, tableUse, isVisible)};`}
cursor: pointer;
&:focus {
Yurii-Zhuk marked this conversation as resolved.
Show resolved Hide resolved
box-shadow: ${({ isFocusActive }) => (isFocusActive ? '0 0 0 2px' : '')};
}
`;

const RoundChair = styled(BaseChair)<Pick<IChair, 'relativeSize'>>`
Expand Down
15 changes: 15 additions & 0 deletions src/Containers/CircleTable/CircleTable.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ FourTopTable.args = {
chairIndex: 0,
tableIndex: 0,
selectedIndex: 3,
tabIndex: 1,
onChairClick: handleOnChairClick,
},
{
Expand All @@ -68,6 +69,7 @@ FourTopTable.args = {
chairIndex: 0,
tableIndex: 0,
selectedIndex: 3,
tabIndex: 1,
onChairClick: handleOnChairClick,
},
{
Expand All @@ -81,6 +83,7 @@ FourTopTable.args = {
chairIndex: 0,
tableIndex: 0,
selectedIndex: 3,
tabIndex: 1,
onChairClick: handleOnChairClick,
},
{
Expand All @@ -94,6 +97,7 @@ FourTopTable.args = {
chairIndex: 0,
tableIndex: 0,
selectedIndex: 3,
tabIndex: 1,
onChairClick: handleOnChairClick,
},
{
Expand All @@ -107,6 +111,7 @@ FourTopTable.args = {
chairIndex: 0,
tableIndex: 0,
selectedIndex: 3,
tabIndex: 1,
onChairClick: handleOnChairClick,
},
{
Expand All @@ -120,6 +125,7 @@ FourTopTable.args = {
chairIndex: 0,
tableIndex: 0,
selectedIndex: 3,
tabIndex: 1,
onChairClick: handleOnChairClick,
},
{
Expand All @@ -133,6 +139,7 @@ FourTopTable.args = {
chairIndex: 0,
tableIndex: 0,
selectedIndex: 3,
tabIndex: 1,
onChairClick: handleOnChairClick,
},
{
Expand All @@ -146,6 +153,7 @@ FourTopTable.args = {
chairIndex: 0,
tableIndex: 0,
selectedIndex: 3,
tabIndex: 1,
onChairClick: handleOnChairClick,
},
{
Expand All @@ -159,6 +167,7 @@ FourTopTable.args = {
chairIndex: 0,
tableIndex: 0,
selectedIndex: 3,
tabIndex: 1,
onChairClick: handleOnChairClick,
},
],
Expand Down Expand Up @@ -188,6 +197,7 @@ TableForEditDraggableCanvas.args = {
chairIndex: 1,
tableIndex: 2,
selectedIndex: 3,
tabIndex: 1,
onChairClick: handleOnChairClick,
},
{
Expand All @@ -201,6 +211,7 @@ TableForEditDraggableCanvas.args = {
chairIndex: 1,
tableIndex: 2,
selectedIndex: 3,
tabIndex: 1,
onChairClick: handleOnChairClick,
},
{
Expand All @@ -214,6 +225,7 @@ TableForEditDraggableCanvas.args = {
chairIndex: 2,
tableIndex: 2,
selectedIndex: 3,
tabIndex: 1,
onChairClick: handleOnChairClick,
},
{
Expand All @@ -227,6 +239,7 @@ TableForEditDraggableCanvas.args = {
chairIndex: 3,
tableIndex: 2,
selectedIndex: 3,
tabIndex: 1,
onChairClick: handleOnChairClick,
},
{
Expand All @@ -240,6 +253,7 @@ TableForEditDraggableCanvas.args = {
chairIndex: 4,
tableIndex: 2,
selectedIndex: 3,
tabIndex: 1,
onChairClick: handleOnChairClick,
},
{
Expand All @@ -253,6 +267,7 @@ TableForEditDraggableCanvas.args = {
chairIndex: 5,
tableIndex: 2,
selectedIndex: 3,
tabIndex: 1,
onChairClick: handleOnChairClick,
},
],
Expand Down
1 change: 1 addition & 0 deletions src/Containers/CircleTable/CircleTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ export const CircleTable: React.FC<ICircleTable> = ({
chairIndex={index}
selectedIndex={selectedIndex}
onChairClick={onChairClick}
tabIndex={1}
/>
</ChairWrapper>
));
Expand Down
26 changes: 26 additions & 0 deletions src/Containers/SquareTable/SquareTable.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ SevenTopSquareTable.args = {
chairIndex: 4,
tableIndex: 2,
selectedIndex: 3,
tabIndex: 1,
onChairClick: handleOnChairClick,
},
{
Expand All @@ -66,6 +67,7 @@ SevenTopSquareTable.args = {
chairIndex: 4,
tableIndex: 2,
selectedIndex: 3,
tabIndex: 1,
onChairClick: handleOnChairClick,
},
{
Expand All @@ -78,6 +80,7 @@ SevenTopSquareTable.args = {
chairIndex: 4,
tableIndex: 2,
selectedIndex: 3,
tabIndex: 1,
onChairClick: handleOnChairClick,
},
{
Expand All @@ -90,6 +93,7 @@ SevenTopSquareTable.args = {
chairIndex: 4,
tableIndex: 2,
selectedIndex: 3,
tabIndex: 1,
onChairClick: handleOnChairClick,
},
{
Expand All @@ -102,6 +106,7 @@ SevenTopSquareTable.args = {
chairIndex: 4,
tableIndex: 2,
selectedIndex: 3,
tabIndex: 1,
onChairClick: handleOnChairClick,
},
{
Expand All @@ -114,6 +119,7 @@ SevenTopSquareTable.args = {
chairIndex: 4,
tableIndex: 2,
selectedIndex: 3,
tabIndex: 1,
onChairClick: handleOnChairClick,
},
{
Expand All @@ -126,6 +132,7 @@ SevenTopSquareTable.args = {
chairIndex: 4,
tableIndex: 2,
selectedIndex: 3,
tabIndex: 1,
onChairClick: handleOnChairClick,
},
{
Expand All @@ -138,6 +145,7 @@ SevenTopSquareTable.args = {
chairIndex: 4,
tableIndex: 2,
selectedIndex: 3,
tabIndex: 1,
onChairClick: handleOnChairClick,
},
],
Expand Down Expand Up @@ -167,6 +175,7 @@ EightTopVertRectangleTable.args = {
chairIndex: 4,
tableIndex: 2,
selectedIndex: 3,
tabIndex: 1,
onChairClick: handleOnChairClick,
},
{
Expand All @@ -179,6 +188,7 @@ EightTopVertRectangleTable.args = {
chairIndex: 4,
tableIndex: 2,
selectedIndex: 3,
tabIndex: 1,
onChairClick: handleOnChairClick,
},
{
Expand All @@ -191,6 +201,7 @@ EightTopVertRectangleTable.args = {
chairIndex: 4,
tableIndex: 2,
selectedIndex: 3,
tabIndex: 1,
onChairClick: handleOnChairClick,
},
{
Expand All @@ -203,6 +214,7 @@ EightTopVertRectangleTable.args = {
chairIndex: 4,
tableIndex: 2,
selectedIndex: 3,
tabIndex: 1,
onChairClick: handleOnChairClick,
},
{
Expand All @@ -215,6 +227,7 @@ EightTopVertRectangleTable.args = {
chairIndex: 4,
tableIndex: 2,
selectedIndex: 3,
tabIndex: 1,
onChairClick: handleOnChairClick,
},
{
Expand All @@ -227,6 +240,7 @@ EightTopVertRectangleTable.args = {
chairIndex: 4,
tableIndex: 2,
selectedIndex: 3,
tabIndex: 1,
onChairClick: handleOnChairClick,
},
{
Expand All @@ -239,6 +253,7 @@ EightTopVertRectangleTable.args = {
chairIndex: 4,
tableIndex: 2,
selectedIndex: 3,
tabIndex: 1,
onChairClick: handleOnChairClick,
},
{
Expand All @@ -251,6 +266,7 @@ EightTopVertRectangleTable.args = {
chairIndex: 4,
tableIndex: 2,
selectedIndex: 3,
tabIndex: 1,
onChairClick: handleOnChairClick,
},
],
Expand Down Expand Up @@ -280,6 +296,7 @@ SixTopHorizontalRectangleTable.args = {
chairIndex: 4,
tableIndex: 2,
selectedIndex: 3,
tabIndex: 1,
onChairClick: handleOnChairClick,
},
{
Expand All @@ -292,6 +309,7 @@ SixTopHorizontalRectangleTable.args = {
chairIndex: 4,
tableIndex: 2,
selectedIndex: 3,
tabIndex: 1,
onChairClick: handleOnChairClick,
},
{
Expand All @@ -304,6 +322,7 @@ SixTopHorizontalRectangleTable.args = {
chairIndex: 4,
tableIndex: 2,
selectedIndex: 3,
tabIndex: 1,
onChairClick: handleOnChairClick,
},
{
Expand All @@ -316,6 +335,7 @@ SixTopHorizontalRectangleTable.args = {
chairIndex: 4,
tableIndex: 2,
selectedIndex: 3,
tabIndex: 1,
onChairClick: handleOnChairClick,
},
{
Expand All @@ -328,6 +348,7 @@ SixTopHorizontalRectangleTable.args = {
chairIndex: 4,
tableIndex: 2,
selectedIndex: 3,
tabIndex: 1,
onChairClick: handleOnChairClick,
},
{
Expand All @@ -340,6 +361,7 @@ SixTopHorizontalRectangleTable.args = {
chairIndex: 4,
tableIndex: 2,
selectedIndex: 3,
tabIndex: 1,
onChairClick: handleOnChairClick,
},
],
Expand Down Expand Up @@ -369,6 +391,7 @@ SquareTableEditPage.args = {
chairIndex: 0,
tableIndex: 3,
selectedIndex: 3,
tabIndex: 1,
onChairClick: handleOnChairClick,
},
{
Expand All @@ -381,6 +404,7 @@ SquareTableEditPage.args = {
chairIndex: 1,
tableIndex: 3,
selectedIndex: 3,
tabIndex: 1,
onChairClick: handleOnChairClick,
},
{
Expand All @@ -393,6 +417,7 @@ SquareTableEditPage.args = {
chairIndex: 5,
tableIndex: 3,
selectedIndex: 3,
tabIndex: 1,
onChairClick: handleOnChairClick,
},
{
Expand All @@ -405,6 +430,7 @@ SquareTableEditPage.args = {
chairIndex: 5,
tableIndex: 3,
selectedIndex: 3,
tabIndex: 1,
onChairClick: handleOnChairClick,
},
],
Expand Down
Loading