mirror of
https://github.com/we-promise/sure.git
synced 2026-04-07 06:21:23 +00:00
fix: Remove additional padding from JS controller and add directly as a class (#1007)
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
<%= turbo_stream_from account %>
|
||||
|
||||
<%= turbo_frame_tag id do %>
|
||||
<%= tag.div class: "space-y-4 pb-32" do %>
|
||||
<%= tag.div class: "space-y-4 pb-5 lg:pb-32" do %>
|
||||
<%= render "accounts/show/header", account: account, title: title, subtitle: subtitle %>
|
||||
|
||||
<%= render UI::Account::Chart.new(account: account, period: chart_period, view: chart_view) %>
|
||||
|
||||
<div class="min-h-[800px]" data-testid="account-details">
|
||||
<div data-testid="account-details">
|
||||
<% if tabs.count > 1 %>
|
||||
<%= render DS::Tabs.new(active_tab: active_tab, url_param_key: "tab") do |tabs_container| %>
|
||||
<% tabs_container.with_nav(classes: "max-w-fit") do |nav| %>
|
||||
|
||||
@@ -1,46 +1,26 @@
|
||||
import { Controller } from "@hotwired/stimulus"
|
||||
|
||||
export default class extends Controller {
|
||||
static targets = ["content", "bottomNav"]
|
||||
|
||||
connect() {
|
||||
this.updateViewport()
|
||||
this.updateBottomSpacing()
|
||||
|
||||
window.addEventListener("resize", this.handleResize)
|
||||
window.addEventListener("orientationchange", this.handleResize)
|
||||
this.boundResize = this.handleResize.bind(this)
|
||||
|
||||
if (this.hasBottomNavTarget) {
|
||||
this.resizeObserver = new ResizeObserver(() => {
|
||||
this.updateBottomSpacing()
|
||||
})
|
||||
this.resizeObserver.observe(this.bottomNavTarget)
|
||||
}
|
||||
window.addEventListener("resize", this.boundResize)
|
||||
window.addEventListener("orientationchange", this.boundResize)
|
||||
}
|
||||
|
||||
disconnect() {
|
||||
window.removeEventListener("resize", this.handleResize)
|
||||
window.removeEventListener("orientationchange", this.handleResize)
|
||||
|
||||
if (this.resizeObserver) {
|
||||
this.resizeObserver.disconnect()
|
||||
}
|
||||
window.removeEventListener("resize", this.boundResize)
|
||||
window.removeEventListener("orientationchange", this.boundResize)
|
||||
}
|
||||
|
||||
handleResize = () => {
|
||||
handleResize() {
|
||||
this.updateViewport()
|
||||
this.updateBottomSpacing()
|
||||
}
|
||||
|
||||
updateViewport() {
|
||||
const height = window.innerHeight
|
||||
document.documentElement.style.setProperty("--app-height", `${height}px`)
|
||||
}
|
||||
|
||||
updateBottomSpacing() {
|
||||
if (!this.hasBottomNavTarget || !this.hasContentTarget) return
|
||||
|
||||
const navHeight = this.bottomNavTarget.offsetHeight
|
||||
this.contentTarget.style.paddingBottom = `${navHeight}px`
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ end %>
|
||||
<% end %>
|
||||
|
||||
<%# SHARED - Main content %>
|
||||
<%= tag.main class: class_names("grow overflow-y-auto px-3 lg:px-10 w-full mx-auto"), data: { app_layout_target: "content", viewport_target: "content" } do %>
|
||||
<%= tag.main class: class_names("grow overflow-y-auto px-3 lg:px-10 w-full mx-auto pb-[calc(5rem+env(safe-area-inset-bottom))] lg:pb-0"), data: { app_layout_target: "content", viewport_target: "content" } do %>
|
||||
<% unless intro_mode %>
|
||||
<div class="hidden lg:flex gap-2 items-center justify-between mb-6 sticky top-0 z-10 -mx-3 lg:-mx-10 px-3 lg:px-10 py-4 bg-surface border-b border-tertiary">
|
||||
<div class="flex items-center gap-2">
|
||||
|
||||
Reference in New Issue
Block a user