@open-ui-kit/core 1.5.0 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -97,23 +97,29 @@ yarn add @open-ui-kit/core @mui/material @emotion/react @emotion/styled
97
97
  Wrap your application with the `ThemeProvider` to enable Open UI Kit theming:
98
98
 
99
99
  ```jsx
100
- import React, { useState } from 'react';
101
- import { ThemeProvider } from '@open-ui-kit/core';
100
+ import React from 'react';
101
+ import { ThemeProvider, useThemeMode } from '@open-ui-kit/core';
102
102
  import '@open-ui-kit/core/typography.css';
103
103
 
104
- function App() {
105
- const [isDarkMode, setIsDarkMode] = useState(false);
104
+ function AppContent() {
105
+ const { isDarkMode, toggleTheme } = useThemeMode();
106
106
 
107
107
  return (
108
- <ThemeProvider isDarkMode={isDarkMode}>
109
- <div className="app">
110
- <header>
111
- <button onClick={() => setIsDarkMode(!isDarkMode)}>
112
- Switch to {isDarkMode ? 'Light' : 'Dark'} Mode
113
- </button>
114
- </header>
115
- {/* Your app content goes here */}
116
- </div>
108
+ <div className="app">
109
+ <header>
110
+ <button type="button" onClick={toggleTheme}>
111
+ Switch to {isDarkMode ? 'Light' : 'Dark'} Mode
112
+ </button>
113
+ </header>
114
+ {/* Your app content goes here */}
115
+ </div>
116
+ );
117
+ }
118
+
119
+ function App() {
120
+ return (
121
+ <ThemeProvider>
122
+ <AppContent />
117
123
  </ThemeProvider>
118
124
  );
119
125
  }