Skip to content

Commit

Permalink
web: have InstrumentedButton use MUI Button instead of a plain ol' bu…
Browse files Browse the repository at this point in the history
…tton (#4874)
  • Loading branch information
landism committed Aug 20, 2021
1 parent 39122ff commit 0f4b58b
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 5 deletions.
8 changes: 7 additions & 1 deletion web/src/OverviewButton.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
import styled from "styled-components"
import { ApiButton } from "./ApiButton"
import { AnimDuration, Color, Font } from "./style-helpers"
import {
AnimDuration,
Color,
Font,
mixinResetButtonStyle,
} from "./style-helpers"

export const OverviewButtonMixin = `
${mixinResetButtonStyle};
font-family: ${Font.sansSerif};
display: flex;
align-items: center;
Expand Down
15 changes: 11 additions & 4 deletions web/src/instrumentedComponents.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React, { LegacyRef } from "react"
import { Button, ButtonProps } from "@material-ui/core"
import React from "react"
import { AnalyticsAction, incr, Tags } from "./analytics"

export type InstrumentedButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {
export type InstrumentedButtonProps = ButtonProps & {
analyticsName: string
analyticsTags?: Tags
ref?: LegacyRef<HTMLButtonElement>
}

export function InstrumentedButton(props: InstrumentedButtonProps) {
Expand All @@ -18,5 +18,12 @@ export function InstrumentedButton(props: InstrumentedButtonProps) {
onClick(e)
}
}
return <button onClick={instrumentedOnClick} {...buttonProps} />
return (
<Button
variant="outlined"
disableRipple={true}
onClick={instrumentedOnClick}
{...buttonProps}
/>
)
}
11 changes: 11 additions & 0 deletions web/src/style-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,17 @@ export const mixinResetButtonStyle = `
margin: 0;
font-family: inherit;
cursor: pointer;
// undo Material UI's Button styling
// TODO - maybe we should be doing it like this? https://material-ui.com/customization/globals/#css
letter-spacing: normal;
min-width: 0px;
text-transform: none;
line-height: normal;
font-size: ${FontSize.smallest};
&:hover {
background-color: transparent;
}
`

export const mixinTruncateText = `
Expand Down

0 comments on commit 0f4b58b

Please sign in to comment.