]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-22616 Fix Activity graph dropdown/select buttons
authorDavid Cho-Lerat <david.cho-lerat@sonarsource.com>
Thu, 25 Jul 2024 10:05:37 +0000 (12:05 +0200)
committersonartech <sonartech@sonarsource.com>
Thu, 25 Jul 2024 20:02:50 +0000 (20:02 +0000)
server/sonar-web/src/main/js/components/activity-graph/AddGraphMetric.tsx
server/sonar-web/src/main/js/components/activity-graph/GraphsHeader.tsx

index 709fd8f98ea1f1749ac84872c919f1b0f1afd103..d8dda386b1205188438b542c9c735036ef642313 100644 (file)
@@ -17,8 +17,9 @@
  * along with this program; if not, write to the Free Software Foundation,
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
-import { Button } from '@sonarsource/echoes-react';
-import { ChevronDownIcon, Dropdown, TextMuted } from 'design-system';
+
+import { Button, IconChevronDown } from '@sonarsource/echoes-react';
+import { Dropdown, TextMuted } from 'design-system';
 import { sortBy } from 'lodash';
 import * as React from 'react';
 import { MetricKey, MetricType } from '~sonar-aligned/types/metrics';
@@ -152,14 +153,11 @@ export default class AddGraphMetric extends React.PureComponent<Props, State> {
           />
         }
       >
-        <Button
-          className={
-            'sw-ml-2 sw-body-sm sw-flex sw-flex-row sw-justify-between sw-pl-3 sw-pr-2 sw-w-32 ' +
-            'sw-z-normal' // needed because the legends overlap part of the button
-          }
-        >
-          <TextMuted text={translate('project_activity.graphs.custom.add')} />
-          <ChevronDownIcon className="sw-ml-1 sw-mr-0 sw-pr-0" />
+        <Button suffix={<IconChevronDown />}>
+          <TextMuted
+            className="sw-body-sm sw-flex"
+            text={translate('project_activity.graphs.custom.add')}
+          />
         </Button>
       </Dropdown>
     );
index 84838048d9111117ed33c14876a321c0fb2aee47..8390f89174f890f7c4bcbf4886db0a7fa22f4fd0 100644 (file)
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-import { Button, DropdownMenu, DropdownMenuAlign } from '@sonarsource/echoes-react';
-import { ChevronDownIcon, TextMuted } from 'design-system';
+import {
+  Button,
+  ButtonGroup,
+  DropdownMenu,
+  DropdownMenuAlign,
+  IconChevronDown,
+} from '@sonarsource/echoes-react';
+import { TextMuted } from 'design-system';
 import * as React from 'react';
 import { translate } from '../../helpers/l10n';
 import { GraphType } from '../../types/project-activity';
@@ -76,17 +82,16 @@ export default function GraphsHeader(props: Props) {
 
   return (
     <div className={className}>
-      <div className="sw-flex">
+      <ButtonGroup>
         <DropdownMenu.Root align={DropdownMenuAlign.Start} id="activity-graph-type" items={options}>
           <Button
             aria-label={translate('project_activity.graphs.choose_type')}
-            className={
-              'sw-body-sm sw-flex sw-flex-row sw-justify-between sw-pl-3 sw-pr-2 sw-w-32 ' +
-              'sw-z-normal' // needed because the legends overlap part of the button
-            }
+            suffix={<IconChevronDown />}
           >
-            <TextMuted text={translate('project_activity.graphs', graph)} />
-            <ChevronDownIcon className="sw-ml-1 sw-mr-0 sw-pr-0" />
+            <TextMuted
+              className="sw-body-sm sw-flex"
+              text={translate('project_activity.graphs', graph)}
+            />
           </Button>
         </DropdownMenu.Root>
 
@@ -101,7 +106,7 @@ export default function GraphsHeader(props: Props) {
               selectedMetrics={selectedMetrics}
             />
           )}
-      </div>
+      </ButtonGroup>
     </div>
   );
 }