Skip to content

Commit

Permalink
CDE-54 fix: fix eslint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Aiga115 committed Feb 26, 2024
1 parent 250a81c commit 0e142d8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 27 deletions.
2 changes: 1 addition & 1 deletion lib/CdeContextProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const CdeContextProvider = ({
const [loadingMessage, setLoadingMessage] = useState<string | null>(null);
const [errorMessage, setErrorMessage] = useState<string | null>(null);

let checked = JSON.parse(localStorage.getItem('isCheckboxChecked') || 'false');
const checked = JSON.parse(localStorage.getItem('isCheckboxChecked') || 'false');
const [isTourOpen, setIsTourOpen] = useState<boolean>(!checked);

// Defines the mapping of the mandatory columns in the dataset mapping file
Expand Down
2 changes: 1 addition & 1 deletion lib/components/common/CheckBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ interface ICheckbox {
label: string;
sx?: SxProps<Theme>;
checked?: boolean;
onChange?: (e: any) => void;
onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
}

const Checkbox: React.FC<ICheckbox> = ({label = '', sx = {}, checked, onChange}) => {
Expand Down
2 changes: 1 addition & 1 deletion lib/components/common/StyledCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ interface StyledCardProps {
handleTourNextStepClick: () => void;
}

const StyledCard: React.FC<StyledCardProps> = ({value, isSuggested, selectedValue, onChange, label, handleTourNextStepClick}) => {
const StyledCard: React.FC<StyledCardProps> = ({value, isSuggested, selectedValue, onChange, handleTourNextStepClick}) => {
const radioGroup = useRadioGroup();
let checked = false;

Expand Down
31 changes: 7 additions & 24 deletions lib/components/common/Tour.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useState } from 'react';
import Joyride, { ACTIONS, EVENTS, STATUS, CallBackProps, Step } from 'react-joyride';
import Joyride, { ACTIONS, EVENTS, STATUS, CallBackProps, Step, TooltipRenderProps } from 'react-joyride';
import { Box, Typography, Button, IconButton } from '@mui/material';
import Checkbox from './CheckBox';
import { TutorialCloseIcon } from '../../icons';
Expand All @@ -8,19 +8,6 @@ import { useCdeContext } from '../../CdeContext';

const { baseWhite, gray300, gray500, gray600, primary600, primary700, tutorialOverlayColor, tooltipBoxShadow, gray100, gray900 } = vars;

interface TooltipProps {
continuous: boolean,
index: number
isLastStep: boolean
size: number
step: any
backProps: any
closeProps: any
primaryProps: any
skipProps: any
tooltipProps: any
};

const Tooltip = ({
continuous,
index,
Expand All @@ -32,22 +19,20 @@ const Tooltip = ({
tooltipProps,
skipProps,
size
}: TooltipProps) => {
}: TooltipRenderProps) => {
const {
styles: {
tooltip: tooltipStyle,
tooltipTitle,
tooltipContent,
tooltipFooter
},
placement,
spotlightClicks,
hideBackButton,
hideCloseButton,
hideFooter
} = step;

let isChecked = JSON.parse(localStorage.getItem('isCheckboxChecked') || 'false');
const isChecked = JSON.parse(localStorage.getItem('isCheckboxChecked') || 'false');
const [checked, setChecked] = useState(isChecked);

const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
Expand All @@ -59,19 +44,17 @@ const Tooltip = ({
<Box
className="tooltip"
{...tooltipProps}
{...tooltipStyle}
{...placement}
{...spotlightClicks}
sx={tooltipStyle}
>
{step.title && (
<Box className='tooltip-title' {...tooltipTitle}>
<Box className='tooltip-title' sx={tooltipTitle}>
{step.title}
<IconButton {...skipProps} sx={{ padding: 0, margin: 0, '&:hover': { background: 'transparent' } }}>
<TutorialCloseIcon />
</IconButton>
</Box>
)}
<Box className='tooltip-content' {...tooltipContent}>
<Box className='tooltip-content' sx={tooltipContent}>
{step.content}
<Checkbox
label='Dont show on startup (accessible on the header)'
Expand All @@ -87,7 +70,7 @@ const Tooltip = ({
}}
/>
</Box>
<Box className='tooltip-footer' {...tooltipFooter}>
<Box className='tooltip-footer' sx={tooltipFooter}>
<Typography variant='caption' sx={{ color: gray500 }}>{index + 1} of {size}</Typography>
{continuous && !hideFooter && (
<Box display="flex" gap={1}>
Expand Down

0 comments on commit 0e142d8

Please sign in to comment.