diff options
author | silverwind <me@silverwind.io> | 2023-06-09 11:10:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-09 09:10:51 +0000 |
commit | 6a075589bf2aefeeee67613c76b750628ce1618e (patch) | |
tree | 2fa80b2b1a7e1691f1479df1fe3d6c99c02ab6a5 /web_src/js | |
parent | 623b3b590e0bcf0460c6cd9376996cb6fe221747 (diff) | |
download | gitea-6a075589bf2aefeeee67613c76b750628ce1618e.tar.gz gitea-6a075589bf2aefeeee67613c76b750628ce1618e.zip |
Fix mobile navbar and misc cleanups (#25134)
- Fix and improve mobile navbar layout
- Apply all cleanups suggested in
https://github.com/go-gitea/gitea/pull/25111
- Make media query breakpoints match Fomantic's exactly
- Clean up whitespace in class on navbar items
Mobile navbar before and after:
<img width="745" alt="Screenshot 2023-06-08 at 08 40 56"
src="https://github.com/go-gitea/gitea/assets/115237/ca84b239-b10f-41db-8c06-dcf2b6dd9d28">
<img width="739" alt="Screenshot 2023-06-08 at 08 41 23"
src="https://github.com/go-gitea/gitea/assets/115237/09133c54-eb7e-4110-858c-ead23c3b7521">
---------
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Giteabot <teabot@gitea.io>
Diffstat (limited to 'web_src/js')
-rw-r--r-- | web_src/js/components/DashboardRepoList.vue | 2 | ||||
-rw-r--r-- | web_src/js/features/common-global.js | 20 | ||||
-rw-r--r-- | web_src/js/features/repo-code.js | 7 | ||||
-rw-r--r-- | web_src/js/features/repo-issue.js | 1 | ||||
-rw-r--r-- | web_src/js/modules/tippy.js | 4 |
5 files changed, 17 insertions, 17 deletions
diff --git a/web_src/js/components/DashboardRepoList.vue b/web_src/js/components/DashboardRepoList.vue index ee7d805e77..25a94c1fa7 100644 --- a/web_src/js/components/DashboardRepoList.vue +++ b/web_src/js/components/DashboardRepoList.vue @@ -12,7 +12,6 @@ </div> <a class="gt-df gt-ac muted" :href="subUrl + '/repo/create' + (isOrganization ? '?org=' + organizationId : '')" :data-tooltip-content="textNewRepo"> <svg-icon name="octicon-plus"/> - <span class="sr-only">{{ textNewRepo }}</span> </a> </h4> <div class="ui attached segment repos-search"> @@ -121,7 +120,6 @@ </div> <a class="gt-df gt-ac muted" v-if="canCreateOrganization" :href="subUrl + '/org/create'" :data-tooltip-content="textNewOrg"> <svg-icon name="octicon-plus"/> - <span class="sr-only">{{ textNewOrg }}</span> </a> </h4> <div v-if="organizations.length" class="ui attached table segment gt-rounded-bottom"> diff --git a/web_src/js/features/common-global.js b/web_src/js/features/common-global.js index 776e63a83d..cb50ebcae0 100644 --- a/web_src/js/features/common-global.js +++ b/web_src/js/features/common-global.js @@ -20,18 +20,14 @@ export function initGlobalFormDirtyLeaveConfirm() { } export function initHeadNavbarContentToggle() { - const content = $('#navbar'); - const toggle = $('#navbar-expand-toggle'); - let isExpanded = false; - toggle.on('click', () => { - isExpanded = !isExpanded; - if (isExpanded) { - content.addClass('shown'); - toggle.addClass('active'); - } else { - content.removeClass('shown'); - toggle.removeClass('active'); - } + const navbar = document.getElementById('navbar'); + const btn = document.getElementById('navbar-expand-toggle'); + if (!navbar || !btn) return; + + btn.addEventListener('click', () => { + const isExpanded = btn.classList.contains('active'); + navbar.classList.toggle('navbar-menu-open', !isExpanded); + btn.classList.toggle('active', !isExpanded); }); } diff --git a/web_src/js/features/repo-code.js b/web_src/js/features/repo-code.js index 26d8e22472..6a01a8445b 100644 --- a/web_src/js/features/repo-code.js +++ b/web_src/js/features/repo-code.js @@ -108,10 +108,15 @@ function showLineButton() { createTippy(btn, { trigger: 'click', + hideOnClick: true, content: menu, placement: 'right-start', - role: 'menu', interactive: 'true', + onShow: (tippy) => { + tippy.popper.addEventListener('click', () => { + tippy.hide(); + }, {once: true}); + } }); } diff --git a/web_src/js/features/repo-issue.js b/web_src/js/features/repo-issue.js index 175d6b1f59..0dc5728f58 100644 --- a/web_src/js/features/repo-issue.js +++ b/web_src/js/features/repo-issue.js @@ -469,7 +469,6 @@ export function initRepoPullRequestReview() { content: $panel[0], placement: 'bottom', trigger: 'click', - role: 'menu', maxWidth: 'none', interactive: true, hideOnClick: true, diff --git a/web_src/js/modules/tippy.js b/web_src/js/modules/tippy.js index d9f496fb85..b424cdfd50 100644 --- a/web_src/js/modules/tippy.js +++ b/web_src/js/modules/tippy.js @@ -27,7 +27,8 @@ export function createTippy(target, opts = {}) { visibleInstances.add(instance); }, arrow: `<svg width="16" height="7"><path d="m0 7 8-7 8 7Z" class="tippy-svg-arrow-outer"/><path d="m0 8 8-7 8 7Z" class="tippy-svg-arrow-inner"/></svg>`, - ...(opts?.role && {theme: opts.role}), + role: 'menu', // HTML role attribute, only tooltips should use "tooltip" + theme: opts.role || 'menu', // CSS theme, we support either "tooltip" or "menu" ...opts, }); @@ -68,6 +69,7 @@ function attachTooltip(target, content = null) { content, delay: 100, role: 'tooltip', + theme: 'tooltip', hideOnClick, placement: target.getAttribute('data-tooltip-placement') || 'top-start', ...(target.getAttribute('data-tooltip-interactive') === 'true' ? {interactive: true, aria: {content: 'describedby', expanded: false}} : {}), |