Skip to content
This repository was archived by the owner on Nov 16, 2023. It is now read-only.

Commit 6fdd3ed

Browse files
authored
Remove global fabric theme load (#515)
* fix(globaltheme): Remove global fabric theme load * fix textarea height * revert change to textarea reference * fix(pickerborder): Fix border color on picker when focused and when item is selected * chore(reference): Remove .diff and .new png files, and check in new baselines * Properly use default or given theme in AppContainer, don't force default in ExampleWrapper * fix(picker): Remove leftover debug code * fix(suggestionsitemhover): Restore suggestions item hover color * Move duplicate AppWrapper styles to CustomizerBody styles * Set docker to share the dist-commonjs directory (build-time bugfix) * fix(picker): Fix picker hover colors, border colors, suggestions title color * fix(dropdown): Fix caret padding, option list padding, selected item bgcolor, and hovered item bgcolor * chore(styleguidevisual): Approve remaining references for visual comparison * Revert docker config update * Fix interactive dropdown visual diffs * Fix Dropdown label margin * style(picker): Change selector to use aria-selected attribute as the indicator for selected picker item * Rename picker root classname * Update AppContainer jest snapshots * Update Picker and ProgressIndicator jest snapshots * Revert "style(picker): Change selector to use aria-selected attribute as the indicator for selected picker item" This reverts commit 5e3c309. * Update TextField and TextArea jest snapshots * Update dropdown snapshot * Fix app container test coverage * Fix choicegroup test selector and update snapshots * Fix snapshots changed by Fabric's "styled" HoC change * Replace TextField's depracated onChanged prop, fix broken test selector and update snapshots * Update tooltip snapshots * Revert onChange update to TextField This will require a larger API change, punting for now * Update TextField snapshots
1 parent 446d921 commit 6fdd3ed

37 files changed

+2375
-388
lines changed
Loading
Loading
Loading
Loading

package-lock.json

Lines changed: 56 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@
1010
"url": "https://github.com/Microsoft/YamUI.git"
1111
},
1212
"dependencies": {
13-
"office-ui-fabric-react": "6.25.0",
14-
"@researchgate/react-intersection-observer": "0.7.3"
13+
"@researchgate/react-intersection-observer": "0.7.3",
14+
"office-ui-fabric-react": "6.53.0"
1515
},
1616
"devDependencies": {
17+
"@uifabric/utilities": "6.16.0",
1718
"@types/enzyme": "3.1.11",
1819
"@types/jest": "23.1.4",
1920
"@types/node": "8.10.21",

src/components/AppContainer/AppContainer.styles.ts

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,10 @@
11
/*! Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. */
2-
import { mergeStyleSets, ITheme } from 'office-ui-fabric-react/lib/Styling';
2+
import { mergeStyleSets } from 'office-ui-fabric-react/lib/Styling';
33
import { memoizeFunction } from 'office-ui-fabric-react/lib/Utilities';
4-
import { textColors, fontWeights } from '../../util/styles/fonts';
5-
6-
export interface AppContainerClassNameProps {
7-
theme: ITheme;
8-
}
9-
10-
export const getClassNames = memoizeFunction((props: AppContainerClassNameProps) => {
11-
const { theme } = props;
12-
const font = theme.fonts.medium;
134

5+
export const getClassNames = memoizeFunction(() => {
146
return mergeStyleSets({
157
root: {
16-
color: textColors(theme).primary,
17-
fontSize: font.fontSize,
18-
lineHeight: font.lineHeight,
19-
fontWeight: fontWeights.normal,
20-
218
selectors: {
229
':global(html)': {
2310
/* Sets 1.0rem to 10px */

src/components/AppContainer/AppContainer.test.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@ import * as React from 'react';
33
import { shallow, ShallowWrapper } from 'enzyme';
44
import { NestableBaseComponentProps } from '../../util/BaseComponent/props';
55
import AppContainer from '.';
6+
import { darkTheme } from '../Customizer';
67

78
describe('<AppContainer />', () => {
89
let component: ShallowWrapper<NestableBaseComponentProps>;
910

1011
describe('with default options', () => {
1112
beforeEach(() => {
12-
component = shallow(<AppContainer>paragraph text</AppContainer>);
13+
component = shallow(<AppContainer>app container text</AppContainer>);
1314
});
1415

1516
it('matches its snapshot', () => {
@@ -19,7 +20,17 @@ describe('<AppContainer />', () => {
1920

2021
describe('with className', () => {
2122
beforeEach(() => {
22-
component = shallow(<AppContainer className="TEST_CLASSNAME">paragraph text</AppContainer>);
23+
component = shallow(<AppContainer className="TEST_CLASSNAME">app container text</AppContainer>);
24+
});
25+
26+
it('matches its snapshot', () => {
27+
expect(component).toMatchSnapshot();
28+
});
29+
});
30+
31+
describe('with theme', () => {
32+
beforeEach(() => {
33+
component = shallow(<AppContainer theme={darkTheme}>app container text</AppContainer>);
2334
});
2435

2536
it('matches its snapshot', () => {

src/components/AppContainer/AppContainer.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import '../../yamui';
33
import * as React from 'react';
44
import { join } from '../../util/classNames';
55
import { Fabric } from 'office-ui-fabric-react/lib/Fabric';
6-
import { CustomizableComponentProps, defaultTheme } from '../Customizer';
6+
import Customizer, { CustomizableComponentProps, defaultTheme } from '../Customizer';
77
import { NestableBaseComponentProps } from '../../util/BaseComponent/props';
88
import { getClassNames } from './AppContainer.styles';
99

@@ -13,10 +13,12 @@ import { getClassNames } from './AppContainer.styles';
1313
export default class AppContainer extends React.Component<NestableBaseComponentProps & CustomizableComponentProps> {
1414
public render() {
1515
const { children, className, theme = defaultTheme } = this.props;
16-
const classNames = getClassNames({ theme });
16+
const classNames = getClassNames();
1717
return (
18-
<Fabric>
19-
<div className={join(['y-appContainer', classNames.root, className])}>{children}</div>
18+
<Fabric theme={theme}>
19+
<Customizer settings={{ theme }}>
20+
<div className={join(['y-appContainer', classNames.root, className])}>{children}</div>
21+
</Customizer>
2022
</Fabric>
2123
);
2224
}

0 commit comments

Comments
 (0)