mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2025-03-03 18:58:01 +03:00
fix(redux-devtools-test-generator): fix devui's Select component (#637)
* Stash * Fix stuff * Unused * Update snapshot
This commit is contained in:
parent
d49535da03
commit
f9f15a41de
|
@ -47,7 +47,6 @@
|
||||||
"base16": "^1.0.0",
|
"base16": "^1.0.0",
|
||||||
"codemirror": "^5.56.0",
|
"codemirror": "^5.56.0",
|
||||||
"color": "^3.1.2",
|
"color": "^3.1.2",
|
||||||
"hoist-non-react-statics": "^3.3.2",
|
|
||||||
"prop-types": "^15.7.2",
|
"prop-types": "^15.7.2",
|
||||||
"react-icons": "^3.10.0",
|
"react-icons": "^3.10.0",
|
||||||
"react-jsonschema-form": "^1.8.1",
|
"react-jsonschema-form": "^1.8.1",
|
||||||
|
|
|
@ -38,6 +38,11 @@ export class Select extends (PureComponent || Component)<SelectProps> {
|
||||||
neutral60: this.props.theme.base06,
|
neutral60: this.props.theme.base06,
|
||||||
neutral80: this.props.theme.base07,
|
neutral80: this.props.theme.base07,
|
||||||
},
|
},
|
||||||
|
spacing: {
|
||||||
|
...theme.spacing,
|
||||||
|
baseUnit: 2,
|
||||||
|
controlHeight: this.props.theme.inputHeight,
|
||||||
|
},
|
||||||
})}
|
})}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import React, { ComponentType } from 'react';
|
import React from 'react';
|
||||||
import hoistNonReactStatics from 'hoist-non-react-statics';
|
|
||||||
import getDefaultTheme, { Theme } from '../themes/default';
|
import getDefaultTheme, { Theme } from '../themes/default';
|
||||||
import { withTheme } from 'styled-components';
|
import { withTheme } from 'styled-components';
|
||||||
import { Base16Theme } from 'base16';
|
import { Base16Theme } from 'base16';
|
||||||
|
@ -9,33 +8,16 @@ export default <C extends React.ComponentType<any>>(
|
||||||
? C
|
? C
|
||||||
: never
|
: never
|
||||||
) => {
|
) => {
|
||||||
const ThemedComponent = React.forwardRef<C, React.ComponentProps<C>>(
|
return withTheme((props) => {
|
||||||
(props, ref) => {
|
return props.theme && props.theme.type ? (
|
||||||
// eslint-disable-next-line react/prop-types
|
<UnthemedComponent {...props} />
|
||||||
if (props.theme && props.theme.type) {
|
) : (
|
||||||
const ThemedComponent = withTheme(
|
<UnthemedComponent
|
||||||
UnthemedComponent as ComponentType<{ theme?: Theme }>
|
{...props}
|
||||||
);
|
theme={getDefaultTheme((props.theme ?? {}) as Base16Theme)}
|
||||||
return <ThemedComponent {...props} ref={ref} />;
|
/>
|
||||||
}
|
);
|
||||||
const UnthemedComponentAny = UnthemedComponent as any;
|
});
|
||||||
return (
|
|
||||||
<UnthemedComponentAny
|
|
||||||
{...props}
|
|
||||||
ref={ref}
|
|
||||||
theme={getDefaultTheme({} as Base16Theme)}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
hoistNonReactStatics(ThemedComponent, UnthemedComponent);
|
|
||||||
|
|
||||||
ThemedComponent.displayName = `ThemedComponent(${
|
|
||||||
UnthemedComponent.displayName ?? 'Component'
|
|
||||||
})`;
|
|
||||||
|
|
||||||
return ThemedComponent;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: memoize it?
|
// TODO: memoize it?
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,5 +1,4 @@
|
||||||
import React, { PureComponent, Component, ReactNode } from 'react';
|
import React, { PureComponent, Component, ReactNode } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import { stringify } from 'javascript-stringify';
|
import { stringify } from 'javascript-stringify';
|
||||||
import objectPath from 'object-path';
|
import objectPath from 'object-path';
|
||||||
import jsan from 'jsan';
|
import jsan from 'jsan';
|
||||||
|
|
|
@ -130,14 +130,15 @@ export default class TestTab<S, A extends Action<unknown>> extends Component<
|
||||||
return (
|
return (
|
||||||
<Container>
|
<Container>
|
||||||
<Toolbar>
|
<Toolbar>
|
||||||
<Select
|
<div style={{ flexGrow: 1, zIndex: 100 }}>
|
||||||
options={templates}
|
<Select
|
||||||
valueKey="name"
|
options={templates}
|
||||||
labelKey="name"
|
getOptionValue={(template: Template) => template.name}
|
||||||
value={name}
|
getOptionLabel={(template: Template) => template.name}
|
||||||
simpleValue={false}
|
value={templates.filter((template) => template.name === name)}
|
||||||
onChange={this.handleSelectTemplate}
|
onChange={this.handleSelectTemplate}
|
||||||
/>
|
/>
|
||||||
|
</div>
|
||||||
<Button onClick={this.editTemplate}>
|
<Button onClick={this.editTemplate}>
|
||||||
<MdEdit />
|
<MdEdit />
|
||||||
</Button>
|
</Button>
|
||||||
|
|
|
@ -9357,7 +9357,7 @@ hmac-drbg@^1.0.0:
|
||||||
minimalistic-assert "^1.0.0"
|
minimalistic-assert "^1.0.0"
|
||||||
minimalistic-crypto-utils "^1.0.1"
|
minimalistic-crypto-utils "^1.0.1"
|
||||||
|
|
||||||
hoist-non-react-statics@^3.0.0, hoist-non-react-statics@^3.1.0, hoist-non-react-statics@^3.3.0, hoist-non-react-statics@^3.3.2:
|
hoist-non-react-statics@^3.0.0, hoist-non-react-statics@^3.1.0, hoist-non-react-statics@^3.3.0:
|
||||||
version "3.3.2"
|
version "3.3.2"
|
||||||
resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz#ece0acaf71d62c2969c2ec59feff42a4b1a85b45"
|
resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz#ece0acaf71d62c2969c2ec59feff42a4b1a85b45"
|
||||||
integrity sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==
|
integrity sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==
|
||||||
|
|
Loading…
Reference in New Issue
Block a user