Skip to content

Commit

Permalink
Truncate long contact notes in control unit dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
ivangabriele committed Jan 4, 2024
1 parent 26ed3bc commit 079540a
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Accent, Icon, IconButton } from '@mtes-mct/monitor-ui'
import { truncate } from 'lodash/fp'
import { useCallback } from 'react'
import styled from 'styled-components'

Expand Down Expand Up @@ -31,7 +32,8 @@ export function Item({ controlUnitResource, onEdit }: ItemProps) {
<IconButton accent={Accent.TERTIARY} Icon={Icon.Edit} onClick={handleEdit} title="Éditer ce moyen" />
</div>
</InfoBoxHeader>
<p>{controlUnitResource.note}</p>
{/* 120 chars ~= 3 lines */}
{controlUnitResource.note && <p>{truncate({ length: 120 }, controlUnitResource.note)}</p>}
</InfoBox>
</Wrapper>
)
Expand Down

0 comments on commit 079540a

Please sign in to comment.