mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-22 07:56:18 -05:00
files: left-align the preview toolbar (#698)
* files: left-align the preview toolbar, Open joins the button row The modal actions row packs its children to the right, which suits a confirming button but stranded the preview's toolbar. The toolbar now fills the row so its buttons read from the left, with Open first in the same row as Download. On phones the tags selector always takes its own line instead of squeezing in beside the buttons. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * tags: the add-tag button is violet like every other tag button Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * share: a real button everywhere but the navbar corner The share trigger was a bare anchor-wrapped glyph, which matched the navbar's other corner icons but looked out of place beside real buttons in the file preview toolbar. It is an IconButton by default now; the navbar keeps the bare glyph via asIcon. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
9b8ebdc9b3
commit
88d5d55283
6 changed files with 30 additions and 12 deletions
|
|
@ -266,6 +266,10 @@ pre.wrap-text {
|
|||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 0.5em;
|
||||
/* Fill the actions row: `.wrolpi-modal-actions` packs its children to the right, which
|
||||
is where a confirming button belongs but strands this toolbar. At full width the
|
||||
toolbar's own layout wins and everything reads from the left. */
|
||||
flex: 1 1 100%;
|
||||
}
|
||||
|
||||
.preview-toolbar-group {
|
||||
|
|
@ -281,6 +285,14 @@ pre.wrap-text {
|
|||
min-width: 0;
|
||||
}
|
||||
|
||||
/* On a phone the tags selector always gets its own line rather than squeezing in beside
|
||||
the buttons. 700px is the app's `tablet` breakpoint (`AppMedia` in contexts.js). */
|
||||
@media (max-width: 699px) {
|
||||
.preview-toolbar-tags {
|
||||
flex-basis: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
/* Caps preview content to fit inside the file-preview Modal.
|
||||
300px reserves room for pathContent <pre>, Modal.Header, Modal.Actions row,
|
||||
inner content (e.g. STL dimensions banner), and modal padding.
|
||||
|
|
|
|||
|
|
@ -583,7 +583,9 @@ export function AddTagsButton({
|
|||
<IconButton
|
||||
icon={active ? 'tags' : 'tag'}
|
||||
label={active ? 'Tags applied' : 'Add tag'}
|
||||
role='primary'
|
||||
// Violet is the tagging color everywhere: the file browser's Tag button already
|
||||
// wears it, so this button matches rather than reading as a generic primary action.
|
||||
color='violet'
|
||||
onClick={handleOpen}
|
||||
type='button'
|
||||
disabled={disabled}
|
||||
|
|
|
|||
|
|
@ -558,7 +558,7 @@ export function FilePreviewProvider({children}) {
|
|||
|
||||
// Single flex toolbar — same button order at every viewport size.
|
||||
// `flex-wrap: wrap` lets the tags selector drop to a second line on narrow screens
|
||||
// while the button groups stay together and in order: [file actions] [tags] [open/close].
|
||||
// while the buttons stay together, Open first: [open + file actions] [tags].
|
||||
setPreviewModal(<Modal size='fullscreen'
|
||||
open={true}
|
||||
onClose={e => handleClose(e)}
|
||||
|
|
@ -567,6 +567,7 @@ export function FilePreviewProvider({children}) {
|
|||
<Modal.Actions>
|
||||
<div className='preview-toolbar'>
|
||||
<div className='preview-toolbar-group'>
|
||||
{openButton}
|
||||
{downloadButton}
|
||||
{directoryButton}
|
||||
<ShareButton/>
|
||||
|
|
@ -576,9 +577,6 @@ export function FilePreviewProvider({children}) {
|
|||
title='Add to Playlist'/>}
|
||||
</div>
|
||||
<div className='preview-toolbar-tags'>{tagsDisplay}</div>
|
||||
<div className='preview-toolbar-group'>
|
||||
{openButton}
|
||||
</div>
|
||||
</div>
|
||||
</Modal.Actions>
|
||||
{content}
|
||||
|
|
|
|||
|
|
@ -432,7 +432,7 @@ export function NavBar() {
|
|||
<NavIconWrapper>{driveHealthIcon}</NavIconWrapper>
|
||||
<NavIconWrapper>{powerIcon}</NavIconWrapper>
|
||||
<NavIconWrapper>{warningIcon}</NavIconWrapper>
|
||||
<NavIconWrapper><ShareButton/></NavIconWrapper>
|
||||
<NavIconWrapper><ShareButton asIcon/></NavIconWrapper>
|
||||
<NavIconWrapper><HotspotStatusIcon/></NavIconWrapper>
|
||||
<NavIconWrapper><DarkModeToggle/></NavIconWrapper>
|
||||
</React.Fragment>;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import React from "react";
|
||||
import {Button, Header, Icon, Modal} from "./ui";
|
||||
import {Button, Header, Icon, IconButton, Modal} from "./ui";
|
||||
import QRCode from "react-qr-code";
|
||||
import {sendNotification} from "../api";
|
||||
|
||||
|
|
@ -20,7 +20,11 @@ export const ShareEveryoneButton = ({url, size, onClick}) => {
|
|||
</Button>
|
||||
}
|
||||
|
||||
export const ShareButton = () => {
|
||||
/*
|
||||
* `asIcon` is for the navbar corner, where the trigger sits beside other bare glyphs and a
|
||||
* boxed button would not match; everywhere else it is a real button, matching its siblings.
|
||||
*/
|
||||
export const ShareButton = ({asIcon = false}) => {
|
||||
const [open, setOpen] = React.useState(false);
|
||||
|
||||
const handleOpen = (e) => {
|
||||
|
|
@ -56,8 +60,10 @@ export const ShareButton = () => {
|
|||
<Button role='cancel' onClick={handleClose}>Close</Button>
|
||||
</Modal.Actions>
|
||||
</Modal>
|
||||
<a href='#' onClick={handleOpen}>
|
||||
<Icon name='share' size='large'/>
|
||||
</a>
|
||||
{asIcon
|
||||
? <a href='#' onClick={handleOpen}>
|
||||
<Icon name='share' size='large'/>
|
||||
</a>
|
||||
: <IconButton icon='share' label='Share' size='small' onClick={handleOpen}/>}
|
||||
</>
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3941,7 +3941,7 @@ describe('the icon-only triggers in the navbar corner are reachable', () => {
|
|||
* classes I expected the components to have, so reverting SearchIconButton to the old
|
||||
* `item` left it green -- it was measuring my markup, not the app's.
|
||||
*/
|
||||
const corner = <NavIconWrapper><ShareButton/></NavIconWrapper>;
|
||||
const corner = <NavIconWrapper><ShareButton asIcon/></NavIconWrapper>;
|
||||
|
||||
const triggers = {
|
||||
share: '.wrolpi-navbar-icon a',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue