Skip to content

Commit

Permalink
fix: add max-height to button menu on mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
timaramazanov committed Apr 29, 2024
1 parent 8c1214a commit 561af33
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/components/video-button/Video-button.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import styles from "./Video-button.styles.css?inline";
import { closestElement } from "../../helpers/closest";
import { when } from "lit/directives/when.js";
import { ifDefined } from "lit/directives/if-defined.js";
import { createCommand } from "../../state";
import { createCommand, connect } from "../../state";
import { eventCode } from "../../helpers/event";
import { isMobile } from "../../helpers/ismobile";

Expand All @@ -22,7 +22,7 @@ export class VideoButton extends LitElement {
* Specifies the offset distance of the tooltip from the button.
*/
@property({ type: Number, attribute: "tooltip-offset" })
tooltipOffset = 40;
tooltipOffset = isMobile() ? 30 : 40;

/**
* Determines whether the button should display a tooltip.
Expand All @@ -38,6 +38,10 @@ export class VideoButton extends LitElement {
@property({ attribute: "tooltip-position" })
tooltipPosition: Placement = "top";

@connect('isFullscreen')
@property({ type: Boolean, attribute: 'is-fullscreen', reflect: true })
isFullscreen: Boolean

@query(".tooltip")
tooltip: HTMLElement;

Expand Down
7 changes: 7 additions & 0 deletions src/components/video-button/Video-button.styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ button {
}
}

@media (max-width: 640px) {
:host(:not([is-fullscreen])) .menu {
max-height: 150px;
overflow: auto;
}
}

.menu .inner {
padding: 0;
}

0 comments on commit 561af33

Please sign in to comment.