Skip to content

Commit 754399e

Browse files
committed
change breaksize for mobile layout
1 parent fc6acfe commit 754399e

File tree

3 files changed

+93
-21
lines changed

3 files changed

+93
-21
lines changed

dashboard.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ function onConnect() {
8787
// mqtt_client.send(message);
8888
// setStatus("Connected");
8989
$('#debug_logs').append("MQTT Client Connected!");
90-
$('#login_icon').removeClass('text-red-500');
91-
$('#login_icon').addClass('text-green-500');
90+
$('.login_icon').removeClass('text-red-500');
91+
$('.login_icon').addClass('text-green-500');
9292
}
9393

9494
// called when the mqtt_client loses its connection
@@ -98,8 +98,8 @@ function onConnectionLost(responseObject) {
9898
console.log("onConnectionLost:"+responseObject.errorMessage);
9999
}
100100
$('#debug_logs').append("onConnectionLost:"+responseObject.errorMessage);
101-
$('#login_icon').removeClass('text-green-500');
102-
$('#login_icon').addClass('text-red-500');
101+
$('.login_icon').removeClass('text-green-500');
102+
$('.login_icon').addClass('text-red-500');
103103
}
104104

105105

index.html

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919

2020

2121
<nav class="bg-white border-b border-gray-200">
22-
<div class="max-w-7xl mx-auto px-4 md:px-6 lg:px-8">
23-
<div class="hidden md:flex justify-between h-16">
22+
<div class="max-w-7xl mx-auto px-4 lg:px-6 lg:px-8">
23+
<div class="hidden lg:flex justify-between h-16">
2424
<div class="flex">
25-
<div class="hidden md:-my-px md:ml-6 md:flex md:space-x-8">
25+
<div class="hidden lg:-my-px lg:ml-6 lg:flex lg:space-x-8">
2626
<!-- Current: "border-blue-500 text-gray-900", Default: "border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700" -->
2727
<a href="#" :class="{ 'active border-blue-500 text-gray-900': tab === 'map', 'border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700': tab !== 'map' }" x-on:click.prevent="tab = 'map'" class="border-blue-500 text-gray-900 inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium" aria-current="page"> Map </a>
2828
<a href="#" :class="{ 'active border-blue-500 text-gray-900': tab === 'temperature_chart', 'border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700': tab !== 'temperature_chart' }" x-on:click.prevent="tab = 'temperature_chart'" class="border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700 inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium"> Temperture Chart </a>
@@ -31,15 +31,15 @@
3131
<a href="#" :class="{ 'active border-blue-500 text-gray-900': tab === 'settings', 'border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700': tab !== 'settings' }" x-on:click.prevent="tab = 'settings'" class="border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700 inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium"> Settings </a>
3232
</div>
3333
</div>
34-
<div class="hidden md:ml-6 md:flex md:items-center">
34+
<div class="hidden lg:ml-6 lg:flex lg:items-center">
3535

3636

3737
<!-- Profile dropdown -->
3838
<div x-data="{ isOpen: false }" @click.outside="isOpen = false" class="ml-3 relative">
3939
<div>
4040
<button type="button" @click="isOpen = !isOpen" class="max-w-xs bg-white flex items-center text-sm rounded-full" id="user-menu-button" aria-expanded="false" aria-haspopup="true">
4141
<span class="sr-only">Open user menu</span>
42-
<i id = "login_icon" class="fa-solid fa-2x fa-user-pilot text-red-500"></i>
42+
<i class="login_icon fa-solid fa-2x fa-user-pilot text-red-500"></i>
4343
</button>
4444
</div>
4545

@@ -53,7 +53,7 @@
5353
x-transition:leave-end="transform opacity-0 scale-95"
5454
class="z-20 origin-top-right absolute right-0 mt-2 w-48 rounded-md shadow-lg py-1 bg-white ring-1 ring-black ring-opacity-5 focus:outline-none" role="menu" aria-orientation="vertical" aria-labelledby="user-menu-button" tabindex="-1">
5555

