Offset dialog and add explanation tooltip to canvas setting
This commit is contained in:
parent
a8363ab53f
commit
0138b5d1e4
|
|
@ -29,11 +29,12 @@ export const DefaultSettingsView: React.FC<{}> = () => {
|
||||||
return (
|
return (
|
||||||
<SettingsView
|
<SettingsView
|
||||||
settings={[
|
settings={[
|
||||||
{ value: darkMode, set: setDarkMode, title: 'Dark mode' },
|
{ value: darkMode, set: setDarkMode, name: 'Dark mode' },
|
||||||
{
|
{
|
||||||
value: shouldPopulateCanvasFromScreenshot,
|
value: shouldPopulateCanvasFromScreenshot,
|
||||||
set: setShouldPopulateCanvasFromScreenshot,
|
set: setShouldPopulateCanvasFromScreenshot,
|
||||||
title: 'Display canvas content',
|
name: 'Display canvas content',
|
||||||
|
title: 'Attempt to display the captured canvas appearance in the snapshot preview. May not be accurate.'
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,8 @@ export const SettingsToolbarButton: React.FC<{}> = () => {
|
||||||
className='settings-toolbar-dialog'
|
className='settings-toolbar-dialog'
|
||||||
open={open}
|
open={open}
|
||||||
width={200}
|
width={200}
|
||||||
|
// TODO: Temporary spacing until design of toolbar buttons is revisited
|
||||||
|
verticalOffset={8}
|
||||||
requestClose={() => setOpen(false)}
|
requestClose={() => setOpen(false)}
|
||||||
hostingElement={hostingRef}
|
hostingElement={hostingRef}
|
||||||
>
|
>
|
||||||
|
|
|
||||||
|
|
@ -18,22 +18,31 @@ import * as React from 'react';
|
||||||
import './settingsView.css';
|
import './settingsView.css';
|
||||||
|
|
||||||
export type Setting<T> = {
|
export type Setting<T> = {
|
||||||
value: T,
|
value: T;
|
||||||
set: (value: T) => void,
|
set: (value: T) => void;
|
||||||
title: string
|
name: string;
|
||||||
|
title?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const SettingsView: React.FunctionComponent<{
|
export const SettingsView: React.FunctionComponent<{
|
||||||
settings: Setting<boolean>[],
|
settings: Setting<boolean>[];
|
||||||
}> = ({ settings }) => {
|
}> = ({ settings }) => {
|
||||||
return <div className='vbox settings-view'>
|
return (
|
||||||
{settings.map(({ value, set, title }) => {
|
<div className='vbox settings-view'>
|
||||||
return <div key={title} className='setting'>
|
{settings.map(({ value, set, name, title }) => {
|
||||||
<label>
|
return (
|
||||||
<input type='checkbox' checked={value} onChange={() => set(!value)}/>
|
<div key={name} className='setting' title={title}>
|
||||||
{title}
|
<label>
|
||||||
</label>
|
<input
|
||||||
</div>;
|
type='checkbox'
|
||||||
})}
|
checked={value}
|
||||||
</div>;
|
onChange={() => set(!value)}
|
||||||
|
/>
|
||||||
|
{name}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,8 @@ export interface DialogProps {
|
||||||
open: boolean;
|
open: boolean;
|
||||||
width: number;
|
width: number;
|
||||||
|
|
||||||
|
verticalOffset?: number;
|
||||||
|
|
||||||
requestClose?: () => void;
|
requestClose?: () => void;
|
||||||
|
|
||||||
hostingElement?: React.RefObject<HTMLElement>;
|
hostingElement?: React.RefObject<HTMLElement>;
|
||||||
|
|
@ -31,6 +33,7 @@ export const Dialog: React.FC<React.PropsWithChildren<DialogProps>> = ({
|
||||||
className,
|
className,
|
||||||
open,
|
open,
|
||||||
width,
|
width,
|
||||||
|
verticalOffset,
|
||||||
requestClose,
|
requestClose,
|
||||||
hostingElement,
|
hostingElement,
|
||||||
children,
|
children,
|
||||||
|
|
@ -50,7 +53,7 @@ export const Dialog: React.FC<React.PropsWithChildren<DialogProps>> = ({
|
||||||
style = {
|
style = {
|
||||||
// Override default `<dialog>` positioning
|
// Override default `<dialog>` positioning
|
||||||
margin: 0,
|
margin: 0,
|
||||||
top: bounds.bottom,
|
top: bounds.bottom + (verticalOffset ?? 0),
|
||||||
left: buildTopLeftCoord(bounds, width),
|
left: buildTopLeftCoord(bounds, width),
|
||||||
width,
|
width,
|
||||||
// For some reason the dialog is placed behind the timeline, but there's a stacking context that allows the dialog to be placed above
|
// For some reason the dialog is placed behind the timeline, but there's a stacking context that allows the dialog to be placed above
|
||||||
|
|
|
||||||
|
|
@ -509,9 +509,9 @@ export const UIModeView: React.FC<{}> = ({
|
||||||
<div className='section-title'>Testing Options</div>
|
<div className='section-title'>Testing Options</div>
|
||||||
</Toolbar>
|
</Toolbar>
|
||||||
{testingOptionsVisible && <SettingsView settings={[
|
{testingOptionsVisible && <SettingsView settings={[
|
||||||
{ value: singleWorker, set: setSingleWorker, title: 'Single worker' },
|
{ value: singleWorker, set: setSingleWorker, name: 'Single worker' },
|
||||||
{ value: showBrowser, set: setShowBrowser, title: 'Show browser' },
|
{ value: showBrowser, set: setShowBrowser, name: 'Show browser' },
|
||||||
{ value: updateSnapshots, set: setUpdateSnapshots, title: 'Update snapshots' },
|
{ value: updateSnapshots, set: setUpdateSnapshots, name: 'Update snapshots' },
|
||||||
]} />}
|
]} />}
|
||||||
</>}
|
</>}
|
||||||
<Toolbar noShadow={true} noMinHeight={true} className='settings-toolbar' onClick={() => setSettingsVisible(!settingsVisible)}>
|
<Toolbar noShadow={true} noMinHeight={true} className='settings-toolbar' onClick={() => setSettingsVisible(!settingsVisible)}>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue