Skip to content

Commit 03352c0

Browse files
committed
Enhance mobile add new dropdown functionality and styling in the top navigation bar. Update CSS for improved dropdown appearance and ensure submenu items are conditionally displayed based on visibility settings.
1 parent 319f473 commit 03352c0

4 files changed

Lines changed: 72 additions & 7 deletions

File tree

dt-assets/build/css/light.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dt-assets/build/css/style.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dt-assets/parts/nav-topbar.php

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -237,11 +237,32 @@
237237
<?php endif; // end advanced search ?>
238238

239239
<!-- add new -->
240-
<button style="margin-left: 5px;">
241-
<a href="<?php echo esc_url( home_url( '/contacts/new' ) ); ?>">
242-
<img title="<?php echo esc_html( __( 'Add Record', 'disciple_tools' ) ); ?>" src="<?php echo esc_url( get_template_directory_uri() . '/dt-assets/images/circle-add-green.svg' ); ?>" style="width: 24px;">
243-
</a>
244-
</button>
240+
<?php if ( isset( $dt_nav_tabs['admin']['add_new']['hidden'] ) && empty( $dt_nav_tabs['admin']['add_new']['hidden'] ) ) : ?>
241+
<div class="has-submenu" style="margin-left: 5px; position: relative; display: inline-block;">
242+
<button type="button" data-toggle="mobile-add-new-dropdown">
243+
<img title="<?php echo esc_html( $dt_nav_tabs['admin']['add_new']['label'] ?? __( 'Add Record', 'disciple_tools' ) ); ?>"
244+
src="<?php echo esc_url( $dt_nav_tabs['admin']['add_new']['icon'] ?? get_template_directory_uri() . '/dt-assets/images/circle-add-green.svg' ); ?>"
245+
style="width: 24px;">
246+
</button>
247+
<div class="dropdown-pane" id="mobile-add-new-dropdown" data-dropdown data-position="bottom" data-alignment="right" data-v-offset="10">
248+
<ul class="menu vertical">
249+
<?php if ( isset( $dt_nav_tabs['admin']['add_new']['submenu'] ) && ! empty( $dt_nav_tabs['admin']['add_new']['submenu'] ) ) : ?>
250+
<?php foreach ( $dt_nav_tabs['admin']['add_new']['submenu'] as $dt_nav_submenu ) : ?>
251+
<?php if ( ! isset( $dt_nav_submenu['hidden'] ) || ! $dt_nav_submenu['hidden'] ) { ?>
252+
<li>
253+
<a class="add-new-menu-item" href="<?php echo esc_url( $dt_nav_submenu['link'] ) ?>">
254+
<img title="<?php echo esc_html( $dt_nav_submenu['label'] ); ?>"
255+
src="<?php echo esc_url( $dt_nav_submenu['icon'] ?? get_template_directory_uri() . '/dt-assets/images/circle-add-green.svg' ) ?>">
256+
<span><?php echo esc_html( $dt_nav_submenu['label'] ); ?></span>
257+
</a>
258+
</li>
259+
<?php } ?>
260+
<?php endforeach; ?>
261+
<?php endif; ?>
262+
</ul>
263+
</div>
264+
</div>
265+
<?php endif; // end add new ?>
245266

246267
</div>
247268
</div>

dt-assets/scss/_main.scss

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,50 @@ html[dir="rtl"] #top-bar-menu {
400400
}
401401
}
402402

403+
// Mobile add new dropdown styling
404+
#mobile-add-new-dropdown {
405+
background-color: #3f729b;
406+
border: 1px solid #2a5674;
407+
border-radius: 4px;
408+
min-width: 180px;
409+
max-width: 200px;
410+
padding: 8px;
411+
412+
.menu.vertical {
413+
margin: 0;
414+
415+
li {
416+
margin: 0;
417+
418+
.add-new-menu-item {
419+
display: flex;
420+
align-items: center;
421+
padding: 8px 12px;
422+
color: white;
423+
text-decoration: none;
424+
border-radius: 2px;
425+
transition: background-color 0.2s;
426+
427+
&:hover {
428+
background-color: #4a7fa8;
429+
}
430+
431+
img {
432+
width: 16px;
433+
height: 16px;
434+
margin-right: 8px;
435+
flex-shrink: 0;
436+
}
437+
438+
span {
439+
font-size: 14px;
440+
white-space: nowrap;
441+
}
442+
}
443+
}
444+
}
445+
}
446+
403447
nav.second-bar {
404448
padding: 0.5em;
405449
background-color: white;

0 commit comments

Comments
 (0)