56-
<a href="#" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100" role="menuitem" tabindex="-1" id="user-menu-item-2"> Sign out </a>
56+
<a href="#" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100" role="menuitem" tabindex="-1" id="user-menu-item-2"> Log out </a>
5757

5858
</div>
5959
</div>
@@ -69,14 +69,15 @@
6969

7070

7171

72-
<div class="-mr-2 flex items-center md:hidden absolute z-20 top-4 right-8">
72+
<div class="-mr-2 flex items-center lg:hidden absolute z-20 top-4 right-8">
7373
<!-- Mobile menu button -->
7474
<button type="button" @click="mobileMenuOpen = !mobileMenuOpen" class="bg-white inline-flex items-center justify-center p-2 rounded-md text-gray-400 hover:text-gray-500 hover:bg-gray-100" aria-controls="mobile-menu" aria-expanded="false">
7575
<span class="sr-only">Open main menu</span>
7676
<!-- Heroicon name: outline/menu -->
77-
<svg :class="{ 'hidden' : mobileMenuOpen , 'block' : !mobileMenuOpen}" class="h-6 w-6 hidden" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true">
77+
<!-- <svg :class="{ 'hidden' : mobileMenuOpen , 'block' : !mobileMenuOpen}" class="h-6 w-6 hidden" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true">
7878
<path stroke-linecap="round" stroke-linejoin="round" d="M4 6h16M4 12h16M4 18h16" />
79-
</svg>
79+
</svg> -->
80+
<i :class="{ 'hidden' : mobileMenuOpen , 'block' : !mobileMenuOpen}" class="login_icon fa-solid fa-2x fa-user-pilot text-red-500"></i>
8081
<!-- Heroicon name: outline/x -->
8182
<svg :class="{ 'block' : mobileMenuOpen , 'hidden' : !mobileMenuOpen}" class="h-6 w-6 hidden" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true">
8283
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />
@@ -86,7 +87,7 @@
8687

8788

8889
<!-- Mobile menu, show/hide based on mobileMenuOpen state. -->
89-
<div :class="{ 'hidden' : !mobileMenuOpen}" class="md:hidden" id="mobile-menu">
90+
<div :class="{ 'hidden' : !mobileMenuOpen}" class="lg:hidden" id="mobile-menu">
9091
<div class="pt-2 pb-3 space-y-1">
9192
<!-- Current: "bg-blue-50 border-blue-500 text-blue-700", Default: "border-transparent text-gray-600 hover:bg-gray-50 hover:border-gray-300 hover:text-gray-800" -->
9293

@@ -99,7 +100,7 @@
99100
<div class="pt-1 pb-3 border-t border-gray-200">
100101

101102
<div class="mt-3 space-y-1">
102-
<a href="#" class="block px-4 py-2 text-base font-medium text-gray-500 hover:text-gray-800 hover:bg-gray-100"> Sign out </a>
103+
<a href="#" @click="mqtt_logout()" class="block px-4 py-2 text-base font-medium text-gray-500 hover:text-gray-800 hover:bg-gray-100"> Log out </a>
103104
</div>
104105
</div>
105106
</div>
@@ -113,14 +114,14 @@
113114
<header>
114115
</header>
115116

116-
<div class="mx-auto md:px-0 lg:px-8 h-screen md:h-[55rem] w-full md:max-w-7xl">
117+
<div class="mx-auto lg:px-0 lg:px-8 h-screen lg:h-[55rem] w-full lg:max-w-7xl">
117118

118-
<div class="px-4 py-1 md:px-0 h-full">
119+
<div class="px-4 py-1 lg:px-0 h-full">
119120

120-
<div x-show="tab === 'map'" class="md:border-4 md:border-gray-200 md:rounded-lg h-full">
121+
<div x-show="tab === 'map'" class="lg:border-4 lg:border-gray-200 lg:rounded-lg h-full">
121122

