CODE-520: Fixed text wrapping on buttons in Compare page

This commit is contained in:
“tan-nhu” 2023-08-10 10:41:25 -07:00
parent c1a23445dd
commit 11bd10f455
6 changed files with 14 additions and 9 deletions

View File

@ -8,6 +8,7 @@ html[class=''] {
--border: 1px solid var(--grey-200) !important; --border: 1px solid var(--grey-200) !important;
--background-color-active: var(--white) !important; --background-color-active: var(--white) !important;
--box-shadow: none !important; --box-shadow: none !important;
white-space: nowrap !important;
&:active, &:active,
&:hover, &:hover,

View File

@ -42,6 +42,7 @@ export const BranchTagSelect: React.FC<BranchTagSelectProps> = ({
forBranchesOnly, forBranchesOnly,
labelPrefix, labelPrefix,
placeHolder, placeHolder,
className,
...props ...props
}) => { }) => {
const [query, onQuery] = useState('') const [query, onQuery] = useState('')
@ -50,7 +51,7 @@ export const BranchTagSelect: React.FC<BranchTagSelectProps> = ({
return ( return (
<Button <Button
className={css.button} className={cx(css.button, className)}
text={ text={
text ? ( text ? (
labelPrefix ? ( labelPrefix ? (

View File

@ -5,10 +5,14 @@
> div { > div {
align-items: center; align-items: center;
} }
button {
white-space: nowrap !important;
}
} }
.branchDropdown { .branchTagDropdown {
background-color: var(--white); --background-color: var(--white) !important;
} }
.mergeText { .mergeText {

View File

@ -2,7 +2,7 @@
// this is an auto-generated file // this is an auto-generated file
declare const styles: { declare const styles: {
readonly main: string readonly main: string
readonly branchDropdown: string readonly branchTagDropdown: string
readonly mergeText: string readonly mergeText: string
readonly popover: string readonly popover: string
readonly menuItem: string readonly menuItem: string

View File

@ -63,7 +63,7 @@ export function CompareContentHeader({
onSelect={onTargetGitRefChanged} onSelect={onTargetGitRefChanged}
labelPrefix={getString('prefixBase')} labelPrefix={getString('prefixBase')}
placeHolder={getString('selectBranchPlaceHolder')} placeHolder={getString('selectBranchPlaceHolder')}
style={{ '--background-color': 'var(--white)' } as React.CSSProperties} className={css.branchTagDropdown}
/> />
<Icon name="arrow-left" size={14} /> <Icon name="arrow-left" size={14} />
<BranchTagSelect <BranchTagSelect
@ -74,7 +74,7 @@ export function CompareContentHeader({
onSelect={onSourceGitRefChanged} onSelect={onSourceGitRefChanged}
labelPrefix={getString('prefixCompare')} labelPrefix={getString('prefixCompare')}
placeHolder={getString('selectBranchPlaceHolder')} placeHolder={getString('selectBranchPlaceHolder')}
style={{ '--background-color': 'var(--white)' } as React.CSSProperties} className={css.branchTagDropdown}
/> />
{!!targetGitRef && !!sourceGitRef && ( {!!targetGitRef && !!sourceGitRef && (
<MergeableLabel repoMetadata={repoMetadata} targetGitRef={targetGitRef} sourceGitRef={sourceGitRef} /> <MergeableLabel repoMetadata={repoMetadata} targetGitRef={targetGitRef} sourceGitRef={sourceGitRef} />
@ -146,7 +146,7 @@ const MergeableLabel: React.FC<Pick<CompareContentHeaderProps, 'repoMetadata' |
<Text <Text
className={css.mergeText} className={css.mergeText}
icon={loading ? 'spinner' : mergeable === true ? 'command-artifact-check' : 'cross'} icon={loading ? 'spinner' : mergeable === true ? 'command-artifact-check' : 'cross'}
iconProps={{ color }} iconProps={{ color, margin: { right: 'xsmall' } }}
color={color}> color={color}>
{loading ? '' : error ? getErrorMessage(error) : getString(mergeable ? 'pr.ableToMerge' : 'pr.cantMerge')} {loading ? '' : error ? getErrorMessage(error) : getString(mergeable ? 'pr.ableToMerge' : 'pr.cantMerge')}
</Text> </Text>

View File

@ -12,7 +12,6 @@ import {
} from '@harness/uicore' } from '@harness/uicore'
import ReactTimeago from 'react-timeago' import ReactTimeago from 'react-timeago'
import { Render } from 'react-jsx-match' import { Render } from 'react-jsx-match'
import { Link } from 'react-router-dom'
import { CodeIcon, GitInfoProps } from 'utils/GitUtils' import { CodeIcon, GitInfoProps } from 'utils/GitUtils'
import { MarkdownViewer } from 'components/MarkdownViewer/MarkdownViewer' import { MarkdownViewer } from 'components/MarkdownViewer/MarkdownViewer'
import { useStrings } from 'framework/strings' import { useStrings } from 'framework/strings'
@ -21,9 +20,9 @@ import type { CommentItem } from 'components/CommentBox/CommentBox'
import { formatDate, formatTime, PullRequestSection } from 'utils/Utils' import { formatDate, formatTime, PullRequestSection } from 'utils/Utils'
import { CommentType } from 'components/DiffViewer/DiffViewerUtils' import { CommentType } from 'components/DiffViewer/DiffViewerUtils'
import { useAppContext } from 'AppContext' import { useAppContext } from 'AppContext'
import css from './Conversation.module.scss'
import { CommitActions } from 'components/CommitActions/CommitActions' import { CommitActions } from 'components/CommitActions/CommitActions'
import { PipeSeparator } from 'components/PipeSeparator/PipeSeparator' import { PipeSeparator } from 'components/PipeSeparator/PipeSeparator'
import css from './Conversation.module.scss'
interface SystemCommentProps extends Pick<GitInfoProps, 'pullRequestMetadata'> { interface SystemCommentProps extends Pick<GitInfoProps, 'pullRequestMetadata'> {
commentItems: CommentItem<TypesPullReqActivity>[] commentItems: CommentItem<TypesPullReqActivity>[]