diff options
author | silverwind <me@silverwind.io> | 2025-01-26 19:07:29 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-27 02:07:29 +0800 |
commit | 9875f9b9b8a6800d3a409deb6fa639df245e21f5 (patch) | |
tree | 20e692256babbdba6e7d297697bfde79b7e40cdb | |
parent | e663c4a7f0905bf97e4bc6c081102054635fc9c6 (diff) | |
download | gitea-9875f9b9b8a6800d3a409deb6fa639df245e21f5.tar.gz gitea-9875f9b9b8a6800d3a409deb6fa639df245e21f5.zip |
Clone button enhancements (#33362)
- Add box-shadow to default tippy theme
- Make colors for tabs match the ones from `.ui.tabular.menu`
- Remove tippy arrow and slightly offset tooltip closer to the button
- Fix setting of `aria-haspopup` when default role is used with tippy
---------
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
-rw-r--r-- | web_src/css/modules/tippy.css | 4 | ||||
-rw-r--r-- | web_src/css/repo.css | 2 | ||||
-rw-r--r-- | web_src/css/repo/clone.css | 4 | ||||
-rw-r--r-- | web_src/js/features/repo-common.ts | 1 | ||||
-rw-r--r-- | web_src/js/modules/tippy.ts | 5 |
5 files changed, 12 insertions, 4 deletions
diff --git a/web_src/css/modules/tippy.css b/web_src/css/modules/tippy.css index 55b9751cc6..4438a31c9d 100644 --- a/web_src/css/modules/tippy.css +++ b/web_src/css/modules/tippy.css @@ -28,6 +28,10 @@ z-index: 1; } +.tippy-box[data-theme="default"] { + box-shadow: 0 6px 18px var(--color-shadow); +} + /* bare theme, no styling at all, except box-shadow */ .tippy-box[data-theme="bare"] { border: none; diff --git a/web_src/css/repo.css b/web_src/css/repo.css index c40b175638..2752174f86 100644 --- a/web_src/css/repo.css +++ b/web_src/css/repo.css @@ -1630,7 +1630,7 @@ td .commit-summary { } .repo-button-row-left { - flex: 1; + flex-grow: 1; } .repo-button-row .button { diff --git a/web_src/css/repo/clone.css b/web_src/css/repo/clone.css index 3f6a1323fe..c6887fbf16 100644 --- a/web_src/css/repo/clone.css +++ b/web_src/css/repo/clone.css @@ -20,10 +20,12 @@ .clone-panel-tab .item { padding: 5px 10px; background: none; + color: var(--color-text-light-2); } .clone-panel-tab .item.active { - border-bottom: 3px solid var(--color-secondary); + color: var(--color-text-dark); + border-bottom: 3px solid currentcolor; } .clone-panel-tab + .divider { diff --git a/web_src/js/features/repo-common.ts b/web_src/js/features/repo-common.ts index fb76d8ed36..2f62d51597 100644 --- a/web_src/js/features/repo-common.ts +++ b/web_src/js/features/repo-common.ts @@ -99,6 +99,7 @@ function initClonePanelButton(btn: HTMLButtonElement) { placement: 'bottom-end', interactive: true, hideOnClick: true, + arrow: false, }); } diff --git a/web_src/js/modules/tippy.ts b/web_src/js/modules/tippy.ts index bc6d5bfdd6..af715f48b9 100644 --- a/web_src/js/modules/tippy.ts +++ b/web_src/js/modules/tippy.ts @@ -42,16 +42,17 @@ export function createTippy(target: Element, opts: TippyOpts = {}): Instance { visibleInstances.add(instance); return onShow?.(instance); }, - arrow: arrow || (theme === 'bare' ? false : arrowSvg), + arrow: arrow ?? (theme === 'bare' ? false : arrowSvg), // HTML role attribute, ideally the default role would be "popover" but it does not exist role: role || 'menu', // CSS theme, either "default", "tooltip", "menu", "box-with-header" or "bare" theme: theme || role || 'default', + offset: [0, arrow ? 10 : 6], plugins: [followCursor], ...other, } satisfies Partial<Props>); - if (role === 'menu') { + if (instance.props.role === 'menu') { target.setAttribute('aria-haspopup', 'true'); } |