Skip to content
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
16 changes: 12 additions & 4 deletions frontends/mit-open/src/page-components/Header/MenuButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Button, styled } from "ol-components"
import { styled } from "ol-components"
import { RiMenuLine } from "@remixicon/react"
import React from "react"

Expand All @@ -23,22 +23,30 @@ const MenuButtonInner = styled.div({
alignItems: "flex-start",
})

const StyledMenuButton = styled(Button)({
const StyledMenuButton = styled.button(({ theme }) => ({
padding: "0",
background: "transparent",
"&:hover:not(:disabled)": {
background: "transparent",
},
touchAction: "none",
})
textAlign: "center",
display: "inline-flex",
justifyContent: "center",
alignItems: "center",
color: theme.palette.text.primary,
transition: `background ${theme.transitions.duration.short}ms`,
cursor: "pointer",
borderStyle: "none",
}))

interface MenuButtonProps {
text?: string
onClick: React.MouseEventHandler<HTMLButtonElement> | undefined
}

const MenuButton: React.FC<MenuButtonProps> = ({ text, onClick }) => (
<StyledMenuButton variant="text" onPointerDown={onClick}>
<StyledMenuButton onPointerDown={onClick}>
<MenuButtonInner>
<MenuIcon />
{text ? <MenuButtonText>{text}</MenuButtonText> : ""}
Expand Down
2 changes: 2 additions & 0 deletions frontends/ol-components/src/components/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ const ButtonStyled = styled.button<ButtonStyleProps>((props) => {
":disabled": {
cursor: "default",
},
minWidth: "100px",
Copy link
Contributor

@ChristopherChudzicki ChristopherChudzicki Jun 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our tab component is based on Button (it uses tertiary buttons). So this increases the width, of tabs, too.

@steven-hatch Do we want tabs to have min-width 100px? I can see pros/cons

Screenshot 2024-06-27 at 4 24 31 PM Screenshot 2024-06-27 at 4 24 42 PM Screenshot 2024-06-27 at 4 25 01 PM Screenshot 2024-06-27 at 4 25 18 PM

Really the only con is width on mobile screens.

Separate issue

Screenshot 2024-06-27 at 4 29 45 PM

In the screenshots above, you can see the mobile menu button in top-left corner now has wrong width.

@shanbady I'm sorry this came up... Button should not have been used for that in the first place. (Bright side: with your change, probably less likely to be used incorrectly for stuff like this.)

But, could you fix it so we don't regress? Probably that menu button should be a "Snowflake". I would just apply the relevant styles to it. See figma: https://www.figma.com/design/Eux3guSenAFVvNHGi1Y9Wm/MIT-Design-System?node-id=3852-51162&m=dev

The code is in frontends/mit-open/src/page-components/Header/MenuButton.tsx

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be addressed now @ChristopherChudzicki

},
...sizeStyles(size, hasBorder, theme),
// responsive
Expand Down Expand Up @@ -303,6 +304,7 @@ type ActionButtonProps = Omit<ButtonStyleProps, "startIcon" | "endIcon"> &

const actionStyles = (size: ButtonSize) => {
return {
minWidth: "auto",
padding: 0,
height: {
small: "32px",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const TabButtonList: React.FC<TabListProps> = styled((props: TabListProps) => (

const tabStyles = ({ theme }: { theme: Theme }) =>
css({
minWidth: "auto",
":focus-visible": {
outlineOffset: "-1px",
},
Expand Down