]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-16463 Improve title hierarchy on rule description
authorMathieu Suen <mathieu.suen@sonarsource.com>
Wed, 8 Jun 2022 07:38:43 +0000 (09:38 +0200)
committersonartech <sonartech@sonarsource.com>
Wed, 8 Jun 2022 20:02:53 +0000 (20:02 +0000)
server/sonar-web/src/main/js/app/styles/style.css
server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsDescription.tsx
server/sonar-web/src/main/js/apps/issues/components/IssueTabViewer.tsx

index 5fc30094730e4edfa001b671c1bebc4a31d06b73..ede5ef7c2164a5a95551622173dc08bf95965e80 100644 (file)
   margin: 1em 0;
 }
 
-.rule-desc h2,
 .markdown h2 {
   font-size: var(--bigFontSize);
   font-weight: 400;
 }
 
-.rule-desc h3,
 .markdown h3,
-.rule-desc h4,
 .markdown h4,
-.rule-desc h5,
 .markdown h5,
-.rule-desc h6,
 .markdown h6 {
   font-size: var(--baseFontSize);
   font-weight: 600;
 }
 
+.rule-desc h2 {
+  font-size: 20px;
+  font-weight: 400;
+  border-bottom: 1px solid #e6e6e6;
+}
+
+.rule-desc h3 {
+  font-size: 18px;
+  font-weight: 500;
+}
+.rule-desc h4 {
+  font-size: 14px;
+  font-weight: 700;
+}
+
+.rule-desc h5,
+.rule-desc h6 {
+  font-size: var(--baseFontSize);
+  font-weight: 600;
+}
+
 .rule-desc pre,
 .markdown pre,
 .rule-desc code,
index a400ae0e4022c9e3628da06e91d30fb49c3589f5..004f7facacad49b6925195ff8ff73bbed118b916 100644 (file)
@@ -211,7 +211,7 @@ export default class RuleDetailsDescription extends React.PureComponent<Props, S
     if (section.key === RuleDescriptionSections.DEFAULT) {
       return (
         <section
-          className="coding-rules-detail-description rule-desc markdown"
+          className="coding-rules-detail-description markdown"
           key={section.key}
           /* eslint-disable-next-line react/no-danger */
           dangerouslySetInnerHTML={{ __html: sanitizeString(section.content) }}
@@ -226,7 +226,7 @@ export default class RuleDetailsDescription extends React.PureComponent<Props, S
         : translate('coding_rules.description_section.title', section.key);
 
     return (
-      <section className="coding-rules-detail-description rule-desc markdown" key={section.key}>
+      <section className="coding-rules-detail-description rule-desc" key={section.key}>
         <h2>{title}</h2>
         <div
           /* eslint-disable-next-line react/no-danger */
index 94e5cdc6d1776c58754ebf3033dddfba060e2b2f..8ebe71635d0c50de6174e0e37fc6637dfcd20905 100644 (file)
@@ -42,6 +42,7 @@ interface Tab {
   key: TabKeys;
   label: React.ReactNode;
   content: string;
+  isDefault: boolean;
 }
 
 export enum TabKeys {
@@ -91,21 +92,27 @@ export default class IssueViewerTabs extends React.PureComponent<Props, State> {
           [RuleDescriptionSections.DEFAULT, RuleDescriptionSections.ROOT_CAUSE].includes(
             section.key
           )
-        )?.content
+        )?.content,
+        isDefault:
+          ruleDetails.descriptionSections?.find(
+            section => section.key === RuleDescriptionSections.DEFAULT
+          ) !== undefined
       },
       {
         key: TabKeys.HowToFixIt,
         label: translate('issue.tabs', TabKeys.HowToFixIt),
         content: ruleDetails.descriptionSections?.find(
           section => section.key === RuleDescriptionSections.HOW_TO_FIX
-        )?.content
+        )?.content,
+        isDefault: false
       },
       {
         key: TabKeys.Resources,
         label: translate('issue.tabs', TabKeys.Resources),
         content: ruleDetails.descriptionSections?.find(
           section => section.key === RuleDescriptionSections.RESOURCES
-        )?.content
+        )?.content,
+        isDefault: false
       }
     ].filter(tab => tab.content !== undefined) as Array<Tab>;
 
@@ -155,8 +162,10 @@ export default class IssueViewerTabs extends React.PureComponent<Props, State> {
           {tabs.slice(1).map(tab => (
             <div
               key={tab.key}
-              className={classNames('markdown big-padded', {
-                hidden: currentTabKey !== tab.key
+              className={classNames('big-padded', {
+                hidden: currentTabKey !== tab.key,
+                markdown: tab.isDefault,
+                'rule-desc': !tab.isDefault
               })}
               // eslint-disable-next-line react/no-danger
               dangerouslySetInnerHTML={{ __html: sanitizeString(tab.content) }}