mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-26 23:28:43 +00:00
fix(data): phone share editor matches desktop (#66639)
This commit is contained in:
parent
9f49f9e37a
commit
26748986e3
2 changed files with 49 additions and 44 deletions
|
|
@ -170,6 +170,10 @@ html:has([data-page="stats"] dialog[data-component="share-editor"][open]) {
|
|||
}
|
||||
/* grey-ok-end */
|
||||
|
||||
&:focus-visible {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
button {
|
||||
font: inherit;
|
||||
color: inherit;
|
||||
|
|
@ -712,7 +716,7 @@ html:has([data-page="stats"] dialog[data-component="share-editor"][open]) {
|
|||
display: contents;
|
||||
}
|
||||
|
||||
:is([data-slot="sheet-open"], [data-slot="sheet-head"], [data-slot="sheet-label"], [data-slot="sheet-backdrop"]) {
|
||||
:is([data-slot="sheet-head"], [data-slot="sheet-label"], [data-slot="sheet-backdrop"]) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
|
@ -1250,29 +1254,24 @@ html:has([data-page="stats"] dialog[data-component="share-editor"][open]) {
|
|||
padding: 16px 16px 8px;
|
||||
}
|
||||
|
||||
/* On a phone the bar wraps onto as many rows as it needs, over the card. */
|
||||
/* On a phone the bar holds Close, Settings, and Mute, Shuffle and Export, always to hand; the settings slide up in
|
||||
a sheet from the bottom, every one a full row with its name, and slide back down when it's dismissed. */
|
||||
/* On a phone the bar holds Close, then Mute, Shuffle, Customize and Save, as on wider screens; Customize slides
|
||||
the settings up in a sheet from the bottom, every one a full row with its name. */
|
||||
[data-slot="editor-bar"] {
|
||||
flex-wrap: nowrap;
|
||||
padding: calc(8px + env(safe-area-inset-top, 0px)) 8px 8px;
|
||||
}
|
||||
|
||||
[data-slot="sheet-open"] {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
align-items: center;
|
||||
height: 36px;
|
||||
padding: 0 10px;
|
||||
font-size: 13px;
|
||||
color: var(--stats-text);
|
||||
background: var(--stats-bg);
|
||||
border: 1px solid var(--stats-line-strong);
|
||||
border-radius: 0;
|
||||
|
||||
&[aria-expanded="true"] {
|
||||
[data-variant="customize"][aria-expanded="true"] {
|
||||
background: var(--stats-layer-2);
|
||||
}
|
||||
|
||||
[data-slot="bar-end"] [data-variant="primary"] {
|
||||
min-width: 72px;
|
||||
}
|
||||
}
|
||||
|
||||
/* No tooltips on a touch screen: they'd only show on focus, and at the top of the screen they'd be cut off. */
|
||||
[data-tooltip]::after {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Below the bar, so Mute, Shuffle and Export stay in reach with the sheet open. */
|
||||
|
|
@ -1378,7 +1377,18 @@ html:has([data-page="stats"] dialog[data-component="share-editor"][open]) {
|
|||
color: var(--stats-faint);
|
||||
}
|
||||
|
||||
/* Lists and the calendar open upwards in the sheet, over the rows above, as wide as their control. */
|
||||
/* More room between each icon and its label, in the controls and their lists alike, so they line up. */
|
||||
:is([data-slot="dropdown-trigger"], [data-slot="dropdown-item"]),
|
||||
[data-component="dropdown"][data-id="music"] [data-slot="dropdown-item"] {
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
[data-component="dropdown"][data-id="size"] [data-slot="dropdown-item"] {
|
||||
padding-inline-start: 9px;
|
||||
}
|
||||
|
||||
/* Lists and the calendar open upwards in the sheet, over the rows above, as wide as their control: past the
|
||||
row's name (72px and the 12px gap) where the name is inside the dropdown, the music's being outside it. */
|
||||
[data-slot="dropdown-menu"] {
|
||||
top: auto;
|
||||
inset-inline-end: 0;
|
||||
|
|
@ -1392,12 +1402,19 @@ html:has([data-page="stats"] dialog[data-component="share-editor"][open]) {
|
|||
}
|
||||
}
|
||||
|
||||
> [data-component="dropdown"] [data-slot="dropdown-menu"] {
|
||||
width: calc(100% - 84px);
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
[data-component="share-calendar"] {
|
||||
top: auto;
|
||||
right: auto;
|
||||
bottom: calc(100% + 6px);
|
||||
left: auto;
|
||||
inset-inline-end: 0;
|
||||
box-sizing: border-box;
|
||||
width: calc(100% - 84px);
|
||||
translate: none;
|
||||
animation-name: share-fade-in;
|
||||
}
|
||||
|
|
@ -1601,12 +1618,6 @@ html:has([data-page="stats"] dialog[data-component="share-editor"][open]) {
|
|||
}
|
||||
}
|
||||
|
||||
@media (max-width: 760px) {
|
||||
[data-page="stats"] dialog[data-component="share-editor"] [data-variant="customize"] {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes share-reveal {
|
||||
from {
|
||||
opacity: 0;
|
||||
|
|
|
|||
|
|
@ -342,6 +342,8 @@ export function ShareDialog(props: { updatedAt: string | null; url: string }) {
|
|||
history.future = []
|
||||
})
|
||||
dialog?.showModal()
|
||||
// The dialog takes the focus itself, so no control shows a focus ring (and Close its tooltip) until the keyboard moves.
|
||||
dialog?.focus()
|
||||
void loadShareFonts().then(() => setReady(true))
|
||||
})
|
||||
|
||||
|
|
@ -636,6 +638,7 @@ export function ShareDialog(props: { updatedAt: string | null; url: string }) {
|
|||
return (
|
||||
<dialog
|
||||
ref={dialog}
|
||||
tabIndex={-1}
|
||||
data-component="share-editor"
|
||||
data-customize={customizing() ? "" : undefined}
|
||||
style={
|
||||
|
|
@ -700,23 +703,6 @@ export function ShareDialog(props: { updatedAt: string | null; url: string }) {
|
|||
<path d="m4 4 8 8M12 4l-8 8" stroke="currentColor" stroke-width="1.5" />
|
||||
</svg>
|
||||
</button>
|
||||
{/* Phones only: the settings live in a sheet, opened from here. */}
|
||||
<button
|
||||
type="button"
|
||||
data-slot="sheet-open"
|
||||
aria-expanded={sheet() ? "true" : "false"}
|
||||
aria-controls="share-settings"
|
||||
onClick={() => setSheet(true)}
|
||||
>
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" aria-hidden="true">
|
||||
<g fill="none" stroke="currentColor" stroke-width="1.5">
|
||||
<path d="M2 4.5h6M12 4.5h2M2 11.5h2M8 11.5h6" />
|
||||
<circle cx="10" cy="4.5" r="2" />
|
||||
<circle cx="6" cy="11.5" r="2" />
|
||||
</g>
|
||||
</svg>
|
||||
<span>{i18n.t("share.settings")}</span>
|
||||
</button>
|
||||
<Show when={sheet()}>
|
||||
<div data-slot="sheet-backdrop" aria-hidden="true" onClick={() => setSheet(false)} />
|
||||
</Show>
|
||||
|
|
@ -729,7 +715,7 @@ export function ShareDialog(props: { updatedAt: string | null; url: string }) {
|
|||
aria-label={i18n.t("share.settings")}
|
||||
>
|
||||
<div data-slot="sheet-head">
|
||||
<strong>{i18n.t("share.settings")}</strong>
|
||||
<strong>{i18n.t("share.customize")}</strong>
|
||||
<button type="button" data-slot="sheet-done" onClick={() => setSheet(false)}>
|
||||
{i18n.t("share.done")}
|
||||
</button>
|
||||
|
|
@ -991,7 +977,15 @@ export function ShareDialog(props: { updatedAt: string | null; url: string }) {
|
|||
</svg>
|
||||
</button>
|
||||
<Show when={!customizing()}>
|
||||
<button type="button" data-slot="bar-button" data-variant="customize" onClick={customize}>
|
||||
<button
|
||||
type="button"
|
||||
data-slot="bar-button"
|
||||
data-variant="customize"
|
||||
aria-controls="share-settings"
|
||||
aria-expanded={sheet() ? "true" : "false"}
|
||||
// On a phone the settings open in the sheet; wider, the editor grows to show them in the bar.
|
||||
onClick={() => (matchMedia("(max-width: 760px)").matches ? setSheet(true) : customize())}
|
||||
>
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" aria-hidden="true">
|
||||
<g fill="none" stroke="currentColor" stroke-width="1.5">
|
||||
<path d="M2 4.5h6M12 4.5h2M2 11.5h2M8 11.5h6" />
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue