Skip to content

Commit

Permalink
fix(shared-react): move css styles from css file to the Status compon…
Browse files Browse the repository at this point in the history
…ent (#2601)
  • Loading branch information
debsmita1 authored Dec 13, 2024
1 parent 88fb7ce commit 3ae105b
Show file tree
Hide file tree
Showing 5 changed files with 155 additions and 36 deletions.
5 changes: 5 additions & 0 deletions .changeset/selfish-bobcats-applaud.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@janus-idp/shared-react": patch
---

moved css styles from css file to the Status component
1 change: 1 addition & 0 deletions plugins/shared-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"@kubernetes/client-node": "^0.22.1",
"@material-ui/core": "^4.12.4",
"@mui/icons-material": "5.15.17",
"@mui/material": "^5.15.17",
"classnames": "^2.3.2",
"date-fns": "^2.30.0",
"file-saver": "^2.0.5",
Expand Down
30 changes: 0 additions & 30 deletions plugins/shared-react/src/components/common/StatusIconAndText.css

This file was deleted.

28 changes: 22 additions & 6 deletions plugins/shared-react/src/components/common/StatusIconAndText.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,28 @@
import React from 'react';

import { makeStyles } from '@material-ui/core/styles';
import Typography from '@mui/material/Typography';
import classNames from 'classnames';

import CamelCaseWrap from './CamelCaseWrap';

import './StatusIconAndText.css';

const DASH = '-';

const useStyles = makeStyles({
iconAndText: {
alignItems: 'baseline',
display: 'flex',
fontWeight: 400,
fontSize: '14px',
},

flexChild: {
flex: ' 0 0 auto',
position: 'relative',
top: '0.125em',
},
});

export const StatusIconAndText = ({
icon,
title,
Expand All @@ -23,6 +38,7 @@ export const StatusIconAndText = ({
spin?: boolean;
dataTestId?: string;
}): React.ReactElement => {
const styles = useStyles();
if (!title) {
return <>{DASH}</>;
}
Expand All @@ -39,20 +55,20 @@ export const StatusIconAndText = ({
}

return (
<span
className={classNames('bs-shared-icon-and-text', className)}
<Typography
className={classNames(styles.iconAndText, className)}
data-testid={dataTestId ?? `icon-with-title-${title}`}
title={title}
>
{React.cloneElement(icon, {
className: classNames(
spin && 'fa-spin',
icon.props.className,
'bs-shared-icon-and-text__icon bs-shared-icon-flex-child',
styles.flexChild,
),
})}
<CamelCaseWrap value={title} dataTest="status-text" />
</span>
</Typography>
);
};

Expand Down
127 changes: 127 additions & 0 deletions yarn.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3ae105b

Please sign in to comment.