Feature/edit name from show page (#806)
* Enable company name edition from page * Enable editing persons as well * Add styling for titles * Better manage style with inheritance * Add stories for poeple editable fields * Remove failing test * Revert "Remove failing test" This reverts commit 02cdeeba64276a26f93cf4af94f5857e47d36fff. * Fix test * Update name * Fix location * Rename tests * Fix stories
This commit is contained in:
@ -51,8 +51,8 @@ export const EditableFieldNormalModeOuterContainer = styled.div<
|
||||
export const EditableFieldNormalModeInnerContainer = styled.div`
|
||||
align-items: center;
|
||||
color: ${({ theme }) => theme.font.color.primary};
|
||||
font-size: ${({ theme }) => theme.font.size.md};
|
||||
font-weight: ${({ theme }) => theme.font.weight.regular};
|
||||
font-size: 'inherit';
|
||||
font-weight: 'inherit';
|
||||
|
||||
height: fit-content;
|
||||
|
||||
|
||||
@ -0,0 +1,51 @@
|
||||
import { ChangeEvent } from 'react';
|
||||
import styled from '@emotion/styled';
|
||||
|
||||
import { InplaceInputTextEditMode } from '@/ui/inplace-input/components/InplaceInputTextEditMode';
|
||||
|
||||
type OwnProps = {
|
||||
firstValue: string;
|
||||
secondValue: string;
|
||||
firstValuePlaceholder: string;
|
||||
secondValuePlaceholder: string;
|
||||
onChange: (firstValue: string, secondValue: string) => void;
|
||||
};
|
||||
|
||||
const StyledContainer = styled.div`
|
||||
align-items: center;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
& > input:last-child {
|
||||
border-left: 1px solid ${({ theme }) => theme.border.color.medium};
|
||||
padding-left: ${({ theme }) => theme.spacing(2)};
|
||||
}
|
||||
`;
|
||||
|
||||
export function InplaceInputDoubleText({
|
||||
firstValue,
|
||||
secondValue,
|
||||
firstValuePlaceholder,
|
||||
secondValuePlaceholder,
|
||||
onChange,
|
||||
}: OwnProps) {
|
||||
return (
|
||||
<StyledContainer>
|
||||
<InplaceInputTextEditMode
|
||||
autoFocus
|
||||
placeholder={firstValuePlaceholder}
|
||||
value={firstValue}
|
||||
onChange={(event: ChangeEvent<HTMLInputElement>) => {
|
||||
onChange(event.target.value, secondValue);
|
||||
}}
|
||||
/>
|
||||
<InplaceInputTextEditMode
|
||||
placeholder={secondValuePlaceholder}
|
||||
value={secondValue}
|
||||
onChange={(event: ChangeEvent<HTMLInputElement>) => {
|
||||
onChange(firstValue, event.target.value);
|
||||
}}
|
||||
/>
|
||||
</StyledContainer>
|
||||
);
|
||||
}
|
||||
@ -16,6 +16,7 @@ type OwnProps = {
|
||||
logoOrAvatar?: string;
|
||||
title: string;
|
||||
date: string;
|
||||
renderTitleEditComponent?: () => JSX.Element;
|
||||
};
|
||||
|
||||
const StyledShowPageSummaryCard = styled.div`
|
||||
@ -45,7 +46,6 @@ const StyledTitle = styled.div`
|
||||
color: ${({ theme }) => theme.font.color.primary};
|
||||
font-size: ${({ theme }) => theme.font.size.xl};
|
||||
font-weight: ${({ theme }) => theme.font.weight.semiBold};
|
||||
|
||||
max-width: 100%;
|
||||
`;
|
||||
|
||||
@ -65,6 +65,7 @@ export function ShowPageSummaryCard({
|
||||
logoOrAvatar,
|
||||
title,
|
||||
date,
|
||||
renderTitleEditComponent,
|
||||
}: OwnProps) {
|
||||
const beautifiedCreatedAt =
|
||||
date !== '' ? beautifyPastDateRelativeToNow(date) : '';
|
||||
@ -82,7 +83,11 @@ export function ShowPageSummaryCard({
|
||||
/>
|
||||
<StyledInfoContainer>
|
||||
<StyledTitle>
|
||||
<OverflowingTextWithTooltip text={title} />
|
||||
{renderTitleEditComponent ? (
|
||||
renderTitleEditComponent()
|
||||
) : (
|
||||
<OverflowingTextWithTooltip text={title} />
|
||||
)}
|
||||
</StyledTitle>
|
||||
<StyledDate id={dateElementId}>
|
||||
Added {beautifiedCreatedAt} ago
|
||||
|
||||
@ -15,9 +15,8 @@ export const textInputStyle = (props: { theme: ThemeType }) =>
|
||||
border: none;
|
||||
color: ${props.theme.font.color.primary};
|
||||
font-family: ${props.theme.font.family};
|
||||
font-size: ${props.theme.font.size.md};
|
||||
|
||||
font-weight: ${props.theme.font.weight.regular};
|
||||
font-size: inherit;
|
||||
font-weight: inherit;
|
||||
outline: none;
|
||||
padding: ${props.theme.spacing(0)} ${props.theme.spacing(2)};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user