Skip to content
This repository was archived by the owner on Feb 23, 2022. It is now read-only.
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cheapreats/react-ui",
"version": "2.4.38",
"version": "2.4.39",
"description": "React UI library for CheaprEats",
"main": "./dist/index.js",
"module": "./dist/index.es.js",
Expand Down
16 changes: 16 additions & 0 deletions src/Containers/AdvancedChair/AdvancedChair.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from 'react';
import { Meta, Story } from '@storybook/react';
import { AdvancedChair, IAdvancedChair } from './AdvancedChair';
import { createStoryTitle } from '../../Constants';

export default {
title: createStoryTitle('AdvancedChair'),
component: AdvancedChair,
} as Meta;

const Template: Story<IAdvancedChair> = (args) => <AdvancedChair {...args}/>;

export const VacantChair = Template.bind({});
VacantChair.args = {

};
90 changes: 90 additions & 0 deletions src/Containers/AdvancedChair/AdvancedChair.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import React from 'react';
import styled from "styled-components";

type Position = 'top' | 'bottom' | 'left' | 'right';

type tableUseTypes =
| 'AddTableButton'
| 'TableForEditCanvas'
| 'TableForManagement';

export interface IAdvancedChair extends React.HTMLAttributes<HTMLDivElement> {
position: Position;
isSeated: boolean;
occupiedBy: string;
isVisible: boolean;
relativeSize: number;
tableUse: tableUseTypes;
tableIndex: number;
chairIndex: number;
selectedIndex: number;
onChairClick: (
parentTableIndex: number,
chairIndex: number,
selectedIndex: number,
) => void;
}

export const AdvancedChair: React.FC<IAdvancedChair> = ({
position = 'top',
isSeated = false,
occupiedBy = '',
isVisible = true,
relativeSize = 1.0,
tableUse = 'TableForManagement',
tableIndex = -1,
chairIndex = -1,
selectedIndex = -1,
onChairClick,
...props
}) => {
return (
<div{...props}>
<ChairBody>
<BackOfChair/>
<ChairSeat/>
<TopChairLeg/>
<BottomChairLeg/>
</ChairBody>
</div>
)
}

const ChairBody = styled.div`
color: ${({ theme }) => theme.colors.background};
display: grid;
grid-template-columns: 7px 21px 4px;
grid-template-rows: 2px 3px 5px 12px 5px 3px 2px;
grid-template-areas:
"back . ."
"back seat ."
"back seat firstleg"
"back seat ."
"back seat secondleg"
"back seat ."
"back . ."
`;

const BackOfChair = styled.div`
grid-area: back;
border-radius: 1px 3px 3px 1px;
background: linear-gradient(to right, #6495ED, #adbcf9);
`;

const ChairSeat = styled.div`
grid-area: seat;
border-radius: 0px 3px 3px 0px;
background: linear-gradient(to right, #6495ED, #adbcf9);
`;

const TopChairLeg = styled.div`
grid-area: firstleg;
border-radius: 0px 3px 3px 0px;
background: #6495ED;
`;

const BottomChairLeg = styled.div`
grid-area: secondleg;
border-radius: 0px 3px 3px 0px;
background: #6495ED;
`;