From fbb3e8846f006067481102517dbad5126e96213e Mon Sep 17 00:00:00 2001 From: David Cho-Lerat Date: Wed, 11 Sep 2024 10:16:30 +0200 Subject: SONAR-22970 Align dependencies with SonarCloud --- server/sonar-web/design-system/src/components/CodeSnippet.tsx | 10 ++++++---- .../design-system/src/components/input/DateRangePicker.tsx | 5 +++-- 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'server/sonar-web/design-system/src') diff --git a/server/sonar-web/design-system/src/components/CodeSnippet.tsx b/server/sonar-web/design-system/src/components/CodeSnippet.tsx index 094168b1a36..6ca4d79d813 100644 --- a/server/sonar-web/design-system/src/components/CodeSnippet.tsx +++ b/server/sonar-web/design-system/src/components/CodeSnippet.tsx @@ -17,6 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + import styled from '@emotion/styled'; import classNames from 'classnames'; import { escape as lodashEscape } from 'lodash'; @@ -41,8 +42,8 @@ interface Props { // eslint-disable-next-line no-useless-concat const s = ' \\' + '\n '; -export function CodeSnippet(props: Props) { - const { className, isOneLine, join = s, language, noCopy, render, snippet, wrap } = props; +export function CodeSnippet(props: Readonly) { + const { className, isOneLine, join = s, language, noCopy, render, snippet, wrap = false } = props; const snippetArray = Array.isArray(snippet) ? snippet.filter(isDefined) : [snippet]; const finalSnippet = isOneLine ? snippetArray.join(' ') : snippetArray.join(join); @@ -55,9 +56,10 @@ export function CodeSnippet(props: Props) { ); const renderSnippet = - render ?? (wrap || isOneLine) + render ?? + (wrap || isOneLine ? `${lodashEscape(finalSnippet)}` - : `
${lodashEscape(finalSnippet)}
`; + : `
${lodashEscape(finalSnippet)}
`); return ( { data-test="from" highlightTo={this.to} id="date-from" - maxDate={maxDate && this.to ? min([maxDate, this.to]) : maxDate ?? this.to} + maxDate={maxDate && this.to ? min([maxDate, this.to]) : (maxDate ?? this.to)} minDate={minDate} onChange={this.handleFromChange} placeholder={fromLabel} @@ -117,7 +118,7 @@ export class DateRangePicker extends React.PureComponent { this.toDateInput = element; }} maxDate={maxDate} - minDate={minDate && this.from ? max([minDate, this.from]) : minDate ?? this.from} + minDate={minDate && this.from ? max([minDate, this.from]) : (minDate ?? this.from)} onChange={this.handleToChange} placeholder={toLabel} size={inputSize} -- cgit v1.2.3