Skip to content

Commit

Permalink
fix: minor fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Joris Mancini <joris.mancini_externe@rte-france.com>
  • Loading branch information
TheMaskedTurtle committed May 15, 2024
1 parent 1ff261a commit 0b54a76
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { Alert, AlertTitle, Grid } from '@mui/material';
import { FormattedMessage } from 'react-intl';
import { UserManager } from 'oidc-client';

interface AuthenticationRouterProps {
export interface AuthenticationRouterProps {
userManager: {
instance: UserManager;
error: string;
Expand Down
35 changes: 24 additions & 11 deletions src/components/CardErrorBoundary/card-error-boundary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,33 @@ import {
CardHeader,
Collapse,
IconButton,
IconButtonProps,
styled,
Theme,
Typography,
} from '@mui/material';
import { Replay as ReplayIcon } from '@mui/icons-material';
import {
ExpandMore as ExpandMoreIcon,
Replay as ReplayIcon,
} from '@mui/icons-material';
import { FormattedMessage } from 'react-intl';

const ExpandMore = styled(IconButton)(
({ theme, expand }: { theme?: Theme; expand: boolean }) => ({
transform: !expand ? 'rotate(0deg)' : 'rotate(180deg)',
marginLeft: 'auto',
transition: theme?.transitions.create('transform', {
duration: theme?.transitions.duration.shortest,
}),
})
);
export interface ExpandMoreProps extends IconButtonProps {
expand: boolean;
}

const ExpandMore = styled((props: ExpandMoreProps) => {
const { expand, ...other } = props;
return <IconButton {...other} />;
})(({ theme, expand }: { theme?: Theme; expand: boolean }) => ({
transform: !expand ? 'rotate(0deg)' : 'rotate(180deg)',
marginLeft: 'auto',
transition: theme?.transitions?.create('transform', {
duration: theme?.transitions?.duration?.shortest,
}),
}));

// Extracted from https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/error_boundaries/ for types

interface Props {
children?: ReactNode;
Expand Down Expand Up @@ -117,7 +128,9 @@ class CardErrorBoundary extends Component<Props, CardErrorBoundaryState> {
onClick={this.handleExpandClick}
aria-expanded={expanded}
aria-label="show more"
/>
>
<ExpandMoreIcon />
</ExpandMore>
</CardActions>
<Collapse in={expanded}>
<CardContent>
Expand Down
32 changes: 15 additions & 17 deletions src/components/ElementSearchDialog/equipment-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { Box, SxProps } from '@mui/material';
import OverflowableText from '../OverflowableText';
import { mergeSx } from '../../utils/styles';

interface EquipmentItemProps {
export interface EquipmentItemProps {
inputValue: string;
suffixRenderer: typeof TagRenderer;
element: {
Expand All @@ -24,21 +24,19 @@ interface EquipmentItemProps {
voltageLevelLabel: string;
};
showsJustText: boolean;
props: {
classes?: {
result?: string;
equipmentOption?: string;
equipmentTag?: string;
equipmentTypeTag?: string;
equipmentVlTag?: string;
};
styles?: {
result?: SxProps;
equipmentOption?: SxProps;
equipmentTag?: SxProps;
equipmentTypeTag?: SxProps;
equipmentVlTag?: SxProps;
};
classes?: {
result?: string;
equipmentOption?: string;
equipmentTag?: string;
equipmentTypeTag?: string;
equipmentVlTag?: string;
};
styles?: {
result?: SxProps;
equipmentOption?: SxProps;
equipmentTag?: SxProps;
equipmentTypeTag?: SxProps;
equipmentVlTag?: SxProps;
};
}

Expand All @@ -47,7 +45,7 @@ export const EquipmentItem = ({
suffixRenderer = TagRenderer,
element,
showsJustText = false,
props,
...props
}: EquipmentItemProps) => {
let matches = match(element.label, inputValue, {
insideWords: true,
Expand Down
2 changes: 1 addition & 1 deletion src/components/Login/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const styles = {
},
};

interface LoginProps {
export interface LoginProps {
onLoginClick: () => void;
disabled: boolean;
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Login/Logout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const styles = {
}),
};

interface LogoutProps {
export interface LogoutProps {
onLogoutClick: () => void;
disabled: boolean;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
import { FormattedMessage } from 'react-intl';
import { useState } from 'react';

interface MultipleSelectionDialogProps {
export interface MultipleSelectionDialogProps {
options: string[];
selectedOptions: string[];
open: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { useIntl } from 'react-intl';
import { FormControlLabel } from '@mui/material';
import { useController } from 'react-hook-form';

interface BooleanInputProps {
export interface BooleanInputProps {
name: string;
label: string;
formProps: any;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import BooleanInput from './boolean-input';
import { Checkbox, CheckboxProps } from '@mui/material';

interface CheckboxInputProps {
export interface CheckboxInputProps {
name: string;
label: string;
formProps: CheckboxProps;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import BooleanInput from './boolean-input';
import { Switch, SwitchProps } from '@mui/material';

interface SwitchInputProps {
export interface SwitchInputProps {
name: string;
label: string;
formProps: SwitchProps;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Slider, SliderProps } from '@mui/material';
import { useController } from 'react-hook-form';
import { identity } from '../utils/functions';

interface SliderInputProps extends SliderProps {
export interface SliderInputProps extends SliderProps {
name: string;
onValueChanged: (value: any) => void;
}
Expand Down

0 comments on commit 0b54a76

Please sign in to comment.