Skip to content

Speakr is a personal, self-hosted web application designed for transcribing audio recordings

Python

Header buttons: one size on phones (40 px squares), one height on wider screens, no sticky grey after a tap

Murtaza Nasir08d92eda0d90
diff --git a/static/css/primitives.css b/static/css/primitives.css
index 379c8bc3..332a78f5 100644
--- a/static/css/primitives.css
+++ b/static/css/primitives.css
@@ -570,10 +570,36 @@ html.dark {
.btn--icon:not(.btn--primary):not(.btn--danger):not(.btn--ghost):not(.btn--quiet) {
color: var(--text-muted);
}
-.btn--icon:not(.btn--primary):not(.btn--danger):not(.btn--ghost):not(.btn--quiet):hover:not(:disabled) {
+/* Hover tint only where a pointer really hovers: a touch screen keeps
+ :hover after a tap, which left a grey box on the last button tapped. */
+@media (hover: hover) {
+ .btn--icon:not(.btn--primary):not(.btn--danger):not(.btn--ghost):not(.btn--quiet):hover:not(:disabled) {
+ background: var(--bg-tertiary);
+ color: var(--text-primary);
+ }
+}
+.btn--icon:not(.btn--primary):not(.btn--danger):not(.btn--ghost):not(.btn--quiet):active:not(:disabled) {
background: var(--bg-tertiary);
color: var(--text-primary);
}
+
+/* Page header buttons: one height for icon and labelled buttons, and on
+ phones (labels hidden) one square size for all of them. */
+.btn.header-action {
+ min-height: 36px;
+}
+.btn.header-action.btn--icon {
+ width: 36px;
+}
+@media (max-width: 639px) {
+ .btn.header-action,
+ .btn.header-action.btn--icon {
+ width: 40px;
+ min-height: 40px;
+ padding: 0;
+ justify-content: center;
+ }
+}
.btn--icon.btn--lg {
width: 44px;
min-height: 44px;
diff --git a/templates/components/header-controls.html b/templates/components/header-controls.html
index b70945b9..9fa53593 100644
--- a/templates/components/header-controls.html
+++ b/templates/components/header-controls.html
@@ -12,7 +12,7 @@
= primary-success, New Recording = primary). -->
<!-- Inquire Mode Button -->
{% if inquire_mode_enabled %}
- <a href="/inquire" class="btn btn--sm" style="background: var(--bg-accent); color: var(--text-accent); border-color: transparent;">
+ <a href="/inquire" class="btn btn--sm header-action" style="background: var(--bg-accent); color: var(--text-accent); border-color: transparent;">
<i class="fas fa-search"></i>
<span class="hidden sm:inline" v-text="t('inquire.title')"></span>
</a>
@@ -21,7 +21,7 @@
<!-- Install PWA Button -->
<button v-if="showInstallButton && !isPWAInstalled"
@click="promptInstall"
- class="btn btn--sm"
+ class="btn btn--sm header-action"
style="background: #16a34a; color: #fff; border-color: transparent;"
:title="t('pwa.installApp')">
<i class="fas fa-download"></i>
@@ -29,7 +29,7 @@
</button>
<!-- New Recording Button -->
- <button @click="switchToUploadView" class="btn btn--sm btn--primary">
+ <button @click="switchToUploadView" class="btn btn--sm btn--primary header-action">
<i class="fas fa-plus"></i><span class="hidden sm:inline" v-text="t('nav.newRecording')"></span>
</button>
@@ -38,7 +38,7 @@
<div class="relative">
<button @click="isUserMenuOpen = !isUserMenuOpen"
data-user-menu-toggle
- class="btn btn--icon relative"
+ class="btn btn--icon header-action relative"
:title="t('admin.userMenu')">
<i class="fas fa-user-circle text-lg"></i>
<!-- Unread badge. The menu is the only always-visible anchor
diff --git a/templates/components/header.html b/templates/components/header.html
index 2b1c35b5..6c6aa14c 100644
--- a/templates/components/header.html
+++ b/templates/components/header.html
@@ -11,7 +11,7 @@
padding reads as extra space before the logo when it is not
hovered. Pulling the logo in balances bars-logo-title. -->
<button @click="toggleSidebar"
- class="btn btn--icon flex-shrink-0 sm:-mr-1.5"
+ class="btn btn--icon header-action flex-shrink-0 sm:-mr-1.5"
:title="isSidebarCollapsed ? t('tooltips.showSidebar') : t('tooltips.hideSidebar')">
<i class="fas fa-bars text-lg"></i>
</button>