Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix [UI] Warning icon overlay on input text 1.7.x #2837

Merged
merged 1 commit into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/common/Input/Input.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ illegal under applicable law, and the grant of the foregoing license
under the Apache 2.0 license is conditioned upon your compliance with
such restriction.
*/
import React, { useState, useEffect, useRef } from 'react'
import React, { useState, useEffect, useRef, useMemo } from 'react'
import PropTypes from 'prop-types'
import classnames from 'classnames'
import { isEmpty } from 'lodash'
Expand Down Expand Up @@ -87,6 +87,13 @@ const Input = React.forwardRef(
const inputLabelRef = useRef(null)
useDetectOutsideClick(ref, () => setShowValidationRules(false))

const inputStyles = useMemo(() => {
return {
paddingLeft: `${labelWidth + 16}px`,
paddingRight: (tip ? 25 : 0) + (isInvalid ? 20 : 0) + 'px'
}
}, [isInvalid, labelWidth, tip])

const inputClassNames = classnames(
'input',
className,
Expand Down Expand Up @@ -240,7 +247,7 @@ const Input = React.forwardRef(
type,
value: typedValue
}}
style={floatingLabel ? {} : { paddingLeft: `${labelWidth + 16}px`, paddingRight: tip ? '25px' : '0px' }}
style={floatingLabel ? {} : inputStyles }
/>
{label && (
<div className={labelClassNames}>
Expand Down
4 changes: 2 additions & 2 deletions src/components/Details/DetailsHeader/DetailsHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import ActionsMenu from '../../../common/ActionsMenu/ActionsMenu'

import { DETAILS_ARTIFACTS_TAB, FULL_VIEW_MODE, JOBS_PAGE } from '../../../constants'
import { formatDatetime } from '../../../utils'
import { LABEL_BUTTON } from 'igz-controls/constants'
import { TERTIARY_BUTTON } from 'igz-controls/constants'
import { ACTIONS_MENU } from '../../../types'
import { getViewMode } from '../../../utils/helper'
import { generateUrlFromRouterPath } from '../../../utils/link-helper.util'
Expand Down Expand Up @@ -220,7 +220,7 @@ const DetailsHeader = ({
{detailsStore.changes.counter > 0 && (
<>
<Button
variant={LABEL_BUTTON}
variant={TERTIARY_BUTTON}
label="Cancel"
onClick={cancelChanges}
disabled={detailsStore.changes.counter === 0 || detailsStore.editMode}
Expand Down
4 changes: 2 additions & 2 deletions src/elements/ChangeOwnerPopUp/ChangeOwnerPopUp.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import Input from '../../common/Input/Input'
import { Button, PopUpDialog } from 'igz-controls/components'

import projectsIguazioApi from '../../api/projects-iguazio-api'
import { FORBIDDEN_ERROR_STATUS_CODE, SECONDARY_BUTTON, LABEL_BUTTON } from 'igz-controls/constants'
import { FORBIDDEN_ERROR_STATUS_CODE, SECONDARY_BUTTON, TERTIARY_BUTTON } from 'igz-controls/constants'
import { deleteUnsafeHtml } from '../../utils'
import { getErrorMsg } from 'igz-controls/utils/common.util'
import { isIgzVersionCompatible } from '../../utils/isIgzVersionCompatible'
Expand Down Expand Up @@ -238,7 +238,7 @@ const ChangeOwnerPopUp = ({ changeOwnerCallback, projectId }) => {
className="pop-up-dialog__btn_cancel"
label="Discard"
onClick={handleOnClose}
variant={LABEL_BUTTON}
variant={TERTIARY_BUTTON}
/>
<Button
disabled={!newOwnerId}
Expand Down
4 changes: 2 additions & 2 deletions src/elements/FeaturesTablePanel/FeaturesTablePanelView.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import CreateFeatureVectorPopUp from '../CreateFeatureVectorPopUp/CreateFeatureV
import FeaturesTablePanelRow from './FeatureTablePanleRow/FeaturesTablePanelRow'
import { Button, Tip, Tooltip, TextTooltipTemplate } from 'igz-controls/components'

import { LABEL_BUTTON, PRIMARY_BUTTON } from 'igz-controls/constants'
import { TERTIARY_BUTTON, PRIMARY_BUTTON } from 'igz-controls/constants'

import { ReactComponent as Edit } from 'igz-controls/images/edit.svg'
import { ReactComponent as Arrow } from 'igz-controls/images/arrow.svg'
Expand Down Expand Up @@ -164,7 +164,7 @@ function FeaturesTablePanelView({
})}
</div>
<div className="features-panel__buttons">
<Button label="Cancel" variant={LABEL_BUTTON} onClick={handleCancel} />
<Button label="Cancel" variant={TERTIARY_BUTTON} onClick={handleCancel} />
<Button variant={PRIMARY_BUTTON} label="Add" onClick={addFeatures} />
</div>
</div>
Expand Down
6 changes: 5 additions & 1 deletion src/elements/FeaturesTablePanel/featuresTablePanel.scss
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,16 @@
.features-panel__buttons {
position: sticky;
bottom: 0;
z-index: 3;
display: flex;
justify-content: flex-end;
width: 100%;
padding: 10px 15px;
background-color: $white;
z-index: 3;

.btn {
margin-right: 10px;
}
}

.features-panel__divider {
Expand Down
6 changes: 3 additions & 3 deletions src/elements/MembersPopUp/MembersPopUp.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { Button, ConfirmDialog, RoundedIcon, Tip } from 'igz-controls/components

import {
DANGER_BUTTON,
LABEL_BUTTON,
TERTIARY_BUTTON,
PRIMARY_BUTTON,
SECONDARY_BUTTON
} from 'igz-controls/constants'
Expand Down Expand Up @@ -526,7 +526,7 @@ const MembersPopUp = ({ changeMembersCallback, membersDispatch, membersState })
<div className="apply-discard-buttons">
<Button
disabled={!areChangesMade()}
variant={LABEL_BUTTON}
variant={TERTIARY_BUTTON}
label="Discard"
className="pop-up-dialog__btn_cancel"
onClick={closeMemberPopUp}
Expand All @@ -547,7 +547,7 @@ const MembersPopUp = ({ changeMembersCallback, membersDispatch, membersState })
setConfirmDiscard(false)
},
label: 'No',
variant: LABEL_BUTTON
variant: TERTIARY_BUTTON
}}
closePopUp={() => setConfirmDiscard(false)}
confirmButton={{
Expand Down
Loading