0
0
mirror of https://github.com/go-gitea/gitea.git synced 2024-11-28 08:28:40 +01:00
gitea/web_src/css/modules/tippy.css
Giteabot ab344a36e3
Rework and fix stopwatch (#30732) (#30787)
Backport #30732 by @silverwind

Fixes https://github.com/go-gitea/gitea/issues/30721 and overhauls the
stopwatch. Time is now shown inside the "dot" icon and on both mobile
and desktop. All rendering is now done by `<relative-time>`, the
`pretty-ms` dependency is dropped.

Desktop:
<img width="557" alt="Screenshot 2024-04-29 at 22 33 27"
src="https://github.com/go-gitea/gitea/assets/115237/3a46cdbf-6af2-4bf9-b07f-021348badaac">

Mobile:
<img width="640" alt="Screenshot 2024-04-29 at 22 34 19"
src="https://github.com/go-gitea/gitea/assets/115237/8a2beea7-bd5d-473f-8fff-66f63fd50877">

Note for tippy:
Previously, tippy instances defaulted to "menu" theme, but that theme is
really only meant for `.ui.menu`, so it was not optimal for the
stopwatch popover.

This introduces a unopinionated `default` theme that has no padding and
should be suitable for all content. I reviewed all existing uses and
explicitely set the desired `theme` on all of them.

Co-authored-by: silverwind <me@silverwind.io>
2024-04-30 21:46:45 +00:00

170 lines
3.6 KiB
CSS

/* styles are based on node_modules/tippy.js/dist/tippy.css */
/* class to hide tippy target elements on page load */
.tippy-target {
display: none !important;
}
/* show target element once it's been moved by tippy.js */
.tippy-content .tippy-target {
display: unset !important;
}
[data-tippy-root] {
max-width: calc(100vw - 32px);
}
.tippy-box {
position: relative;
background-color: var(--color-menu);
color: var(--color-text);
border: 1px solid var(--color-secondary);
border-radius: var(--border-radius);
font-size: 1rem;
}
.tippy-content {
position: relative;
z-index: 1;
}
/* bare theme, no styling at all, except box-shadow */
.tippy-box[data-theme="bare"] {
border: none;
box-shadow: 0 6px 18px var(--color-shadow);
}
.tippy-box[data-theme="bare"] .tippy-content {
padding: 0;
background: transparent;
}
/* tooltip theme for text tooltips */
.tippy-box[data-theme="tooltip"] {
background-color: var(--color-tooltip-bg);
color: var(--color-tooltip-text);
border: none;
}
.tippy-box[data-theme="tooltip"] .tippy-content {
padding: 0.5rem 1rem;
}
.tippy-box[data-theme="tooltip"] .tippy-svg-arrow-inner,
.tippy-box[data-theme="tooltip"] .tippy-svg-arrow-outer {
fill: var(--color-tooltip-bg);
}
/* menu theme for .ui.menu */
.tippy-box[data-theme="menu"] {
background-color: var(--color-menu);
color: var(--color-text);
box-shadow: 0 6px 18px var(--color-shadow);
}
.tippy-box[data-theme="menu"] .tippy-content {
padding: 4px 0;
}
.tippy-box[data-theme="menu"] .tippy-svg-arrow-inner {
fill: var(--color-menu);
}
.tippy-box[data-theme="menu"] .item {
display: flex;
align-items: center;
padding: 9px 18px;
color: inherit;
text-decoration: none;
gap: 10px;
}
.tippy-box[data-theme="menu"] .item:hover {
background: var(--color-hover);
}
.tippy-box[data-theme="menu"] .item:focus {
background: var(--color-active);
}
/* box-with-header theme to look like .ui.attached.segment. can contain .ui.attached.header */
.tippy-box[data-theme="box-with-header"] {
box-shadow: 0 6px 18px var(--color-shadow);
}
.tippy-box[data-theme="box-with-header"] .tippy-content {
background: var(--color-box-body);
border-radius: var(--border-radius);
padding: 0;
}
.tippy-box[data-theme="box-with-header"][data-placement^="top"] .tippy-svg-arrow-inner {
fill: var(--color-box-body);
}
.tippy-box[data-theme="box-with-header"][data-placement^="bottom"] .tippy-svg-arrow-inner {
fill: var(--color-box-header);
}
.tippy-box[data-placement^="top"] > .tippy-svg-arrow {
bottom: 0;
}
.tippy-box[data-placement^="top"] > .tippy-svg-arrow::after,
.tippy-box[data-placement^="top"] > .tippy-svg-arrow > svg {
top: 16px;
transform: rotate(180deg);
}
.tippy-box[data-placement^="bottom"] > .tippy-svg-arrow {
top: 0;
}
.tippy-box[data-placement^="bottom"] > .tippy-svg-arrow > svg {
bottom: 16px;
}
.tippy-box[data-placement^="left"] > .tippy-svg-arrow {
right: 0;
}
.tippy-box[data-placement^="left"] > .tippy-svg-arrow::after,
.tippy-box[data-placement^="left"] > .tippy-svg-arrow > svg {
transform: rotate(90deg);
top: calc(50% - 3px);
left: 11px;
}
.tippy-box[data-placement^="right"] > .tippy-svg-arrow {
left: 0;
}
.tippy-box[data-placement^="right"] > .tippy-svg-arrow::after,
.tippy-box[data-placement^="right"] > .tippy-svg-arrow > svg {
transform: rotate(-90deg);
top: calc(50% - 3px);
right: 11px;
}
.tippy-svg-arrow {
width: 16px;
height: 16px;
text-align: initial;
}
.tippy-svg-arrow,
.tippy-svg-arrow > svg {
position: absolute;
}
.tippy-svg-arrow-outer {
fill: var(--color-secondary);
}
.tippy-svg-arrow-inner {
fill: var(--color-menu);
}