1
1
mirror of https://github.com/go-gitea/gitea synced 2025-01-31 03:54:28 +00:00

Clone button enhancements (#33362) (#33404)

Backport #33362 by @silverwind

- 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

<img width="335" alt="image"
src="https://github.com/user-attachments/assets/8633ebac-a43f-457a-86bd-7a88a83519ee"
/>

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
Giteabot 2025-01-27 02:20:57 +08:00 committed by GitHub
parent 12347f07ae
commit 2196ba5e42
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 12 additions and 4 deletions

View File

@ -28,6 +28,10 @@
z-index: 1; 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 */ /* bare theme, no styling at all, except box-shadow */
.tippy-box[data-theme="bare"] { .tippy-box[data-theme="bare"] {
border: none; border: none;

View File

@ -1669,7 +1669,7 @@ td .commit-summary {
} }
.repo-button-row-left { .repo-button-row-left {
flex: 1; flex-grow: 1;
} }
.repo-button-row .button { .repo-button-row .button {

View File

@ -20,10 +20,12 @@
.clone-panel-tab .item { .clone-panel-tab .item {
padding: 5px 10px; padding: 5px 10px;
background: none; background: none;
color: var(--color-text-light-2);
} }
.clone-panel-tab .item.active { .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 { .clone-panel-tab + .divider {

View File

@ -99,6 +99,7 @@ function initClonePanelButton(btn: HTMLButtonElement) {
placement: 'bottom-end', placement: 'bottom-end',
interactive: true, interactive: true,
hideOnClick: true, hideOnClick: true,
arrow: false,
}); });
} }

View File

@ -42,16 +42,17 @@ export function createTippy(target: Element, opts: TippyOpts = {}): Instance {
visibleInstances.add(instance); visibleInstances.add(instance);
return onShow?.(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 // HTML role attribute, ideally the default role would be "popover" but it does not exist
role: role || 'menu', role: role || 'menu',
// CSS theme, either "default", "tooltip", "menu", "box-with-header" or "bare" // CSS theme, either "default", "tooltip", "menu", "box-with-header" or "bare"
theme: theme || role || 'default', theme: theme || role || 'default',
offset: [0, arrow ? 10 : 6],
plugins: [followCursor], plugins: [followCursor],
...other, ...other,
} satisfies Partial<Props>); } satisfies Partial<Props>);
if (role === 'menu') { if (instance.props.role === 'menu') {
target.setAttribute('aria-haspopup', 'true'); target.setAttribute('aria-haspopup', 'true');
} }