From cfe0e349627c25b03a1dfce4f5db33e8ebd85f2a Mon Sep 17 00:00:00 2001
From: Fred Tingaud
<95592999+frederic-tingaud-sonarsource@users.noreply.github.com>
Date: Fri, 28 Jan 2022 15:17:25 +0100
Subject: [PATCH] RULEAPI-729: Reduce title fonts to make the page more
readable
---
frontend/src/RulePage.tsx | 126 +++++++++++-------
.../__snapshots__/RulePage.test.tsx.snap | 57 +++-----
2 files changed, 98 insertions(+), 85 deletions(-)
diff --git a/frontend/src/RulePage.tsx b/frontend/src/RulePage.tsx
index 656f1e5475..564a06aad2 100644
--- a/frontend/src/RulePage.tsx
+++ b/frontend/src/RulePage.tsx
@@ -6,7 +6,7 @@ import Typography from '@material-ui/core/Typography';
import Tabs from '@material-ui/core/Tabs';
import Tab from '@material-ui/core/Tab';
import Box from '@material-ui/core/Box';
-import { Link } from '@material-ui/core';
+import { createMuiTheme, Link, ThemeProvider } from '@material-ui/core';
import Highlight from 'react-highlight';
import { Link as RouterLink, useHistory } from 'react-router-dom';
import { RULE_STATE, useRuleCoverage } from './utils/useRuleCoverage';
@@ -15,8 +15,26 @@ import { RuleMetadata } from './types';
import './hljs-humanoid-light.css';
-
const useStyles = makeStyles((theme) => ({
+ '@global': {
+ h1: {
+ fontSize: '1.6rem',
+ fontWeight: 500,
+ marginTop: theme.spacing(3),
+ marginBottom: theme.spacing(3)
+ },
+ h2: {
+ color: '#0B3C62',
+ fontSize: '1.2rem'
+ },
+ h3: {
+ fontSize: '1rem',
+ color: '#25699D'
+ },
+ hr: {
+ color: '#F9F9FB'
+ }
+ },
ruleBar: {
borderBottom: '1px solid lightgrey',
},
@@ -24,6 +42,7 @@ const useStyles = makeStyles((theme) => ({
textAlign: 'center',
marginTop: theme.spacing(3),
marginBottom: theme.spacing(3),
+ color: 'black'
},
ruleidLink: {
color: 'inherit',
@@ -43,7 +62,7 @@ const useStyles = makeStyles((theme) => ({
// style used to center the tabs when there too few of them to fill the container
tabRoot: {
- justifyContent: "center"
+ justifyContent: 'center'
},
tabScroller: {
flexGrow: 0
@@ -55,7 +74,7 @@ const useStyles = makeStyles((theme) => ({
tab: {
display: 'flex',
- "&::before": {
+ '&::before': {
content: '""',
display: 'block',
width: theme.spacing(1),
@@ -69,17 +88,17 @@ const useStyles = makeStyles((theme) => ({
}
},
coveredTab: {
- "&::before": {
+ '&::before': {
backgroundColor: RULE_STATE['covered'].color,
}
},
targetedTab: {
- "&::before": {
+ '&::before': {
backgroundColor: RULE_STATE['targeted'].color,
}
},
removedTab: {
- "&::before": {
+ '&::before': {
backgroundColor: RULE_STATE['removed'].color,
}
},
@@ -95,6 +114,8 @@ const useStyles = makeStyles((theme) => ({
},
}));
+const theme = createMuiTheme({});
+
const languageToJiraProject = new Map(Object.entries({
'PYTHON': 'SONARPY',
'ABAP': 'SONARABAP',
@@ -189,6 +210,11 @@ function ticketsAndImplementationPRsLinks(ruleNumber: string, title: string, lan
}
}
+function RuleThemeProvider({ children }: any) {
+ useStyles();
+ return