Skip to content

Commit

Permalink
Add option for defaultTheme under Typograhy (bug-1072)
Browse files Browse the repository at this point in the history
  • Loading branch information
shaked-hayek committed Mar 16, 2024
1 parent a45d88f commit 4487b78
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions src/components/atoms/Typography.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,20 @@ import MaterialTypography from '@material-ui/core/Typography';
import { makeStyles } from '@material-ui/core/styles';
import { Variant } from '@material-ui/core/styles/createTypography';

interface IBold {
interface IProps {
bold?: boolean;
defaultTheme?: boolean;
}

interface IText {
[property: string]: FC<IBold>;
[property: string]: FC<IProps>;
}

interface ITypographyBase {
bold?: boolean;
variant: Variant;
component: ElementType;
defaultTheme?: boolean;
}

const useStyles = makeStyles(() => ({
Expand All @@ -28,8 +30,8 @@ const useBold = (bold = false) => {
return bold ? classes.bold : '';
};

const TypographyBase: FC<ITypographyBase> = ({ bold, variant, component, children }) => (
<MaterialTypography className={useBold(bold)} variant={variant} component={component}>
const TypographyBase: FC<ITypographyBase> = ({ bold, defaultTheme, variant, component, children }) => (
<MaterialTypography className={useBold(bold)} variant={variant} component={component} color={defaultTheme ? "textPrimary" : undefined}>
{children}
</MaterialTypography>
);
Expand Down
2 changes: 1 addition & 1 deletion src/components/molecules/NewsFlashFilterPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const NewsFlashFilterPanel: FC<IProps> = () => {
key={filter}
>
{filter === SourceFilterEnum.all ? (
<Typography.Title2>{t('filterPanel.all')}</Typography.Title2>
<Typography.Title2 defaultTheme>{t('filterPanel.all')}</Typography.Title2>
) : (
<img className={classes.image} src={logo} alt={filter} />
)}
Expand Down

0 comments on commit 4487b78

Please sign in to comment.