]> source.dussan.org Git - sonarqube.git/commitdiff
Fix tooltip and events icon styling on project activity page
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>
Thu, 6 Jul 2017 09:55:22 +0000 (11:55 +0200)
committerGrégoire Aubert <gregoire.aubert@sonarsource.com>
Thu, 13 Jul 2017 12:34:17 +0000 (14:34 +0200)
server/sonar-web/src/main/js/apps/projectActivity/components/EventInner.js
server/sonar-web/src/main/js/apps/projectActivity/components/GraphsTooltipsContentEvents.js
server/sonar-web/src/main/js/apps/projectActivity/components/GraphsTooltipsContentOverview.js
server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAnalysis.js
server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/GraphsTooltipsContentEvents-test.js [new file with mode: 0644]
server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/GraphsTooltipsContentEvents-test.js.snap [new file with mode: 0644]
server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/GraphsTooltipsContentOverview-test.js.snap
server/sonar-web/src/main/js/apps/projectActivity/components/projectActivity.css
server/sonar-web/src/main/js/components/ui/FormattedDate.js

index 13152f46f94085a90033ef381cddcd43a3d28a62..c6c5f8f09c1b0c43f73f62141f982945ec6811ee 100644 (file)
@@ -32,7 +32,7 @@ export default function EventInner(props: { event: EventType }) {
       <div className="project-activity-event-inner">
         <div className="project-activity-event-inner-icon little-spacer-right">
           <ProjectEventIcon
-            className={'text-text-bottom project-activity-event-icon ' + event.category}
+            className={'project-activity-event-icon margin-align ' + event.category}
           />
         </div>
         <span className="project-activity-event-inner-text">
index 589d607d2d8f6560f210cec55986e53acf198fef..4348f21e87206993739015c64fa6130f62157ea1 100644 (file)
@@ -33,12 +33,16 @@ export default function GraphsTooltipsContentEvents({ events }: Props) {
       <tr><td className="project-activity-graph-tooltip-separator" colSpan="3"><hr /></td></tr>
       {events.map(event => (
         <tr key={event.key} className="project-activity-graph-tooltip-line">
-          <td className="spacer-right thin">
-            <ProjectEventIcon className={'project-activity-event-icon ' + event.category} />
+          <td className="text-top spacer-right thin">
+            <ProjectEventIcon
+              className={'project-activity-event-icon margin-align ' + event.category}
+            />
           </td>
           <td colSpan="2">
-            <span>{translate('event.category', event.category)}:</span>
-            {' '} {event.name}
+            <span className="little-spacer-right">
+              {translate('event.category', event.category)}:
+            </span>
+            {event.name}
           </td>
         </tr>
       ))}
index cd9c643710f9c714a1ee55902a1a117d89fad0a5..f16476bd41e3985181bb0a71091a7b83c5278903 100644 (file)
@@ -56,7 +56,7 @@ export default function GraphsTooltipsContentOverview(props: Props) {
           )}
         />
       </td>
-      <td className="text-right spacer-right thin">
+      <td className="text-right spacer-right">
         <span className="project-activity-graph-tooltip-value">{props.value}</span>
         {ratingValue && <Rating className="spacer-left" small={true} value={ratingValue} />}
       </td>
index 4ccb7cb971830d2892be9e1f174d1c4058149d26..842b3ff8a4472c27af7cbf358349df24c858247b 100644 (file)
@@ -60,12 +60,9 @@ export default class ProjectActivityAnalysis extends React.PureComponent {
         role="listitem"
         tabIndex="0">
         <div className="project-activity-time spacer-right">
-          <FormattedDate date={date} format="LT" tooltipFormat="LTS" />
+          <FormattedDate className="text-middle" date={date} format="LT" tooltipFormat="LTS" />
         </div>
-        <div
-          className="project-activity-analysis-icon little-spacer-top big-spacer-right"
-          title={analysisTitle}
-        />
+        <div className="project-activity-analysis-icon big-spacer-right" title={analysisTitle} />
 
         {canAdmin &&
           <div className="project-activity-analysis-actions spacer-left">
diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/GraphsTooltipsContentEvents-test.js b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/GraphsTooltipsContentEvents-test.js
new file mode 100644 (file)
index 0000000..0dc9d74
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+import React from 'react';
+import { shallow } from 'enzyme';
+import GraphsTooltipsContentEvents from '../GraphsTooltipsContentEvents';
+
+const EVENTS = [
+  {
+    key: '1',
+    category: 'VERSION',
+    name: '6.5'
+  },
+  {
+    key: '2',
+    category: 'OTHER',
+    name: 'Foo'
+  }
+];
+
+it('should render correctly', () => {
+  expect(shallow(<GraphsTooltipsContentEvents events={EVENTS} />)).toMatchSnapshot();
+});
diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/GraphsTooltipsContentEvents-test.js.snap b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/GraphsTooltipsContentEvents-test.js.snap
new file mode 100644 (file)
index 0000000..af1efe6
--- /dev/null
@@ -0,0 +1,58 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`should render correctly 1`] = `
+<tbody>
+  <tr>
+    <td
+      className="project-activity-graph-tooltip-separator"
+      colSpan="3"
+    >
+      <hr />
+    </td>
+  </tr>
+  <tr
+    className="project-activity-graph-tooltip-line"
+  >
+    <td
+      className="text-top spacer-right thin"
+    >
+      <ProjectEventIcon
+        className="project-activity-event-icon margin-align VERSION"
+      />
+    </td>
+    <td
+      colSpan="2"
+    >
+      <span
+        className="little-spacer-right"
+      >
+        event.category.VERSION
+        :
+      </span>
+      6.5
+    </td>
+  </tr>
+  <tr
+    className="project-activity-graph-tooltip-line"
+  >
+    <td
+      className="text-top spacer-right thin"
+    >
+      <ProjectEventIcon
+        className="project-activity-event-icon margin-align OTHER"
+      />
+    </td>
+    <td
+      colSpan="2"
+    >
+      <span
+        className="little-spacer-right"
+      >
+        event.category.OTHER
+        :
+      </span>
+      Foo
+    </td>
+  </tr>
+</tbody>
+`;
index 71b89ced18e9af2feda57371ceb9a501209ac412..e7f3e105fca6cb761010fdff833c87b9abb69217 100644 (file)
@@ -12,7 +12,7 @@ exports[`should render correctly 1`] = `
     />
   </td>
   <td
-    className="text-right spacer-right thin"
+    className="text-right spacer-right"
   >
     <span
       className="project-activity-graph-tooltip-value"
@@ -44,7 +44,7 @@ exports[`should render correctly when rating data is missing 1`] = `
     />
   </td>
   <td
-    className="text-right spacer-right thin"
+    className="text-right spacer-right"
   >
     <span
       className="project-activity-graph-tooltip-value"
index 903bd9ff4f950d00a0647f86c9caf7893df5da1b..35b512759920324939aa8f691e30869fc2705d1b 100644 (file)
   float: left;
   width: 10px;
   height: 10px;
-  margin-top: 4px;
+  margin-top: 5px;
   border: 2px solid #4b9fd5;
   border-radius: 10px;
   box-sizing: border-box;
   margin-left: 4px;
 }
 
+.project-activity-event-icon.margin-align {
+  margin-top: 3px;
+}
+
 .project-activity-event-icon.VERSION {
   color: #4b9fd5;
 }
index 3c67005b7bf6a614703e41c9bbc0c9cf0296a48a..04b0abc49ae820dc53e20f7b9d95fdf10930ad8d 100644 (file)
@@ -23,6 +23,7 @@ import moment from 'moment';
 
 export default class FormattedDate extends React.PureComponent {
   props: {
+    className?: string,
     date: string | number,
     format?: string,
     tooltipFormat?: string
@@ -33,14 +34,14 @@ export default class FormattedDate extends React.PureComponent {
   };
 
   render() {
-    const { date, format, tooltipFormat } = this.props;
+    const { className, date, format, tooltipFormat } = this.props;
 
     const m = moment(date);
 
     const title = tooltipFormat ? m.format(tooltipFormat) : undefined;
 
     return (
-      <time dateTime={m.format()} title={title}>
+      <time className={className} dateTime={m.format()} title={title}>
         {m.format(format)}
       </time>
     );