Skip to content

Commit

Permalink
properly add Mit-AdornmentButton class (#1574)
Browse files Browse the repository at this point in the history
  • Loading branch information
gumaerc authored Sep 18, 2024
1 parent 23b5e38 commit 5cc7b5e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions frontends/ol-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"@types/react-dom": "^18.3.0",
"@types/tinycolor2": "^1.4.6",
"api": "workspace:*",
"classnames": "^2.5.1",
"iso-639-1": "^3.1.2",
"lodash": "^4.17.21",
"material-ui-popup-state": "^5.1.0",
Expand Down
9 changes: 7 additions & 2 deletions frontends/ol-components/src/components/Input/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import styled from "@emotion/styled"
import InputBase from "@mui/material/InputBase"
import type { InputBaseProps } from "@mui/material/InputBase"
import type { Theme } from "@mui/material/styles"
import ClassNames from "classnames"

type Size = NonNullable<InputBaseProps["size"]>

Expand Down Expand Up @@ -218,15 +219,19 @@ type AdornmentButtonProps = React.ComponentProps<typeof AdornmentButtonStyled>
* click. The button is still focusable via keyboard events. You can override
* this behavior by passing your own `onMouseDown` handler.
*/
const AdornmentButton: React.FC<AdornmentButtonProps> = (props) => {
const AdornmentButton: React.FC<AdornmentButtonProps> = ({
className,
...others
}) => {
return (
<AdornmentButtonStyled
/**
* If the input is focused and user clicks the AdornmentButton, we don't
* want to steal focus from the input.
*/
onMouseDown={noFocus}
{...props}
className={ClassNames("Mit-AdornmentButton", className)}
{...others}
/>
)
}
Expand Down
3 changes: 2 additions & 1 deletion yarn.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5cc7b5e

Please sign in to comment.