Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to use components WELLMS-365 #297

Merged
merged 1 commit into from
Jul 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions doc/introduction/howtouse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Below is example how to implement `ThemeProvider` with current theme settings. Wrap your application with this context provider, then all componet will be using selected styles.

Values will change once you adapt themes, modes or even use custom colors with theme widget in right upper corner.

### ThemeProvider

```js
import { getThemeFromLocalStorage } from "../../src/styleguide/useLocalTheme";
import { ThemeProvider } from "styled-components";
import { print, stringify } from "q-i";

const theme = getThemeFromLocalStorage();

<React.Fragment>
<ThemeProvider theme={theme}>
<textarea
class="language-js"
style={{ width: "100%", minHeight: "800px", border: "none" }}
>
{`import { ThemeProvider } from "styled-components";
const theme = ${JSON.stringify(theme, null, " ")}

<ThemeProvider theme={theme}>
{/* your application here */}
</ThemeProvider>

`}
</textarea>
</ThemeProvider>
</React.Fragment>;
```
4 changes: 4 additions & 0 deletions styleguide.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ module.exports = {
name: "Theme Colors",
content: "doc/introduction/themes.md",
},
{
name: "How to use Components",
content: "doc/introduction/howtouse.md",
},
],
},
{
Expand Down