Feat/open comment drawer from comment chip (#187)

* wip

* Can open comment right drawer from company name cell
This commit is contained in:
Lucas Bordeau
2023-06-02 17:51:17 +02:00
committed by GitHub
parent 69c1095055
commit a2fe159c2c
15 changed files with 154 additions and 34 deletions

View File

@ -1,6 +1,8 @@
import { useState } from 'react';
import PersonChip from '../chips/PersonChip';
import { EditableDoubleText } from '../editable-cell/EditableDoubleText';
import { CellCommentChip } from '../comments/CellCommentChip';
import styled from '@emotion/styled';
type OwnProps = {
firstname: string;
@ -8,6 +10,13 @@ type OwnProps = {
onChange: (firstname: string, lastname: string) => void;
};
const StyledDiv = styled.div`
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
`;
export function EditablePeopleFullName({
firstname,
lastname,
@ -26,6 +35,12 @@ export function EditablePeopleFullName({
onChange(firstValue, secondValue);
}
function handleCommentClick(event: React.MouseEvent<HTMLDivElement>) {
event.preventDefault();
event.stopPropagation();
console.log('comment clicked');
}
return (
<EditableDoubleText
firstValue={firstnameValue}
@ -33,7 +48,14 @@ export function EditablePeopleFullName({
firstValuePlaceholder="First name"
secondValuePlaceholder="Last name"
onChange={handleDoubleTextChange}
nonEditModeContent={<PersonChip name={firstname + ' ' + lastname} />}
nonEditModeContent={
<>
<StyledDiv>
<PersonChip name={firstname + ' ' + lastname} />
</StyledDiv>
<CellCommentChip count={12} onClick={handleCommentClick} />
</>
}
/>
);
}