-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf(docs): improve rendering performance of example's pages (#3549)
* wip * Merge branch 'master' of https://github.com/Semantic-Org/Semantic-UI-React into improve/perf # Conflicts: # docs/src/components/ComponentDoc/ComponentProps/ComponentProps.js # docs/src/components/ComponentDoc/ComponentSidebar/ComponentSidebarSection.js * restore changes * clean up * restore changes * clean up * optimizations * add note * update usage page
- Loading branch information
1 parent
ffa3874
commit 3f0c8ea
Showing
36 changed files
with
712 additions
and
671 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,46 @@ | ||
import React from 'react' | ||
import { hot } from 'react-hot-loader/root' | ||
import { Router, Switch } from 'react-static' | ||
import { Route, Router, withSiteData } from 'react-static' | ||
import { Switch } from 'react-router' | ||
import Routes from 'react-static-routes' | ||
|
||
const App = () => ( | ||
<Router> | ||
<Switch> | ||
<Routes /> | ||
</Switch> | ||
</Router> | ||
import Sidebar from './components/Sidebar/Sidebar' | ||
import style from './Style' | ||
import { docTypes } from './utils' | ||
|
||
const App = ({ componentMenu, versions }) => ( | ||
<div style={style.container}> | ||
<Router> | ||
<React.Fragment> | ||
<Switch> | ||
{/* | ||
* We can't place <Sidebar /> inside of <Routes /> because it will be remounted on page | ||
* switch. We also don't want to show <Sidebar /> for layouts pages and maximized pages. | ||
*/} | ||
<Route path='/layouts/*' component={null} /> | ||
<Route path='/maximize/*' component={null} /> | ||
|
||
<Route path='/'> | ||
{(props) => ( | ||
<Sidebar | ||
{...props} | ||
componentMenu={componentMenu} | ||
style={style.menu} | ||
version={versions.suir} | ||
/> | ||
)} | ||
</Route> | ||
</Switch> | ||
|
||
<Routes /> | ||
</React.Fragment> | ||
</Router> | ||
</div> | ||
) | ||
|
||
export default hot(App) | ||
App.propTypes = { | ||
componentMenu: docTypes.componentMenu.isRequired, | ||
versions: docTypes.versions, | ||
} | ||
|
||
export default hot(withSiteData(App)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,19 @@ | ||
export default, { EDITOR_BACKGROUND_COLOR, EDITOR_GUTTER_COLOR } from './CodeEditorUniveral' | ||
import React from 'react' | ||
import { Loader } from 'semantic-ui-react' | ||
|
||
import NoSSR from 'docs/src/components/NoSSR' | ||
|
||
const CodeEditor = React.lazy(() => import('./CodeEditor')) | ||
|
||
const CodeEditorSafe = (props) => ( | ||
<NoSSR> | ||
<React.Suspense fallback={<Loader active inline='centered' />}> | ||
<CodeEditor {...props} /> | ||
</React.Suspense> | ||
</NoSSR> | ||
) | ||
|
||
export const EDITOR_BACKGROUND_COLOR = '#1d1f21' | ||
export const EDITOR_GUTTER_COLOR = '#25282d' | ||
|
||
export default CodeEditorSafe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.