Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG-1072] Add option for defaultTheme under Typograhy #1076

Merged
merged 1 commit into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading