Skip to content

Commit 2ead20e

Browse files
committed
feat: add theme opposite class for license card
1 parent ddc5182 commit 2ead20e

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

src/Shared/Components/DevtronLicenseCard/DevtronLicenseCard.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ import { useEffect, useRef } from 'react'
22
import { animate, motion, useMotionTemplate, useMotionValue, useTransform } from 'framer-motion'
33
import { ClipboardButton, getTTLInHumanReadableFormat } from '@Common/index'
44
import { ReactComponent as ICChatSupport } from '@IconsV2/ic-chat-circle-dots.svg'
5+
import { getThemeOppositeThemeClass } from '@Shared/Providers/ThemeProvider/utils'
56
import {
6-
AppThemeType,
77
CONTACT_SUPPORT_LINK,
88
DevtronLicenseCardProps,
99
ENTERPRISE_SUPPORT_LINK,
10-
getComponentSpecificThemeClass,
1110
getHandleOpenURL,
1211
LicenseStatus,
12+
useTheme,
1313
} from '@Shared/index'
1414
import { Button, ButtonVariantType } from '../Button'
1515
import { Icon } from '../Icon'
@@ -28,6 +28,7 @@ export const DevtronLicenseCard = ({
2828
ttl,
2929
}: DevtronLicenseCardProps) => {
3030
const { bgColor, textColor } = getLicenseColorsAccordingToStatus(licenseStatus)
31+
const { appTheme } = useTheme()
3132
const remainingTime = getTTLInHumanReadableFormat(ttl)
3233
const remainingTimeString = ttl < 0 ? `Expired ${remainingTime} ago` : `${remainingTime} remaining`
3334
const isLicenseValid = licenseStatus !== LicenseStatus.EXPIRED
@@ -80,7 +81,7 @@ export const DevtronLicenseCard = ({
8081
<div className="flexbox-col p-8 br-16" style={{ backgroundColor: bgColor }}>
8182
<div style={{ perspective: '1000px' }}>
8283
<motion.div
83-
className={`license-card border__secondary flexbox-col br-12 h-200 dc__overflow-hidden bg__tertiary ${getComponentSpecificThemeClass(AppThemeType.dark)}`}
84+
className={`license-card shadow__overlay border__secondary flexbox-col br-12 h-200 dc__overflow-hidden bg__tertiary ${getThemeOppositeThemeClass(appTheme)}`}
8485
ref={cardRef}
8586
style={{
8687
rotateX,
@@ -100,7 +101,7 @@ export const DevtronLicenseCard = ({
100101
<div className="flexbox-col dc__gap-4">
101102
<div className="flexbox dc__align-items-center dc__gap-6">
102103
<Icon name="ic-key" color={null} size={16} />
103-
<div className="flex dc__gap-4 cn-7 fs-16 fw-5 lh-1-5 font-ibm-plex-mono">
104+
<div className="flex dc__gap-4 cn-7 fs-16 fw-5 lh-1-5 cn-9 font-ibm-plex-mono">
104105
<span>&bull;&bull;&bull;&bull;</span>
105106
<span>{licenseSuffix || licenseKey?.slice(-8)}</span>
106107
</div>

src/Shared/Components/DevtronLicenseCard/licenseCard.scss

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
.license-card {
2-
background: radial-gradient(340.2% 100% at 0% 0%) !important;
3-
box-shadow:
4-
0px 1px 1px 0px rgba(0, 0, 0, 0.04),
5-
0px 2px 6px 0px rgba(0, 0, 0, 0.04),
6-
0px 4px 12px 0px rgba(0, 0, 0, 0.1);
7-
2+
83
.trial-license-badge {
94
background-color: var(--bg-hover);
105
letter-spacing: 0.55px;

src/Shared/Providers/ThemeProvider/utils.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ export const getThemeConfigFromLocalStorage = (): ThemeConfigType => {
7272

7373
export const getComponentSpecificThemeClass = (appTheme: AppThemeType) => `component-specific-theme__${appTheme}`
7474

75+
export const getThemeOppositeThemeClass = (appTheme: AppThemeType) =>
76+
appTheme === AppThemeType.dark
77+
? `component-specific-theme__${AppThemeType.light}`
78+
: `component-specific-theme__${AppThemeType.dark}`
79+
7580
export const getThemePreferenceText = (themePreference: ThemePreferenceType): string => {
7681
switch (themePreference) {
7782
case 'auto':

0 commit comments

Comments
 (0)