🛠 fix icon page autoFocus when collapse demos

close #24911
close #24932
close #20354
This commit is contained in:
afc163 2020-06-22 22:51:18 +08:00
parent dc9d86bba6
commit ba992d2c83
2 changed files with 10 additions and 4 deletions

View File

@ -9,6 +9,10 @@ import Demo from './Demo';
import EditButton from './EditButton';
import { ping, getMetaDescription } from '../utils';
const ComponentInMarkdown = React.memo(({ content, utils }) =>
utils.toReactComponent(['section', { className: 'markdown' }].concat(getChildren(content))),
);
class ComponentDoc extends React.Component {
state = {
expandAll: false,
@ -165,9 +169,7 @@ class ComponentDoc extends React.Component {
filename={filename}
/>
</h1>
{utils.toReactComponent(
['section', { className: 'markdown' }].concat(getChildren(content)),
)}
<ComponentInMarkdown utils={utils} content={content} />
<h2>
<FormattedMessage id="app.component.examples" />
<span className="all-code-box-controls">

View File

@ -28,7 +28,7 @@ interface IconDisplayState {
searchKey: string;
}
class IconDisplay extends React.Component<IconDisplayProps, IconDisplayState> {
class IconDisplay extends React.PureComponent<IconDisplayProps, IconDisplayState> {
static categories: Categories = categories;
static newIconNames: string[] = [];
@ -43,6 +43,10 @@ class IconDisplay extends React.Component<IconDisplayProps, IconDisplayState> {
this.handleSearchIcon = debounce(this.handleSearchIcon, 300);
}
componentDidMount() {
console.log('componentDidMount');
}
handleChangeTheme = (e: RadioChangeEvent) => {
this.setState({
theme: e.target.value as ThemeType,