Skip to content

Commit 133f9b4

Browse files
committed
feat: add medium paint bucket icon and integrate it into PageHeader for theme preference tooltip
1 parent ce5d5c4 commit 133f9b4

File tree

3 files changed

+52
-12
lines changed

3 files changed

+52
-12
lines changed
Lines changed: 8 additions & 0 deletions
Loading

src/Shared/Components/Header/PageHeader.tsx

Lines changed: 42 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,20 @@ import { useEffect, useState } from 'react'
1818
import Tippy from '@tippyjs/react'
1919
import './pageHeader.css'
2020
import ReactGA from 'react-ga4'
21-
import { getRandomColor } from '../../../Common'
21+
import { ReactComponent as ICMediumPaintBucket } from '@IconsV2/ic-medium-paintbucket.svg'
22+
import { ReactComponent as DropDownIcon } from '@Icons/ic-chevron-down.svg'
23+
import { ReactComponent as Close } from '@Icons/ic-close.svg'
24+
import { ReactComponent as Question } from '@Icons/ic-help-outline.svg'
25+
import { getRandomColor, TippyCustomized, TippyTheme } from '../../../Common'
2226
import LogoutCard from '../LogoutCard'
2327
import { setActionWithExpiry, handlePostHogEventUpdate } from './utils'
2428
import { InstallationType, ServerInfo, PageHeaderType } from './types'
2529
import { getServerInfo } from './service'
2630
import GettingStartedCard from '../GettingStartedCard/GettingStarted'
2731
import { POSTHOG_EVENT_ONBOARDING, MAX_LOGIN_COUNT } from '../../../Common/Constants'
2832
import HelpNav from './HelpNav'
29-
import { ReactComponent as Question } from '../../../Assets/Icon/ic-help-outline.svg'
30-
import { ReactComponent as Close } from '../../../Assets/Icon/ic-close.svg'
31-
import { ReactComponent as DropDownIcon } from '../../../Assets/Icon/ic-chevron-down.svg'
3233
import AnnouncementBanner from '../AnnouncementBanner/AnnouncementBanner'
33-
import { useMainContext, useUserEmail } from '../../Providers'
34+
import { useMainContext, useTheme, useUserEmail } from '../../Providers'
3435
import { InfoIconTippy } from '../InfoIconTippy'
3536
import { IframePromoButton } from './IframePromoButton'
3637

@@ -50,6 +51,8 @@ const PageHeader = ({
5051
}: PageHeaderType) => {
5152
const { loginCount, setLoginCount, showGettingStartedCard, setShowGettingStartedCard, setGettingStartedClicked } =
5253
useMainContext()
54+
const { showSwitchThemeLocationTippy, handleShowSwitchThemeLocationTippyChange } = useTheme()
55+
5356
const { isTippyCustomized, tippyRedirectLink, TippyIcon, tippyMessage, onClickTippyButton, additionalContent } =
5457
tippyProps || {}
5558
const [showHelpCard, setShowHelpCard] = useState(false)
@@ -120,6 +123,17 @@ const PageHeader = ({
120123
})
121124
}
122125

126+
const handleCloseSwitchThemeLocationTippyChange = () => {
127+
handleShowSwitchThemeLocationTippyChange(false)
128+
}
129+
130+
const renderThemePreferenceLocationTippyContent = () => (
131+
<div className="px-16 pb-16 flexbox-col dc__gap-4">
132+
<h6 className="m-0 fs-14 fw-6 lh-20">Theme Preference</h6>
133+
<p className="m-0 fs-13 fw-4 lh-20">You can change your theme preference here</p>
134+
</div>
135+
)
136+
123137
const renderLogoutHelpSection = () => (
124138
<>
125139
<div className="flex left cursor dc__gap-8" onClick={onClickHelp}>
@@ -135,14 +149,30 @@ const PageHeader = ({
135149
/>
136150
</div>
137151
{!window._env_.K8S_CLIENT && (
138-
<div
139-
className="logout-card__initial cursor fs-13 icon-dim-24 flex logout-card__initial--nav"
140-
onClick={onClickLogoutButton}
141-
style={{ backgroundColor: getRandomColor(email) }}
142-
data-testid="profile-button"
152+
<TippyCustomized
153+
theme={TippyTheme.black}
154+
className="w-250"
155+
placement="bottom"
156+
visible={showSwitchThemeLocationTippy}
157+
Icon={ICMediumPaintBucket}
158+
iconClass="icon-dim-48 dc__no-shrink"
159+
iconSize={48}
160+
additionalContent={renderThemePreferenceLocationTippyContent()}
161+
showCloseButton
162+
trigger="manual"
163+
interactive
164+
arrow
165+
onClose={handleCloseSwitchThemeLocationTippyChange}
143166
>
144-
{email[0]}
145-
</div>
167+
<div
168+
className="logout-card__initial cursor fs-13 icon-dim-24 flex logout-card__initial--nav"
169+
onClick={onClickLogoutButton}
170+
style={{ backgroundColor: getRandomColor(email) }}
171+
data-testid="profile-button"
172+
>
173+
{email[0]}
174+
</div>
175+
</TippyCustomized>
146176
)}
147177
</>
148178
)

src/Shared/Components/Icon/Icon.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ import { ReactComponent as ICJobColor } from '@IconsV2/ic-job-color.svg'
4343
import { ReactComponent as ICK8sJob } from '@IconsV2/ic-k8s-job.svg'
4444
import { ReactComponent as ICLdap } from '@IconsV2/ic-ldap.svg'
4545
import { ReactComponent as ICLoginDevtronLogo } from '@IconsV2/ic-login-devtron-logo.svg'
46+
import { ReactComponent as ICMediumPaintbucket } from '@IconsV2/ic-medium-paintbucket.svg'
4647
import { ReactComponent as ICMicrosoft } from '@IconsV2/ic-microsoft.svg'
4748
import { ReactComponent as ICMissing } from '@IconsV2/ic-missing.svg'
4849
import { ReactComponent as ICMonitoring } from '@IconsV2/ic-monitoring.svg'
@@ -110,6 +111,7 @@ export const iconMap = {
110111
'ic-k8s-job': ICK8sJob,
111112
'ic-ldap': ICLdap,
112113
'ic-login-devtron-logo': ICLoginDevtronLogo,
114+
'ic-medium-paintbucket': ICMediumPaintbucket,
113115
'ic-microsoft': ICMicrosoft,
114116
'ic-missing': ICMissing,
115117
'ic-monitoring': ICMonitoring,

0 commit comments

Comments
 (0)