swarm-ui: the refresh picker of a polling card sits in the card's header row
On the jobs, builds and hives cards the picker was alone on the first line of the body. DisclosureAction puts a body's control in the header of the disclosure it is in, beside the chevron and outside the toggle, so it costs no row and pressing it does not fold the card.
This commit is contained in:
parent
262505e16a
commit
bf7345405f
2 changed files with 43 additions and 9 deletions
|
|
@ -0,0 +1,18 @@
|
|||
/* The disclosure is the positioning box; the action sits on the title line of
|
||||
its header (the header's top padding, one line of title) and to the left of
|
||||
the chevron. The hint stops short of it, so the two do not overlap. */
|
||||
.ui-disclosure {
|
||||
position: relative;
|
||||
}
|
||||
.ui-disclosure-action {
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
top: 0.75em;
|
||||
right: 2.6em;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 1.6em;
|
||||
}
|
||||
.ui-disclosure:has(.ui-disclosure-action) .ui-disclosure-hint {
|
||||
margin-right: 7em;
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
// <DisclosureAction> — a control for the header row of the disclosure it is in:
|
||||
// the refresh picker of a card that polls. The body owns the control's state, so
|
||||
// a body renders it where it needs the state, and it shows in the header, beside
|
||||
// the chevron, instead of taking a row of the body. It is a sibling of the
|
||||
// header's toggle, not inside it, so pressing it does not fold the card. A
|
||||
// disclosure that is shut has no body, so the control is there only while open.
|
||||
import type { ComponentChildren } from "preact";
|
||||
import "./DisclosureAction.css";
|
||||
|
||||
export function DisclosureAction({
|
||||
children,
|
||||
}: {
|
||||
children: ComponentChildren;
|
||||
}) {
|
||||
return <div class="ui-disclosure-action">{children}</div>;
|
||||
}
|
||||
Loading…
Reference in a new issue