Skip to content

Fix CSS bug in 3 IDE themes #5951

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import React, { useState, useEffect, useRef, useMemo } from 'react'
import React, { useState, useEffect, useRef, useMemo, Ref } from 'react'
import Fuse from 'fuse.js'
import type { Chain } from '../types'
import { AppContext } from '../AppContext'
import { useIntl } from 'react-intl'
import intl, { useIntl } from 'react-intl'
import { Dropdown } from 'react-bootstrap'

function getChainDescriptor(chain: Chain): string {
if (!chain) return ''
Expand All @@ -16,6 +17,74 @@ interface DropdownProps {
selectedChain: Chain
}

export const CustomToggle = React.forwardRef(
(
{
children,
onClick,
icon,
className = ''
}: {
children: React.ReactNode
onClick: (e) => void
icon: string
className: string
},
ref: Ref<HTMLButtonElement>
) => (
<button
ref={ref}
onClick={(e) => {
e.preventDefault()
onClick(e)
}}
className={className.replace('dropdown-toggle', '')}
>
<div className="d-flex">
<div className="mr-auto text-nowrap text-truncate overflow-hidden" data-id={`dropdown-content`}>{children}</div>
{icon && (
<div className="pr-1">
<i className={`${icon} pr-1`}></i>
</div>
)}
<div>
<i className="fad fa-sort-circle"></i>
</div>
</div>
</button>
)
)

// export const CustomInputToggle = React.forwardRef(
// (
// {
// children,
// onClick,
// icon,
// className = ''
// }: {
// children: React.ReactNode
// onClick: (e) => void
// icon: string
// className: string
// },
// ref: Ref<HTMLInputElement>
// ) => {
// const intl = useIntl()
// return (
// <input
// ref={ref}
// placeholder={intl.formatMessage({ id: "contract-verification.searchableChainDropdown", defaultMessage: "Select a chain" })}
// type="text"
// onClick={(e) => {
// e.preventDefault()
// onClick(e)
// }}
// className={className.replace('dropdown-toggle', '')}
// />
// )}
// )

export const SearchableChainDropdown: React.FC<DropdownProps> = ({ label, id, setSelectedChain, selectedChain }) => {
const { chains } = React.useContext(AppContext)
const ethereumChainIds = [1, 11155111, 17000]
Expand Down Expand Up @@ -87,6 +156,38 @@ export const SearchableChainDropdown: React.FC<DropdownProps> = ({ label, id, se
)
}

const CustomInputToggle = React.forwardRef(
(
{
children,
onClick,
icon,
className = ''
}: {
children: React.ReactNode
onClick: (e) => void
icon: string
className: string
},
ref: Ref<HTMLInputElement>
) => {
const intl = useIntl()
return (
<input
ref={ref}
placeholder={intl.formatMessage({ id: "contract-verification.searchableChainDropdown", defaultMessage: "Select a chain" })}
type="text"
onClick={(e) => {
e.preventDefault()
onClick(e)
}}
onChange={handleInputChange}
value={searchTerm}
className={className.replace('dropdown-toggle', '')}
/>
)}
)

return (
<div className="dropdown mb-3" ref={dropdownRef}>
{' '}
Expand All @@ -101,7 +202,7 @@ export const SearchableChainDropdown: React.FC<DropdownProps> = ({ label, id, se
placeholder={intl.formatMessage({ id: "contract-verification.searchableChainDropdown", defaultMessage: "Select a chain" })}
className="form-control"
/>
<ul className="dropdown-menu show w-100" style={{ maxHeight: '400px', overflowY: 'auto', display: isOpen ? 'initial' : 'none' }}>
<ul className="dropdown-menu custom-dropdown-items border bg-light show w-100" style={{ maxHeight: '400px', overflowY: 'auto', display: isOpen ? 'initial' : 'none' }}>
{filteredOptions.map((chain) => (
<li
key={chain.chainId}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2895,7 +2895,7 @@ input[type="submit"].btn-block {
color: var(--text);
text-align: inherit;
white-space: nowrap;
background-color: var(--text-background);
background-color: transparent;
border: 0;
}
.dropdown-item:focus,
Expand Down
6 changes: 3 additions & 3 deletions apps/remix-ide/src/assets/css/themes/remix-dark_tvx1s2.css
Original file line number Diff line number Diff line change
Expand Up @@ -2738,10 +2738,10 @@ input[type="submit"].btn-block {
padding: 0.5rem 0;
margin: 0.125rem 0 0;
font-size: 1rem;
color: var(--text);
color: #fff;
text-align: left;
list-style: none;
background-color: var(--text-background);
background-color: #fff;
background-clip: padding-box;
border: 1px solid rgba(0, 0, 0, 0.15);
border-radius: 2px;
Expand Down Expand Up @@ -2889,7 +2889,7 @@ input[type="submit"].btn-block {
color: var(--text);
text-align: inherit;
white-space: nowrap;
background-color: var(--text-background);
background-color: transparent;
border: 0;
}
.dropdown-item:focus,
Expand Down
2 changes: 1 addition & 1 deletion apps/remix-ide/src/assets/css/themes/remix-hacker_owl.css
Original file line number Diff line number Diff line change
Expand Up @@ -2754,7 +2754,7 @@ input[type="submit"].btn-block {
color: var(--text);
text-align: left;
list-style: none;
background-color: var(--text-background);
background-color: transparent;
background-clip: padding-box;
border: 1px solid rgba(0, 0, 0, 0.15);
border-radius: 2px;
Expand Down