Skip to content

Commit 67dc3ac

Browse files
authored
remove need for styled-jsx construct (github#28749)
* remove need for styled-jsx construct * remove line that might not be needed
1 parent c18d115 commit 67dc3ac

File tree

4 files changed

+10
-11
lines changed

4 files changed

+10
-11
lines changed

Dockerfile

-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ COPY content/index.md ./content/index.md
5151

5252
COPY next.config.js ./next.config.js
5353
COPY tsconfig.json ./tsconfig.json
54-
COPY next-env.d.ts ./next-env.d.ts
5554

5655
RUN npm run build
5756

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.truncated {
2+
// Note that `-webkit-line-clamp` gets set by the component JSX
3+
// manually with a `style` attribute.
4+
display: -webkit-box;
5+
-webkit-box-orient: vertical;
6+
overflow: hidden;
7+
}
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import React, { ReactNode } from 'react'
22
import cx from 'classnames'
33

4+
import styles from './TruncateLines.module.scss'
5+
46
export type TruncateLinesPropsT = {
57
as?: keyof JSX.IntrinsicElements
68
maxLines: number
@@ -11,16 +13,8 @@ export type TruncateLinesPropsT = {
1113
export const TruncateLines = (props: TruncateLinesPropsT) => {
1214
const { maxLines, className, children, as: Component = 'div' } = props
1315
return (
14-
<Component className={cx('root', className)}>
16+
<Component className={cx(styles.truncated, className)} style={{ WebkitLineClamp: maxLines }}>
1517
{children}
16-
<style jsx>{`
17-
.root {
18-
display: -webkit-box;
19-
-webkit-line-clamp: ${maxLines};
20-
-webkit-box-orient: vertical;
21-
overflow: hidden;
22-
}
23-
`}</style>
2418
</Component>
2519
)
2620
}

next-env.d.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/// <reference types="next" />
2-
/// <reference types="next/types/global" />
32
/// <reference types="next/image-types/global" />
43

54
// NOTE: This file should not be edited

0 commit comments

Comments
 (0)