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

Commit 7ca9cfd

Browse files
authored
feat: give component examples a theme specific background (#316)
* adding in theme background aware doc examples * moving 'rtl' up to remove redundant div
1 parent 70acc81 commit 7ca9cfd

File tree

4 files changed

+34
-7
lines changed

4 files changed

+34
-7
lines changed

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

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -687,13 +687,24 @@ class ComponentExample extends React.Component<IComponentExampleProps, IComponen
687687
</Grid.Column>
688688
)}
689689

690-
<Grid.Column
691-
width={16}
692-
className={`rendered-example ${this.getKebabExamplePath()}`}
693-
style={{ padding: '2rem' }}
694-
>
695-
<div dir={showRtl ? 'rtl' : undefined}>{exampleElement}</div>
696-
</Grid.Column>
690+
<Provider.Consumer
691+
render={({ siteVariables }) => {
692+
return (
693+
<Grid.Column
694+
width={16}
695+
dir={showRtl ? 'rtl' : undefined}
696+
className={`rendered-example ${this.getKebabExamplePath()}`}
697+
style={{
698+
padding: '2rem',
699+
backgroundColor: siteVariables.bodyBackground,
700+
color: siteVariables.bodyColor,
701+
}}
702+
>
703+
{exampleElement}
704+
</Grid.Column>
705+
)
706+
}}
707+
/>
697708
<Grid.Column width={16} style={{ padding: 0, background: EDITOR_BACKGROUND_COLOR }}>
698709
{this.renderJSX()}
699710
{this.renderError()}

src/themes/teams-dark/siteVariables.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
import { white } from '../teams/siteVariables'
2+
13
//
24
// COLORS
35
//
6+
export const black = '#201f1f'
47
export const gray02 = '#bfbfbf'
58
export const gray03 = '#a6a6a6'
69
export const gray04 = '#808080'
@@ -24,3 +27,9 @@ export const magenta = '#cf6098'
2427
export const orchid = '#ae3d84'
2528
export const red = '#d74654'
2629
export const red08 = '#4f232b'
30+
31+
//
32+
// SEMANTIC ASSIGNMENTS
33+
//
34+
export const bodyBackground = black
35+
export const bodyColor = white
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
import { white } from '../teams/siteVariables'
22

3+
//
4+
// COLORS
5+
//
6+
export const black = '#000'
7+
38
//
49
// SEMANTIC ASSIGNMENTS
510
//
11+
export const bodyBackground = black
612
export const bodyColor = white

src/themes/teams/siteVariables.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,5 +87,6 @@ export const bodyMargin = 0
8787
export const bodyFontFamily =
8888
'"Segoe UI", "Helvetica Neue", "Apple Color Emoji", "Segoe UI Emoji", Helvetica, Arial, sans-serif'
8989
export const bodyFontSize = '1.4rem'
90+
export const bodyBackground = white
9091
export const bodyColor = black
9192
export const bodyLineHeight = lineHeightBase

0 commit comments

Comments
 (0)