122123
<!-- <div class="absolute z-20 inset-x-0 top-20 h-16 flex items-center justify-center"> -->
123-
<div :class="{ 'hidden' : mobileMenuOpen}" class="absolute inset-x-0 top-4 md:top-20 h-16 flex items-center justify-center">
124+
<div :class="{ 'hidden' : mobileMenuOpen}" class="absolute inset-x-0 top-4 lg:top-20 h-16 flex items-center justify-center">
124125
<div class = "text-3xl flex flex-row bg-white gap-y-4 gap-x-10 px-8 pt-3 pb-1 rounded-md z-20">
125126

126127
<!-- <div x-data="{battery_voltage: ''}" class = "flex flex-col">
@@ -195,9 +196,10 @@ <h3 class="text-xs mb-2 uppercase"> Speed</h3>
195196

196197

197198
<div x-show="tab === 'debug'" class="h-full">
198-
<h3>Message Logs</h3>
199+
<div class = "pt-5 h-full">
200+
<p class = "text-2xl font-bold mb-4" >Message Logs</p>
199201
<p id = "debug_logs"></p>
200-
202+
</div>
201203
</div>
202204

203205

tailwind-dist.css

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -895,6 +895,10 @@ select {
895895
margin-right: 0.5rem;
896896
}
897897

898+
.mb-4 {
899+
margin-bottom: 1rem;
900+
}
901+
898902
.block {
899903
display: block;
900904
}
@@ -1395,6 +1399,10 @@ select {
13951399
font-weight: 500;
13961400
}
13971401

1402+
.font-bold {
1403+
font-weight: 700;
1404+
}
1405+
13981406
.uppercase {
13991407
text-transform: uppercase;
14001408
}
@@ -1879,8 +1887,70 @@ select {
18791887
}
18801888

18811889
@media (min-width: 1024px) {
1890+
.lg\:top-20 {
1891+
top: 5rem;
1892+
}
1893+
1894+
.lg\:-my-px {
1895+
margin-top: -1px;
1896+
margin-bottom: -1px;
1897+
}
1898+
1899+
.lg\:ml-6 {
1900+
margin-left: 1.5rem;
1901+
}
1902+
1903+
.lg\:flex {
1904+
display: flex;
1905+
}
1906+
1907+
.lg\:hidden {
1908+
display: none;
1909+
}
1910+
1911+
.lg\:h-\[55rem\] {
1912+
height: 55rem;
1913+
}
1914+
1915+
.lg\:max-w-7xl {
1916+
max-width: 80rem;
1917+
}
1918+
1919+
.lg\:items-center {
1920+
align-items: center;
1921+
}
1922+
1923+
.lg\:space-x-8 > :not([hidden]) ~ :not([hidden]) {
1924+
--tw-space-x-reverse: 0;
1925+
margin-right: calc(2rem * var(--tw-space-x-reverse));
1926+
margin-left: calc(2rem * calc(1 - var(--tw-space-x-reverse)));
1927+
}
1928+
1929+
.lg\:rounded-lg {
1930+
border-radius: 0.5rem;
1931+
}
1932+
1933+
.lg\:border-4 {
1934+
border-width: 4px;
1935+
}
1936+
1937+
.lg\:border-gray-200 {
1938+
--tw-border-opacity: 1;
1939+
border-color: rgb(229 231 235 / var(--tw-border-opacity));
1940+
}
1941+
18821942
.lg\:px-8 {
18831943
padding-left: 2rem;
18841944
padding-right: 2rem;
18851945
}
1946+
1947+
.lg\:px-6 {
1948+
padding-left: 1.5rem;
1949+
padding-right: 1.5rem;
1950+
}
1951+
1952+
.lg\:px-0 {
1953+
padding-left: 0px;
1954+
padding-right: 0px;
1955+
}
18861956
}

0 commit comments

Comments
 (0)