diff --git a/components/collapsible-panel/collapsible-panel-summary-item.js b/components/collapsible-panel/collapsible-panel-summary-item.js index d6653c625b4..3c5863a8b79 100644 --- a/components/collapsible-panel/collapsible-panel-summary-item.js +++ b/components/collapsible-panel/collapsible-panel-summary-item.js @@ -1,10 +1,8 @@ import '../colors/colors.js'; -import { css, html, LitElement } from 'lit'; +import { css, html, LitElement, nothing } from 'lit'; import { bodySmallStyles } from '../typography/styles.js'; -import { classMap } from 'lit/directives/class-map.js'; import { getOverflowDeclarations } from '../../helpers/overflow.js'; import { SkeletonMixin } from '../skeleton/skeleton-mixin.js'; -import { styleMap } from 'lit/directives/style-map.js'; /** * A component for a "summary item" child component that describes the content in a collapsible panel. @@ -35,9 +33,6 @@ class CollapsiblePanelSummaryItem extends SkeletonMixin(LitElement) { .d2l-body-small { line-height: 1.2rem; } - p.truncate { - ${getOverflowDeclarations({ lines: 1 })} - } `]; constructor() { @@ -47,13 +42,8 @@ class CollapsiblePanelSummaryItem extends SkeletonMixin(LitElement) { } render() { - const classes = { - 'd2l-body-small': true, - 'd2l-skeletize': true, - 'truncate': this.lines > 0 - }; - const styles = (this.lines > 0) ? { '-webkit-line-clamp': this.lines } : {}; - return html`
${this.text}
`; + const styles = this.lines ? getOverflowDeclarations({ lines: this.lines }) : null; + return html`${this.text}
`; } } diff --git a/components/link/link.js b/components/link/link.js index 2efad8909c3..2eff43f37c4 100644 --- a/components/link/link.js +++ b/components/link/link.js @@ -2,15 +2,14 @@ import '../colors/colors.js'; import '../icons/icon.js'; import '../tooltip/tooltip.js'; import { css, html, LitElement, nothing } from 'lit'; -import { getOverflowDeclarations, overflowEllipsisDeclarations } from '../../helpers/overflow.js'; import { _generateLinkStyles } from './link-styles.js'; import { classMap } from 'lit/directives/class-map.js'; import { FocusMixin } from '../../mixins/focus/focus-mixin.js'; +import { getOverflowDeclarations } from '../../helpers/overflow.js'; import { getUniqueId } from '../../helpers/uniqueId.js'; import { ifDefined } from 'lit/directives/if-defined.js'; import { LocalizeCoreElement } from '../../helpers/localize-core-element.js'; import { offscreenStyles } from '../offscreen/offscreen.js'; -import { styleMap } from 'lit/directives/style-map.js'; export const linkStyles = _generateLinkStyles('.d2l-link', true); @@ -90,12 +89,6 @@ class Link extends LocalizeCoreElement(FocusMixin(LitElement)) { align-items: baseline; display: flex; } - a span.truncate { - ${getOverflowDeclarations({ lines: 1 })} - } - a span.truncate-one { - ${overflowEllipsisDeclarations} - } #new-window { line-height: 0; white-space: nowrap; @@ -157,12 +150,7 @@ class Link extends LocalizeCoreElement(FocusMixin(LitElement)) { 'd2l-link-main': this.main, 'd2l-link-small': this.small }; - const spanClasses = { - 'd2l-link-content': true, - 'truncate': this.lines > 1, - 'truncate-one': this.lines === 1 - }; - const styles = { webkitLineClamp: this.lines || null }; + const styles = this.lines ? getOverflowDeclarations({ lines: this.lines }) : null; const newWindowElements = (this.target === '_blank') ? html`