Skip to content

Commit 6ae4cee

Browse files
authored
Merge pull request #2888 from devtron-labs/fix/notes-card
fix: notes drawer closing on click
2 parents ff043cc + b299ba7 commit 6ae4cee

File tree

4 files changed

+22
-11
lines changed

4 files changed

+22
-11
lines changed

src/components/app/details/appDetails/DeployedCommitCard.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
GitProviderType,
2424
LoadingCard,
2525
showError,
26+
Tooltip,
2627
} from '@devtron-labs/devtron-fe-common-lib'
2728

2829
import { ReactComponent as CommitIcon } from '../../../../assets/icons/ic-code-commit.svg'
@@ -99,8 +100,10 @@ const DeployedCommitCard = ({ cardLoading, showCommitInfoDrawer, envId, ciArtifa
99100
{/* @TODO: This should be dynamic, dependent on the source */}
100101
{/* <GitHub className="github-icon" /> */}
101102
</div>
102-
<div className="app-details-info-card__bottom-container dc__content-space">
103-
<span className="app-details-info-card__bottom-container__message fs-12 fw-4">{commitMessage}</span>
103+
<div className="app-details-info-card__bottom-container dc__gap-8 dc__content-space">
104+
<Tooltip content={commitMessage} placement="bottom">
105+
<span className="app-details-info-card__bottom-container__message fs-12 fw-4">{commitMessage}</span>
106+
</Tooltip>
104107
<div className="app-details-info-card__bottom-container__details fs-12 fw-6">Details</div>
105108
</div>
106109
</div>

src/components/v2/appDetails/sourceInfo/environment.type.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
import React from 'react'
17+
import React, { SyntheticEvent } from 'react'
1818

1919
import {
2020
AppEnvironment as BaseAppEnvironmentType,
@@ -49,7 +49,7 @@ export interface NodeStreamMap {
4949
export interface ChartUsedCardType {
5050
appDetails: AppDetails
5151
notes: string
52-
onClickShowNotes: () => void
52+
onClickShowNotes: (e: SyntheticEvent) => void
5353
cardLoading: boolean
5454
onClickUpgrade: () => void
5555
}

src/components/v2/appDetails/sourceInfo/environmentStatus/EnvironmentStatus.component.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { useMemo, useState } from 'react'
17+
import { SyntheticEvent, useMemo, useState } from 'react'
1818
import './environmentStatus.scss'
1919
import IndexStore from '../../index.store'
2020
import { URLS } from '../../../../../config'
@@ -29,6 +29,7 @@ import {
2929
AppStatusModalTabType,
3030
DeploymentAppTypes,
3131
LoadingCard,
32+
stopPropagation,
3233
useAsync,
3334
} from '@devtron-labs/devtron-fe-common-lib'
3435
import { EnvironmentStatusComponentType } from '../environment.type'
@@ -112,7 +113,8 @@ const EnvironmentStatusComponent = ({
112113
)
113114
}
114115

115-
const onClickShowNotes = () => {
116+
const onClickShowNotes = (e: SyntheticEvent) => {
117+
stopPropagation(e)
116118
setShowNotes(true)
117119
}
118120

src/components/v2/appDetails/sourceInfo/environmentStatus/NotesDrawer.tsx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,9 @@
1515
*/
1616

1717
import { useEffect, useRef } from 'react'
18-
import { ReactComponent as Close } from '../../../assets/icons/ic-close.svg'
1918
import './environmentStatus.scss'
2019
import { NotesDrawerType } from './notesDrawer.type'
21-
import { Drawer, MarkDown } from '@devtron-labs/devtron-fe-common-lib'
20+
import { Button, ButtonStyleType, ButtonVariantType, ComponentSizeType, Drawer, Icon, MarkDown } from '@devtron-labs/devtron-fe-common-lib'
2221

2322
const NotesDrawer = ({ notes, close }: NotesDrawerType) => {
2423
const appNotesRef = useRef<HTMLDivElement>(null)
@@ -59,9 +58,16 @@ const NotesDrawer = ({ notes, close }: NotesDrawerType) => {
5958
data-testid="notes-heading-after-click"
6059
>
6160
Notes
62-
<span className="cursor" onClick={close} data-testid="close-notes-button">
63-
<Close className="icon-dim-24" />
64-
</span>
61+
<Button
62+
dataTestId="close-notes-button"
63+
icon={<Icon name="ic-close-large" color={null} />}
64+
onClick={close}
65+
ariaLabel="Close notes drawer"
66+
showAriaLabelInTippy={false}
67+
size={ComponentSizeType.xs}
68+
variant={ButtonVariantType.borderLess}
69+
style={ButtonStyleType.negativeGrey}
70+
/>
6571
</div>
6672
</div>
6773
<div className="app-notes__body dc__white-space-pre">

0 commit comments

Comments
 (0)