From 2f4104dfb78c9621e063c838b3d1f981fc9e13ff Mon Sep 17 00:00:00 2001 From: Nicolas Beaussart Date: Tue, 7 Feb 2023 08:45:42 +0100 Subject: [PATCH] console: fix bootstrap dropdown button not working as intended PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7837 GitOrigin-RevId: fb4e895dc89e4b8575ad7a26173acc6e400d5438 --- .../Common/DropdownButton/DropdownButton.tsx | 90 ++++++++++++++----- 1 file changed, 68 insertions(+), 22 deletions(-) diff --git a/frontend/libs/console/legacy-ce/src/lib/components/Common/DropdownButton/DropdownButton.tsx b/frontend/libs/console/legacy-ce/src/lib/components/Common/DropdownButton/DropdownButton.tsx index 4be15844ba4..548055e8329 100644 --- a/frontend/libs/console/legacy-ce/src/lib/components/Common/DropdownButton/DropdownButton.tsx +++ b/frontend/libs/console/legacy-ce/src/lib/components/Common/DropdownButton/DropdownButton.tsx @@ -1,7 +1,6 @@ import React from 'react'; import InputGroup from 'react-bootstrap/lib/InputGroup'; -import DropdownButton from 'react-bootstrap/lib/DropdownButton'; -import MenuItem from 'react-bootstrap/lib/MenuItem'; +import * as DropdownMenu from '@radix-ui/react-dropdown-menu'; type DropDownButtonProps = { title: string; @@ -24,6 +23,18 @@ type DropDownButtonProps = { inputStyle?: Record; }; +/* +Hello traveler of the old code. +This was originally made using react boostrap, but for some reason, react boostrap +stopped having the dropdown working. This was migrated 1:1 using radix ui +in order to have the old code still work. + +This is not to be used with newer code !!!!!!! + */ + +// because the previous code was doing some wierd things with non existing attributes +/* eslint-disable @typescript-eslint/ban-ts-comment */ + const DDButton: React.FC = props => { const { title, @@ -43,26 +54,61 @@ const DDButton: React.FC = props => { } = props; return ( - - {dropdownOptions.map((d, i) => ( - - {d.display_text} - - ))} - + + + + + + + + {dropdownOptions.map((d, i) => ( + + + + ))} + + + +