Skip to content

Commit a52adba

Browse files
authored
Update the documentation to use 'GlobalStyles' along with 'ThemeProvider' (#850)
1 parent 8ee3b52 commit a52adba

File tree

64 files changed

+246
-126
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+246
-126
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1919

2020
### Fixed
2121

22+
* Update the documentation to use `GlobalStyles` along with `ThemeProvider`.
23+
2224
## [3.4.0] - 2022-09-13
2325

2426
### Added

integration/app/test-demo/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,14 @@ If there is already an existing Mini Test App for the features that you are work
3333
```tsx
3434
import React from 'react';
3535
import { BrowserRouter, Route, Routes } from 'react-router-dom';
36-
import { lightTheme } from 'amazon-chime-sdk-component-library-react';
36+
import { lightTheme, GlobalStyles } from 'amazon-chime-sdk-component-library-react';
3737
import { ThemeProvider } from 'styled-components';
3838
import { Home } from './pages/Home';
3939
import { RosterTestApp } from './pages/RosterTestApp';
4040

4141
const App: React.FC = () => (
4242
<ThemeProvider theme={lightTheme}>
43+
<GlobalStyles />
4344
<BrowserRouter>
4445
<Routes>
4546
<Route path={routes.HOME} element={<Home />} />

integration/app/test-demo/src/app.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import { BrowserRouter, Route, Routes } from 'react-router-dom';
3-
import { lightTheme } from 'amazon-chime-sdk-component-library-react';
3+
import { lightTheme, GlobalStyles } from 'amazon-chime-sdk-component-library-react';
44
import { ThemeProvider } from 'styled-components';
55
import { Home } from './pages/Home';
66
import { RosterTestApp } from './pages/RosterTestApp';
@@ -9,6 +9,7 @@ import { VideoFilterTestApp } from './pages/VideoFilterTestApp';
99

1010
const App: React.FC = () => (
1111
<ThemeProvider theme={lightTheme}>
12+
<GlobalStyles />
1213
<BrowserRouter>
1314
<Routes>
1415
<Route path={routes.HOME} element={<Home />} />

src/components/introduction.stories.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ The server application and client application could be hosted either locally or
3131
npm install --save amazon-chime-sdk-component-library-react amazon-chime-sdk-js styled-components styled-system
3232
```
3333

34-
2. Render a `ThemeProvider` and a `MeetingProvider` in the root of your application
34+
2. Render a `ThemeProvider`, `GlobalStyles` a `MeetingProvider` in the root of your application. Place the `GlobalStyles` under `ThemeProvider` to reset default global CSS styles.
3535

3636
- You can pass a default theme that we provide, or a customized theme that adheres to our theme's structure.
3737

@@ -40,10 +40,12 @@ import { ThemeProvider } from 'styled-components';
4040
import {
4141
MeetingProvider,
4242
lightTheme,
43+
GlobalStyles,
4344
} from 'amazon-chime-sdk-component-library-react';
4445

4546
const Root = () => (
4647
<ThemeProvider theme={lightTheme}>
48+
<GlobalStyles />
4749
<MeetingProvider>
4850
<MyApp />
4951
</MeetingProvider>

src/components/sdk/introduction.stories.mdx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ SDK components are aimed at accelerating your Amazon Chime SDK application devel
1414
npm install --save amazon-chime-sdk-component-library-react amazon-chime-sdk-js styled-components styled-system
1515
```
1616

17-
2. Render a `ThemeProvider` and a `MeetingProvider` in the root of your application
17+
2. Render a `ThemeProvider`, `GlobalStyles` a `MeetingProvider` in the root of your application. Place the `GlobalStyles` under `ThemeProvider` to reset default global CSS styles.
1818

1919
- You can pass a default theme that we provide, or a customized theme that adheres to our theme's structure.
2020

@@ -23,10 +23,12 @@ import { ThemeProvider } from 'styled-components';
2323
import {
2424
lightTheme,
2525
MeetingProvider,
26+
GlobalStyles,
2627
} from 'amazon-chime-sdk-component-library-react';
2728

2829
const Root = () => (
2930
<ThemeProvider theme={lightTheme}>
31+
<GlobalStyles />
3032
<MeetingProvider>
3133
<MyApp />
3234
</MeetingProvider>
@@ -53,7 +55,7 @@ const MyApp = () => {
5355
const response = await fetch('/my-server');
5456
const data = await response.json();
5557

56-
// Initalize the `MeetingSessionConfiguration`
58+
// Initialize the `MeetingSessionConfiguration`
5759
const meetingSessionConfiguration = new MeetingSessionConfiguration(data.Meeting, data.Attendee);
5860

5961
// Use the join API to create a meeting session using the MeetingSessionConfiguration

src/components/ui/Badge/Badge.mdx

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,27 @@ import { lightTheme } from '../../../theme/';
66
import { GlobalStyles } from '../../../theme/GlobalStyles';
77

88
# Badge
9+
910
Badge contains a numeric value and indicates a running tally, such as the number of unread messages in a room.
1011

1112
## Importing
13+
1214
```javascript
1315
import { Badge } from 'amazon-chime-sdk-component-library-react';
1416
```
1517

1618
## Example
19+
1720
<ThemeProvider theme={lightTheme}>
18-
<GlobalStyles/>
21+
<GlobalStyles />
1922
<Preview>
20-
<div style={{ 'alignItems': 'center', 'display': 'flex'}}>
21-
<span style={{ 'marginRight': '0.5rem' }}>Number of new messages</span>
22-
<Badge
23-
value="50+"
24-
status="default"
25-
/>
23+
<div style={{ alignItems: 'center', display: 'flex' }}>
24+
<span style={{ marginRight: '0.5rem' }}>Number of new messages</span>
25+
<Badge value="50+" status="default" />
2626
</div>
27-
<div style={{ 'marginLeft': '1rem', 'display': 'flex' }}>
28-
<span style={{ 'marginRight': '0.5rem' }}>Lock badge</span>
29-
<Badge
30-
value={<Lock />}
31-
/>
27+
<div style={{ marginLeft: '1rem', display: 'flex' }}>
28+
<span style={{ marginRight: '0.5rem' }}>Lock badge</span>
29+
<Badge value={<Lock />} />
3230
</div>
3331
</Preview>
3432
</ThemeProvider>
@@ -47,20 +45,17 @@ import { Badge } from 'amazon-chime-sdk-component-library-react';
4745
```
4846

4947
### Using Alert Status
48+
5049
<ThemeProvider theme={lightTheme}>
50+
<GlobalStyles />
5151
<Preview>
52-
<div style={{ 'alignItems': 'center', 'display': 'flex'}}>
53-
<span style={{ 'marginRight': '0.5rem' }}>Number of new messages</span>
54-
<Badge
55-
value="50+"
56-
status="alert"
57-
/>
52+
<div style={{ alignItems: 'center', display: 'flex' }}>
53+
<span style={{ marginRight: '0.5rem' }}>Number of new messages</span>
54+
<Badge value="50+" status="alert" />
5855
</div>
59-
<div style={{ 'marginLeft': '1rem', 'display': 'flex' }}>
60-
<span style={{ 'marginRight': '0.5rem' }}>Lock badge</span>
61-
<Badge
62-
value={<Lock />}
63-
/>
56+
<div style={{ marginLeft: '1rem', display: 'flex' }}>
57+
<span style={{ marginRight: '0.5rem' }}>Lock badge</span>
58+
<Badge value={<Lock />} />
6459
</div>
6560
</Preview>
6661
</ThemeProvider>
@@ -79,4 +74,5 @@ import { Badge } from 'amazon-chime-sdk-component-library-react';
7974
```
8075

8176
## Props
82-
<Props of={Badge} />
77+
78+
<Props of={Badge} />

src/components/ui/Flex/Flex.mdx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import { Flex } from 'amazon-chime-sdk-component-library-react';
2323
With layout `fill-space`
2424

2525
<ThemeProvider theme={lightTheme}>
26-
<GlobalStyles/>
26+
<GlobalStyles />
2727
<Preview>
2828
<Flex layout="fill-space">
2929
<Title>fill-space</Title>
@@ -40,7 +40,7 @@ With layout `fill-space`
4040
With Layout `fill-space-centered`
4141

4242
<ThemeProvider theme={lightTheme}>
43-
<GlobalStyles/>
43+
<GlobalStyles />
4444
<Preview>
4545
<Flex layout="fill-space-centered">
4646
<Title>fill-space-centered</Title>
@@ -57,6 +57,7 @@ With Layout `fill-space-centered`
5757
With Layout `equal-columns`
5858

5959
<ThemeProvider theme={lightTheme}>
60+
<GlobalStyles />
6061
<Preview>
6162
<Flex layout="equal-columns">
6263
<Block tag="article" />
@@ -79,7 +80,7 @@ With Layout `equal-columns`
7980
With Layout `stack`
8081

8182
<ThemeProvider theme={lightTheme}>
82-
<GlobalStyles/>
83+
<GlobalStyles />
8384
<Preview>
8485
<Flex layout="stack">
8586
<Block tag="article" />
@@ -102,7 +103,7 @@ With Layout `stack`
102103
With container `true`
103104

104105
<ThemeProvider theme={lightTheme}>
105-
<GlobalStyles/>
106+
<GlobalStyles />
106107
<Preview>
107108
<Flex container>
108109
<Title>placeholder</Title>

src/components/ui/Navbar/Navbar.mdx

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import Flex from '../Flex';
99
import { lightTheme } from '../../../theme/';
1010
import { GlobalStyles } from '../../../theme/GlobalStyles';
1111

12-
1312
# Navbar
1413

1514
The Navbar component displays a vertical menu with navigation icon buttons and labels. Navbar is constructed using the NavbarHeader and NavbarItem components.
@@ -22,31 +21,28 @@ The Navbar component displays a vertical menu with navigation icon buttons and l
2221
import {
2322
Navbar,
2423
NavbarHeader,
25-
NavbarItem
24+
NavbarItem,
2625
} from 'amazon-chime-sdk-component-library-react';
2726
```
2827

2928
## Example
3029

3130
### Navbar Component
31+
3232
<ThemeProvider theme={lightTheme}>
33-
<GlobalStyles/>
33+
<GlobalStyles />
3434
<Preview>
3535
<Navbar flexDirection="column" container css="height: 50vh">
36-
<NavbarHeader onClose={() => {}}/>
36+
<NavbarHeader onClose={() => {}} />
3737
<Flex>
3838
<NavbarItem
3939
icon={<Information />}
4040
onClick={() => {}}
4141
label="Bridge Information"
4242
/>
43-
<NavbarItem
44-
icon={<Attendees />}
45-
onClick={() => {}}
46-
label="Attendees"
47-
/>
43+
<NavbarItem icon={<Attendees />} onClick={() => {}} label="Attendees" />
4844
</Flex>
49-
<Flex marginTop='auto'>
45+
<Flex marginTop="auto">
5046
<NavbarItem
5147
icon={<LeaveMeeting />}
5248
onClick={() => {}}
@@ -59,21 +55,17 @@ import {
5955
</ThemeProvider>
6056

6157
```jsx
62-
<Navbar flexDirection="column" container height='10%'>
63-
<NavbarHeader onClose={() => {}}/>
58+
<Navbar flexDirection="column" container height="10%">
59+
<NavbarHeader onClose={() => {}} />
6460
<Flex>
6561
<NavbarItem
6662
icon={<Information />}
6763
onClick={() => {}}
6864
label="Bridge Information"
6965
/>
70-
<NavbarItem
71-
icon={<Attendees />}
72-
onClick={() => {}}
73-
label="Attendees"
74-
/>
66+
<NavbarItem icon={<Attendees />} onClick={() => {}} label="Attendees" />
7567
</Flex>
76-
<Flex marginTop='auto'>
68+
<Flex marginTop="auto">
7769
<NavbarItem
7870
icon={<LeaveMeeting />}
7971
onClick={() => {}}
@@ -86,6 +78,7 @@ import {
8678
## Props
8779

8880
### Navbar Props
81+
8982
<Props of={Navbar} />
9083

9184
# NavbarHeader
@@ -97,10 +90,11 @@ It gives a title to Navbar and also a close icon button to close the Navbar in m
9790
# Example
9891

9992
```javascript
100-
<NavbarHeader title="Menu" onClose={() => {}}/>
93+
<NavbarHeader title="Menu" onClose={() => {}} />
10194
```
10295

10396
### NavbarHeader Props
97+
10498
<Props of={NavbarHeader} />
10599

106100
# NavbarItem
@@ -114,6 +108,7 @@ The label is displayed only on smaller screens with width defined by `theme.medi
114108
### NavbarItem component
115109

116110
<ThemeProvider theme={lightTheme}>
111+
<GlobalStyles />
117112
<NavbarItem
118113
icon={<Information />}
119114
onClick={() => {}}
@@ -130,4 +125,5 @@ The label is displayed only on smaller screens with width defined by `theme.medi
130125
```
131126

132127
### NavbarItem Props
128+
133129
<Props of={NavbarItem} />

src/components/ui/Portal/Portal.stories.mdx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import Flex from '../Flex';
99

1010
# Portal
1111

12-
The Portal component is used to render children into any DOM node that exists outside the DOM hierarchy of the portal's container.
12+
The Portal component is used to render children into any DOM node that exists outside the DOM hierarchy of the portal's container.
1313

1414
## Importing
1515

@@ -21,11 +21,13 @@ import { Portal } from 'amazon-chime-sdk-component-library-react';
2121

2222
```jsx
2323
<Flex layout="fill-space-centered">
24-
<div id='root-div'>Root Div</div>
25-
<Portal rootId='root-div'><div>Portal content</div></Portal>
24+
<div id="root-div">Root Div</div>
25+
<Portal rootId="root-div">
26+
<div>Portal content</div>
27+
</Portal>
2628
</Flex>
2729
```
2830

2931
## Props
3032

31-
<Props of={Portal} />
33+
<Props of={Portal} />

0 commit comments

Comments
 (0)