mirror of
https://github.com/facebook/react.git
synced 2026-02-26 07:55:55 +00:00
This commit adds a new tab to the Settings modal: Debugging This new tab has the append component stacks feature and a new one: break on warn This new feature adds a debugger statement into the console override
85 lines
2.4 KiB
JavaScript
85 lines
2.4 KiB
JavaScript
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @flow
|
|
*/
|
|
|
|
import * as React from 'react';
|
|
import {useContext} from 'react';
|
|
import {SettingsContext} from './SettingsContext';
|
|
import {StoreContext} from '../context';
|
|
import {CHANGE_LOG_URL} from 'react-devtools-shared/src/constants';
|
|
|
|
import styles from './SettingsShared.css';
|
|
|
|
export default function GeneralSettings(_: {||}) {
|
|
const {
|
|
displayDensity,
|
|
setDisplayDensity,
|
|
setTheme,
|
|
setTraceUpdatesEnabled,
|
|
theme,
|
|
traceUpdatesEnabled,
|
|
} = useContext(SettingsContext);
|
|
|
|
const {supportsTraceUpdates} = useContext(StoreContext);
|
|
|
|
return (
|
|
<div className={styles.Settings}>
|
|
<div className={styles.Setting}>
|
|
<div className={styles.RadioLabel}>Theme</div>
|
|
<select
|
|
className={styles.Select}
|
|
value={theme}
|
|
onChange={({currentTarget}) => setTheme(currentTarget.value)}>
|
|
<option value="auto">Auto</option>
|
|
<option value="light">Light</option>
|
|
<option value="dark">Dark</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div className={styles.Setting}>
|
|
<div className={styles.RadioLabel}>Display density</div>
|
|
<select
|
|
className={styles.Select}
|
|
value={displayDensity}
|
|
onChange={({currentTarget}) =>
|
|
setDisplayDensity(currentTarget.value)
|
|
}>
|
|
<option value="compact">Compact</option>
|
|
<option value="comfortable">Comfortable</option>
|
|
</select>
|
|
</div>
|
|
|
|
{supportsTraceUpdates && (
|
|
<div className={styles.Setting}>
|
|
<label>
|
|
<input
|
|
type="checkbox"
|
|
checked={traceUpdatesEnabled}
|
|
onChange={({currentTarget}) =>
|
|
setTraceUpdatesEnabled(currentTarget.checked)
|
|
}
|
|
/>{' '}
|
|
Highlight updates when components render.
|
|
</label>
|
|
</div>
|
|
)}
|
|
|
|
<div className={styles.ReleaseNotes}>
|
|
<a
|
|
className={styles.ReleaseNotesLink}
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
href={CHANGE_LOG_URL}>
|
|
View release notes
|
|
</a>{' '}
|
|
for DevTools version {process.env.DEVTOOLS_VERSION}
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|