Skip to content

Commit 34cd49c

Browse files
Implement dark theme support for mobile: update background colors based on theme, enhance layout responsiveness, and add script to enforce dark mode on mobile devices for improved user experience.
1 parent 662a6f2 commit 34cd49c

File tree

1 file changed

+111
-12
lines changed

1 file changed

+111
-12
lines changed

examples/mobile.html

Lines changed: 111 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,32 +55,61 @@
5555
margin-top: 0 !important;
5656
}
5757

58-
/* Garantir que o fundo permaneça como está, especialmente no Kanban */
59-
body {
58+
/* Garantir que o fundo seja dark quando o tema dark estiver ativo */
59+
body.dark {
60+
background-color: #1f2937 !important;
61+
/* bg-gray-800 */
62+
}
63+
64+
body:not(.dark) {
6065
background-color: #f3f4f6 !important;
6166
/* bg-gray-100 */
6267
}
6368

64-
/* Garantir que o app não tenha fundo escuro */
65-
#app {
66-
background-color: transparent !important;
69+
/* Garantir que o app tenha fundo dark quando necessário */
70+
#app.dark {
71+
background-color: #1f2937 !important;
6772
}
6873

69-
/* Garantir que o wrapper principal não tenha fundo escuro */
70-
#app>div.flex.flex-wrap.app-wrapper {
74+
#app:not(.dark) {
7175
background-color: transparent !important;
7276
}
7377

74-
/* Corrigir fundo escuro específico do Kanban */
75-
#app>div.flex.flex-wrap.app-wrapper.dark\:text-slate-300>main>div>div {
76-
background-color: transparent !important;
78+
/* Garantir que o wrapper principal tenha fundo dark quando necessário */
79+
#app>div.flex.flex-wrap.app-wrapper.dark {
80+
background-color: #1f2937 !important;
7781
}
7882

79-
/* Garantir que o main do Kanban não tenha fundo escuro */
80-
#app>div.flex.flex-wrap.app-wrapper.dark\:text-slate-300>main {
83+
#app>div.flex.flex-wrap.app-wrapper:not(.dark) {
8184
background-color: transparent !important;
8285
}
8386

87+
88+
89+
/* Layout responsivo para Kanban no mobile */
90+
@media (max-width: 768px) {
91+
92+
/* Div mãe - forçar flex-col no mobile */
93+
#app>div.flex.flex-wrap.app-wrapper.dark\:text-slate-300>main>div>div>div.flex-1.overflow-auto>div {
94+
flex-direction: column !important;
95+
gap: 1rem !important;
96+
}
97+
98+
/* Coluna esquerda - ocupar largura total no mobile e ficar abaixo */
99+
#app>div.flex.flex-wrap.app-wrapper.dark\:text-slate-300>main>div>div>div.flex-1.overflow-auto>div>div.w-2\/3.p-8.space-y-6 {
100+
width: 100% !important;
101+
padding: 1rem !important;
102+
order: 2 !important;
103+
}
104+
105+
/* Coluna direita - ocupar largura total no mobile e ficar acima */
106+
#app>div.flex.flex-wrap.app-wrapper.dark\:text-slate-300>main>div>div>div.flex-1.overflow-auto>div>div.w-1\/3.p-4.space-y-6 {
107+
width: 100% !important;
108+
padding: 1rem !important;
109+
order: 1 !important;
110+
}
111+
}
112+
84113
.navbar-item-indicator {
85114
height: 3px;
86115
transition: all 0.3s ease;
@@ -325,6 +354,76 @@
325354
});
326355
</script>
327356

357+
<!-- Script para forçar tema dark no mobile -->
358+
<script data-name="ForceDarkTheme">
359+
document.addEventListener('DOMContentLoaded', function () {
360+
function forceDarkTheme() {
361+
// Aplicar apenas no mobile
362+
if (window.innerWidth > 768) {
363+
return;
364+
}
365+
366+
// Forçar tema dark no body
367+
document.body.classList.remove('light');
368+
document.body.classList.add('dark');
369+
370+
// Forçar tema dark no elemento app
371+
const appElement = document.getElementById('app');
372+
if (appElement) {
373+
appElement.classList.remove('light');
374+
appElement.classList.add('dark');
375+
}
376+
377+
// Forçar tema dark no wrapper principal
378+
const appWrapper = document.querySelector('#app > div.flex.flex-wrap.app-wrapper');
379+
if (appWrapper) {
380+
appWrapper.classList.remove('light');
381+
appWrapper.classList.add('dark');
382+
}
383+
384+
// Adicionar classes dark em todos os elementos filhos
385+
document.querySelectorAll('*').forEach(element => {
386+
if (!element.classList.contains('dark')) {
387+
element.classList.add('dark');
388+
}
389+
element.classList.remove('light');
390+
});
391+
392+
// Forçar cores dark via CSS
393+
document.documentElement.style.setProperty('--color-scheme', 'dark');
394+
document.documentElement.style.setProperty('color-scheme', 'dark');
395+
}
396+
397+
// Executar imediatamente
398+
forceDarkTheme();
399+
400+
// Observer para detectar mudanças no DOM
401+
const observer = new MutationObserver(function (mutations) {
402+
mutations.forEach(function (mutation) {
403+
if (mutation.addedNodes.length) {
404+
forceDarkTheme();
405+
}
406+
});
407+
});
408+
409+
// Observar mudanças no body
410+
observer.observe(document.body, {
411+
childList: true,
412+
subtree: true,
413+
attributes: true,
414+
attributeFilter: ['class']
415+
});
416+
417+
// Executar periodicamente para garantir
418+
setInterval(forceDarkTheme, 1000);
419+
420+
// Adicionar listener para resize
421+
window.addEventListener('resize', function () {
422+
forceDarkTheme();
423+
});
424+
});
425+
</script>
426+
328427
<!-- Script para customizar botão IA -->
329428
<script data-name="AIButton">
330429
document.addEventListener('DOMContentLoaded', function () {

0 commit comments

Comments
 (0)