Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "office-ui-fabric-react",
"comment": "Converting SCSS to MergeStyles step 2 - style conversion",
"type": "minor"
}
],
"packageName": "office-ui-fabric-react",
"email": "v-brgarl@microsoft.com"
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,25 @@ import * as PropTypes from 'prop-types';
import {
autobind,
BaseComponent,
css
classNamesFunction,
css,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is css still being used somewhere?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch :)

customizable
} from '../../Utilities';
import {
IScrollablePane,
IScrollablePaneProps,
IScrollablePaneStyles,
IScrollablePaneStyleProps
} from './ScrollablePane.types';
import { Sticky } from '../../Sticky';
import * as stylesImport from './ScrollablePane.scss';
const styles: any = stylesImport;

export interface IScrollablePaneContext {
scrollablePane: PropTypes.Requireable<object>;
}

const getClassNames = classNamesFunction<IScrollablePaneStyleProps, IScrollablePaneStyles>();

@customizable('ScrollablePane', ['theme'])
export class ScrollablePaneBase extends BaseComponent<IScrollablePaneProps, {}> implements IScrollablePane {
public static childContextTypes: React.ValidationMap<IScrollablePaneContext> = {
scrollablePane: PropTypes.object
Expand Down Expand Up @@ -82,17 +87,23 @@ export class ScrollablePaneBase extends BaseComponent<IScrollablePaneProps, {}>
}

public render() {
const { className } = this.props;
const { className, theme, getStyles } = this.props;
const classNames = getClassNames(getStyles!,
{
theme: theme!,
className
}
);

return (
<div
ref='root'
className={ css('ms-ScrollablePane', styles.root, className) }
className={ classNames.root }
data-is-scrollable={ true }
>
<div ref='stickyContainer' className={ styles.stickyContainer }>
<div ref='stickyAbove' className={ styles.stickyAbove } />
<div ref='stickyBelow' className={ styles.stickyBelow } />
<div ref='stickyContainer' className={ classNames.stickyContainer }>
<div ref='stickyAbove' className={ classNames.stickyAbove } />
<div ref='stickyBelow' className={ classNames.stickyBelow } />
</div>
{ this.props.children }
</div>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { IScrollablePaneStyleProps, IScrollablePaneStyles } from './ScrollablePane.types';
import {
HighContrastSelector,
IStyle,
ITheme,
ITheme
} from '../../Styling';

export const getStyles = (
Expand All @@ -14,15 +15,54 @@ export const getStyles = (

const { palette, semanticColors } = theme;

const AboveAndBelowStyles: IStyle = {
position: 'absolute',
pointerEvents: 'auto',
width: '100%',
zIndex: 1
};

return ({
root: [
'ms-ScrollablePane',
{
// Insert css properties
overflowY: 'auto',
maxHeight: 'inherit',
height: 'inherit',
// @todo this doesn't work with JS

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a regression if we merge as-is?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I should ask @dzearing about this. Unfortunately it is not included in the JS Api, so I it is not as simple as adding an IRawStyle. I did a little research, but the general comment was that if you want to get this specific with your styles, don't style with JS as it's just not there yet. This will not cause a visual regression though, only cause scroll behavior to differ on specific webkit browsers like Opera and Chrome.

Also, @betrue-final-final do you know how important this rule is design wise, or if it was just added out of convenience?

// -webkit-overflow-scrolling: touch;
},
className
],
stickyContainer: [
{
overflow: 'hidden',
position: 'absolute',
pointerEvents: 'none',

}
],

// Insert className styles
stickyAbove: [
{
top: 0,
selectors: {
[HighContrastSelector]: {
borderBottom: '1px solid WindowText'
}
}
},
AboveAndBelowStyles
],
stickyBelow: [
{
bottom: 0,
selectors: {
[HighContrastSelector]: {
borderTop: '1px solid WindowText'
}
}
},
AboveAndBelowStyles
]
});
};
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,19 @@ export interface IScrollablePaneStyleProps {

export interface IScrollablePaneStyles {
/**
* Style for the root element.
* Style set for the root element.
*/
root: IStyle;

// Insert ScrollablePane classNames below
/**
* Style set for the stickyContainer element.
*/
stickyContainer: IStyle;
/**
* Style set for the stickyAbove element.
*/
stickyAbove: IStyle;
/**
* Style set for the stickyAbove element.
*/
stickyBelow: IStyle;
}