diff options
author | David Cho-Lerat <david.cho-lerat@sonarsource.com> | 2024-09-11 10:16:30 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2024-09-12 20:02:53 +0000 |
commit | fbb3e8846f006067481102517dbad5126e96213e (patch) | |
tree | 5adcd0d3d1660e3ddc11dcf9b08ad167732d26f6 /server/sonar-web/design-system/src | |
parent | 4a901440b63ac6e2efd600d80b786eff8eead2ac (diff) | |
download | sonarqube-fbb3e8846f006067481102517dbad5126e96213e.tar.gz sonarqube-fbb3e8846f006067481102517dbad5126e96213e.zip |
SONAR-22970 Align dependencies with SonarCloud
Diffstat (limited to 'server/sonar-web/design-system/src')
-rw-r--r-- | server/sonar-web/design-system/src/components/CodeSnippet.tsx | 10 | ||||
-rw-r--r-- | server/sonar-web/design-system/src/components/input/DateRangePicker.tsx | 5 |
2 files changed, 9 insertions, 6 deletions
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<Props>) { + 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 ? `<code>${lodashEscape(finalSnippet)}</code>` - : `<pre>${lodashEscape(finalSnippet)}</pre>`; + : `<pre>${lodashEscape(finalSnippet)}</pre>`); return ( <Wrapper diff --git a/server/sonar-web/design-system/src/components/input/DateRangePicker.tsx b/server/sonar-web/design-system/src/components/input/DateRangePicker.tsx index 03bcdaa302e..316a45d7df1 100644 --- a/server/sonar-web/design-system/src/components/input/DateRangePicker.tsx +++ b/server/sonar-web/design-system/src/components/input/DateRangePicker.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 classNames from 'classnames'; import { max, min } from 'date-fns'; import * as React from 'react'; @@ -96,7 +97,7 @@ export class DateRangePicker extends React.PureComponent<Props> { 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<Props> { 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} |