diff --git a/front/src/modules/comments/components/CellCommentChip.tsx b/front/src/modules/comments/components/CellCommentChip.tsx index ff3630ec0..9b973b916 100644 --- a/front/src/modules/comments/components/CellCommentChip.tsx +++ b/front/src/modules/comments/components/CellCommentChip.tsx @@ -3,27 +3,14 @@ import styled from '@emotion/styled'; import { CommentChip, CommentChipProps } from './CommentChip'; // TODO: tie those fixed values to the other components in the cell -const StyledCellWrapper = styled.div` - position: absolute; - right: -46px; - top: 3px; -`; - -const StyledCommentChipContainer = styled.div` - display: flex; - justify-content: flex-end; - position: relative; - - right: 50px; - width: 50px; -`; +const StyledCellWrapper = styled.div``; export function CellCommentChip(props: CommentChipProps) { + if (props.count === 0) return null; + return ( - - - + ); } diff --git a/front/src/modules/comments/components/__stories__/CommentChip.stories.tsx b/front/src/modules/comments/components/__stories__/CommentChip.stories.tsx index 80cec25d8..e4ad69f3b 100644 --- a/front/src/modules/comments/components/__stories__/CommentChip.stories.tsx +++ b/front/src/modules/comments/components/__stories__/CommentChip.stories.tsx @@ -20,19 +20,20 @@ const TestCellContainer = styled.div` display: flex; height: fit-content; - justify-content: flex-start; + justify-content: space-between; max-width: 250px; + min-width: 250px; overflow: hidden; - text-wrap: nowrap; `; const StyledFakeCellText = styled.div` - display: flex; - width: 100%; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; `; export const OneComment: Story = { @@ -60,7 +61,7 @@ export const InCellOverlappingBlur: Story = { render: getRenderWrapperForComponent( - Fake long text to demonstrate blur effect + Fake long text to demonstrate ellipsis , diff --git a/front/src/modules/companies/components/CompanyChip.tsx b/front/src/modules/companies/components/CompanyChip.tsx index 6bcf45f69..a0f6a389c 100644 --- a/front/src/modules/companies/components/CompanyChip.tsx +++ b/front/src/modules/companies/components/CompanyChip.tsx @@ -15,6 +15,7 @@ const StyledContainer = styled.span` display: inline-flex; gap: ${({ theme }) => theme.spacing(1)}; height: calc(20px - 2 * ${({ theme }) => theme.spacing(1)}); + overflow: hidden; padding: ${({ theme }) => theme.spacing(1)}; @@ -31,6 +32,12 @@ const StyledContainer = styled.span` } `; +const StyledName = styled.span` + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +`; + function CompanyChip({ name, picture }: CompanyChipPropsType) { return ( @@ -42,7 +49,7 @@ function CompanyChip({ name, picture }: CompanyChipPropsType) { size={14} /> )} - {name} + {name} ); } diff --git a/front/src/modules/companies/components/__stories__/CompanyChip.stories.tsx b/front/src/modules/companies/components/__stories__/CompanyChip.stories.tsx new file mode 100644 index 000000000..0d5439a0a --- /dev/null +++ b/front/src/modules/companies/components/__stories__/CompanyChip.stories.tsx @@ -0,0 +1,52 @@ +import styled from '@emotion/styled'; +import type { Meta, StoryObj } from '@storybook/react'; + +import { getRenderWrapperForComponent } from '~/testing/renderWrappers'; + +import CompanyChip from '../CompanyChip'; + +const meta: Meta = { + title: 'Modules/Companies/CompanyChip', + component: CompanyChip, +}; + +export default meta; +type Story = StoryObj; + +const TestCellContainer = styled.div` + align-items: center; + background: ${({ theme }) => theme.background.primary}; + display: flex; + + height: fit-content; + justify-content: space-between; + + max-width: 250px; + + min-width: 250px; + + overflow: hidden; + text-wrap: nowrap; +`; + +export const SmallName: Story = { + render: getRenderWrapperForComponent( + + + , + ), +}; + +export const BigName: Story = { + render: getRenderWrapperForComponent( + + + , + ), +}; diff --git a/front/src/modules/people/components/EditablePeopleFullName.tsx b/front/src/modules/people/components/EditablePeopleFullName.tsx index e32bb12ca..0ce292565 100644 --- a/front/src/modules/people/components/EditablePeopleFullName.tsx +++ b/front/src/modules/people/components/EditablePeopleFullName.tsx @@ -13,13 +13,17 @@ type OwnProps = { onChange: (firstname: string, lastname: string) => void; }; -const StyledDiv = styled.div` +const NoEditModeContainer = styled.div` align-items: center; display: flex; justify-content: space-between; width: 100%; `; +const RightContainer = styled.div` + margin-left: ${(props) => props.theme.spacing(1)}; +`; + export function EditablePeopleFullName({ person, onChange }: OwnProps) { const [firstnameValue, setFirstnameValue] = useState(person.firstname ?? ''); const [lastnameValue, setLastnameValue] = useState(person.lastname ?? ''); @@ -55,15 +59,15 @@ export function EditablePeopleFullName({ person, onChange }: OwnProps) { secondValuePlaceholder="Last name" onChange={handleDoubleTextChange} nonEditModeContent={ - <> - - - - - + + + + + + } /> ); diff --git a/front/src/modules/people/components/PersonChip.tsx b/front/src/modules/people/components/PersonChip.tsx index f4fb80f21..6f14de766 100644 --- a/front/src/modules/people/components/PersonChip.tsx +++ b/front/src/modules/people/components/PersonChip.tsx @@ -34,6 +34,12 @@ const StyledContainer = styled.span` white-space: nowrap; `; +const StyledName = styled.span` + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +`; + export function PersonChip({ name, picture }: PersonChipPropsType) { return ( @@ -42,7 +48,7 @@ export function PersonChip({ name, picture }: PersonChipPropsType) { src={picture ? picture.toString() : PersonPlaceholder.toString()} alt="person" /> - {name} + {name} ); } diff --git a/front/src/modules/ui/components/editable-cell/EditableCellDisplayMode.tsx b/front/src/modules/ui/components/editable-cell/EditableCellDisplayMode.tsx index 12879e791..4cdbf559a 100644 --- a/front/src/modules/ui/components/editable-cell/EditableCellDisplayMode.tsx +++ b/front/src/modules/ui/components/editable-cell/EditableCellDisplayMode.tsx @@ -6,8 +6,8 @@ export const EditableCellNormalModeOuterContainer = styled.div` display: flex; height: 100%; overflow: hidden; - padding-left: ${({ theme }) => theme.spacing(2)}; + padding-left: ${({ theme }) => theme.spacing(2)}; padding-right: ${({ theme }) => theme.spacing(1)}; width: 100%; diff --git a/front/src/modules/ui/components/editable-cell/types/EditableChip.tsx b/front/src/modules/ui/components/editable-cell/types/EditableChip.tsx index f37ebcbe8..93d800de4 100644 --- a/front/src/modules/ui/components/editable-cell/types/EditableChip.tsx +++ b/front/src/modules/ui/components/editable-cell/types/EditableChip.tsx @@ -11,7 +11,11 @@ export type EditableChipProps = { picture: string; changeHandler: (updated: string) => void; editModeHorizontalAlign?: 'left' | 'right'; - ChipComponent: ComponentType<{ name: string; picture: string }>; + ChipComponent: ComponentType<{ + name: string; + picture: string; + isOverlapped?: boolean; + }>; commentCount?: number; onCommentClick?: (event: React.MouseEvent) => void; rightEndContents?: ReactNode[]; @@ -24,11 +28,17 @@ const StyledInplaceInput = styled.input` ${textInputStyle} `; -const StyledInplaceShow = styled.div` +const NoEditModeContainer = styled.div` + align-items: center; display: flex; + justify-content: space-between; width: 100%; `; +const RightContainer = styled.div` + margin-left: ${(props) => props.theme.spacing(1)}; +`; + function EditableChip({ value, placeholder, @@ -67,20 +77,20 @@ function EditableChip({ /> } nonEditModeContent={ - <> - - - - {rightEndContents && - rightEndContents.length > 0 && - rightEndContents.map((content, index) => ( -
- {content} -
- ))} - + + + + {rightEndContents && + rightEndContents.length > 0 && + rightEndContents.map((content, index) => ( +
+ {content} +
+ ))} +
+
} - > + /> ); } diff --git a/front/src/modules/ui/components/editable-cell/types/EditablePhone.tsx b/front/src/modules/ui/components/editable-cell/types/EditablePhone.tsx index 7772bfda1..3d0fdbb20 100644 --- a/front/src/modules/ui/components/editable-cell/types/EditablePhone.tsx +++ b/front/src/modules/ui/components/editable-cell/types/EditablePhone.tsx @@ -17,6 +17,16 @@ type StyledEditModeProps = { isEditMode: boolean; }; +const StyledRawLink = styled(RawLink)` + overflow: hidden; + + a { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } +`; + // TODO: refactor const StyledEditInplaceInput = styled.input` margin: 0; @@ -48,9 +58,9 @@ export function EditablePhone({ value, placeholder, changeHandler }: OwnProps) { /> } nonEditModeContent={ -
+ <> {isValidPhoneNumber(inputValue) ? ( - ) => { event.stopPropagation(); @@ -58,11 +68,11 @@ export function EditablePhone({ value, placeholder, changeHandler }: OwnProps) { > {parsePhoneNumber(inputValue, 'FR')?.formatInternational() || inputValue} - + ) : ( - {inputValue} + {inputValue} )} -
+ } /> ); diff --git a/front/src/modules/ui/components/editable-cell/types/EditableText.tsx b/front/src/modules/ui/components/editable-cell/types/EditableText.tsx index a287240fe..076a1eee8 100644 --- a/front/src/modules/ui/components/editable-cell/types/EditableText.tsx +++ b/front/src/modules/ui/components/editable-cell/types/EditableText.tsx @@ -24,6 +24,9 @@ const StyledInplaceInput = styled.input` `; const StyledNoEditText = styled.div` + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; width: 100%; `; diff --git a/front/src/modules/ui/components/links/RawLink.tsx b/front/src/modules/ui/components/links/RawLink.tsx index 70266f024..d8b19f366 100644 --- a/front/src/modules/ui/components/links/RawLink.tsx +++ b/front/src/modules/ui/components/links/RawLink.tsx @@ -3,6 +3,7 @@ import { Link as ReactLink } from 'react-router-dom'; import styled from '@emotion/styled'; type OwnProps = { + className?: string; href: string; children?: React.ReactNode; onClick?: (event: React.MouseEvent) => void; @@ -17,9 +18,9 @@ const StyledClickable = styled.div` } `; -export function RawLink({ href, children, onClick }: OwnProps) { +export function RawLink({ className, href, children, onClick }: OwnProps) { return ( - + {children} diff --git a/front/src/modules/ui/layout/navbar/NavItem.tsx b/front/src/modules/ui/layout/navbar/NavItem.tsx index 7df6dde21..565aa2e3a 100644 --- a/front/src/modules/ui/layout/navbar/NavItem.tsx +++ b/front/src/modules/ui/layout/navbar/NavItem.tsx @@ -70,9 +70,10 @@ const StyledSoonPill = styled.div` align-items: center; border-radius: 50px; background-color: ${({ theme }) => theme.background.transparent.light}; - font-size: ${({ theme }) => theme.font.size.xs}; - padding: ${({ theme }) => theme.spacing(1)} ${({ theme }) => theme.spacing(2)} - ${({ theme }) => theme.spacing(1)} ${({ theme }) => theme.spacing(2)}; + font-size: ${({ theme }) => theme.font.size.xxs}; + height: 16px; + padding-left: ${({ theme }) => theme.spacing(2)}; + padding-right: ${({ theme }) => theme.spacing(2)}; margin-left: auto; // this aligns the pill to the right `; diff --git a/front/src/modules/ui/layout/navbar/NavWorkspaceButton.tsx b/front/src/modules/ui/layout/navbar/NavWorkspaceButton.tsx index f0b6e1ed2..b26d2d5bf 100644 --- a/front/src/modules/ui/layout/navbar/NavWorkspaceButton.tsx +++ b/front/src/modules/ui/layout/navbar/NavWorkspaceButton.tsx @@ -22,7 +22,6 @@ const StyledContainer = styled.div` const LogoAndNameContainer = styled.div` align-items: center; - cursor: pointer; display: flex; `; diff --git a/front/src/modules/ui/themes/font.ts b/front/src/modules/ui/themes/font.ts index fbd9418a4..932b90484 100644 --- a/front/src/modules/ui/themes/font.ts +++ b/front/src/modules/ui/themes/font.ts @@ -2,6 +2,7 @@ import { grayScale } from './colors'; const common = { size: { + xxs: '0.625rem', xs: '0.85rem', sm: '0.92rem', md: '1rem', diff --git a/front/src/modules/users/components/Avatar.tsx b/front/src/modules/users/components/Avatar.tsx index f821382d3..aa125f557 100644 --- a/front/src/modules/users/components/Avatar.tsx +++ b/front/src/modules/users/components/Avatar.tsx @@ -22,6 +22,7 @@ export const StyledAvatar = styled.div>` border-radius: ${(props) => (props.type === 'rounded' ? '50%' : '2px')}; color: ${({ theme }) => theme.font.color.primary}; display: flex; + flex-shrink: 0; font-size: ${({ theme }) => theme.font.size.sm}; font-weight: ${({ theme }) => theme.font.weight.medium};