Skip to content
This repository was archived by the owner on Mar 4, 2020. It is now read-only.

Commit 0cb1b48

Browse files
authored
fix(docs): component styles in RTL mode (#579)
* ensure that new Provider component is mounted each time code is changed * introduce cleaner logic for generating Provider's key * remove unnecessary hash calculations * final cleanup * update changelog
1 parent 3b5c3c3 commit 0cb1b48

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
2727
- Do not focus `Popup`'s trigger on outside click @sophieH29 ([#578](https://github.com/stardust-ui/react/pull/578))
2828
- Add `https` protocol to all urls used in the scripts and stylesheets in index.ejs @mnajdova ([#571](https://github.com/stardust-ui/react/pull/571))
2929
- Fix support for fallback values in styles (`color: ['#ccc', 'rgba(0, 0, 0, 0.5)']`) @miroslavstastny ([#573](https://github.com/stardust-ui/react/pull/573))
30+
- Fix styles for RTL mode of doc site component examples @kuzhelov ([#579](https://github.com/stardust-ui/react/pull/579))
3031

3132
### Features
3233
- `Ref` components uses `forwardRef` API by default @layershifter ([#491](https://github.com/stardust-ui/react/pull/491))

docs/src/components/ComponentDoc/ComponentExample/ComponentExample.tsx

+7-1
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,9 @@ class ComponentExample extends React.Component<ComponentExampleProps, ComponentE
250250
}
251251

252252
renderElement = (element: React.ReactElement<any>) => {
253+
const { examplePath } = this.props
253254
const { showRtl, componentVariables, themeName } = this.state
255+
254256
const theme = themes[themeName]
255257

256258
const newTheme: ThemeInput = {
@@ -260,7 +262,11 @@ class ComponentExample extends React.Component<ComponentExampleProps, ComponentE
260262
rtl: showRtl,
261263
}
262264

263-
return <Provider theme={newTheme}>{element}</Provider>
265+
return (
266+
<Provider key={`${examplePath}${showRtl ? '-rtl' : ''}`} theme={newTheme}>
267+
{element}
268+
</Provider>
269+
)
264270
}
265271

266272
renderMissingExample = (): JSX.Element => {

0 commit comments

Comments
 (0)