Skip to content

Commit db7cb9d

Browse files
committed
add one more Size item for cover scenario for TruncateBox as max-width:16em
Signed-off-by: Evgeniy Bilov <eugenebelov@users.noreply.github.com>
1 parent 39c76b9 commit db7cb9d

2 files changed

Lines changed: 20 additions & 17 deletions

File tree

src/lib/components/truncate-box/truncate-box.tsx

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,16 @@ export interface TruncateBoxProps extends BaseProps {
1212

1313
const getSize = (size: Size) =>
1414
matchSize(
15-
{
16-
0: 7.8,
17-
1: 10,
18-
2: 23,
19-
3: 35,
20-
4: 45,
21-
5: 55,
22-
},
23-
size
15+
{
16+
0: 7.8,
17+
1: 10,
18+
1.6: 16,
19+
2: 23,
20+
3: 35,
21+
4: 45,
22+
5: 55,
23+
},
24+
size,
2425
);
2526

2627
const StyledTruncateBox = styled('div')<TruncateBoxProps>(
@@ -36,18 +37,20 @@ const StyledTruncateBox = styled('div')<TruncateBoxProps>(
3637
content: "''",
3738
display: 'block',
3839
},
39-
lineHeight: lineHeight ? matchSize(
40+
lineHeight: lineHeight
41+
? matchSize(
4042
{
41-
sm: '1.5rem',
42-
xs: '1.25rem',
43+
sm: '1.5rem',
44+
xs: '1.25rem',
4345
},
44-
lineHeight
45-
) : 'unset',
46-
})
46+
lineHeight,
47+
)
48+
: 'unset',
49+
}),
4750
);
4851

4952
export const TruncateBox = React.forwardRef<HTMLDivElement, TruncateBoxProps>(
50-
(props, ref) => <StyledTruncateBox ref={ref} {...props} />
53+
(props, ref) => <StyledTruncateBox ref={ref} {...props} />,
5154
);
5255

5356
export default TruncateBox;

src/lib/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export type ActivableProps = {
1010
active?: boolean;
1111
};
1212

13-
export type Size = 0 | 1 | 2 | 3 | 4 | 5;
13+
export type Size = 0 | 1 | 1.6 | 2 | 3 | 4 | 5;
1414

1515
export enum LabelFontSize {
1616
'default' = 'default',

0 commit comments

Comments
 (0)