This repository was archived by the owner on Mar 25, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +29
-9
lines changed
Expand file tree Collapse file tree 4 files changed +29
-9
lines changed Original file line number Diff line number Diff line change @@ -22,19 +22,12 @@ import { Header } from './components/Header'
2222import { Footer } from './components/Footer'
2323import { MainSection } from './components/Content'
2424import { BaseDialog , DialogWidth } from './BaseDialog'
25+ import { twoLinesClamp } from '../utils/twoLinesClamp'
2526
2627export const HeaderTitle = styled ( Typography ) . attrs ( {
2728 variant : 'dialog-heading' ,
2829} ) `
29- /* stylelint-disable-next-line value-no-vendor-prefix */
30- display: -webkit-box;
31- /* stylelint-disable-next-line property-no-vendor-prefix */
32- -webkit-line-clamp: 2;
33- /* stylelint-disable-next-line property-no-vendor-prefix */
34- -webkit-box-orient: vertical;
35- /* stylelint-disable-next-line property-no-vendor-prefix */
36- -moz-box-orient: vertical;
37- overflow: hidden;
30+ ${ twoLinesClamp }
3831`
3932
4033export interface DialogProps extends ModalProps {
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ import {
2121 BaseToastValue ,
2222} from './context'
2323import { Theme } from '../theme'
24+ import { twoLinesClamp } from '../utils/twoLinesClamp'
2425
2526const getIconColor = ( theme : Theme , iconType ?: ToastIconType ) => {
2627 const { color } = theme
@@ -48,6 +49,7 @@ export const ToastLabel = styled(Typography).attrs({
4849 readonly hasEmphasis : boolean
4950} > `
5051 height: 100%;
52+ ${ twoLinesClamp }
5153
5254 ${ ( { hasCloseButton } ) =>
5355 ! hasCloseButton
Original file line number Diff line number Diff line change 11export * from './withField'
2+ export * from './twoLinesClamp'
Original file line number Diff line number Diff line change 1+ import { css } from 'styled-components'
2+
3+ /**
4+ * A styled-components mixin that truncates two-lines text with ellipsis.
5+ *
6+ * An example:
7+ * ```tsx
8+ * const Div = styled.div`
9+ * ${twoLinesClamp};
10+ * `
11+ * ```
12+ */
13+ export const twoLinesClamp = css `
14+ /* stylelint-disable-next-line value-no-vendor-prefix */
15+ display : -webkit-box;
16+ /* stylelint-disable-next-line property-no-vendor-prefix */
17+ -webkit-line-clamp : 2 ;
18+ /* stylelint-disable-next-line property-no-vendor-prefix */
19+ -webkit-box-orient : vertical;
20+ /* stylelint-disable-next-line property-no-vendor-prefix */
21+ -moz-box-orient : vertical;
22+ overflow : hidden;
23+ white-space : pre-wrap;
24+ `
You can’t perform that action at this time.
0 commit comments