diff --git a/common/changes/office-ui-fabric-react/detailslist_2018-07-09-18-04.json b/common/changes/office-ui-fabric-react/detailslist_2018-07-09-18-04.json new file mode 100644 index 00000000000000..e6c91d5e8ce67c --- /dev/null +++ b/common/changes/office-ui-fabric-react/detailslist_2018-07-09-18-04.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "packageName": "office-ui-fabric-react", + "comment": "DetailsHeader css-in-js conversion", + "type": "minor" + } + ], + "packageName": "office-ui-fabric-react", + "email": "kchau@microsoft.com" +} \ No newline at end of file diff --git a/packages/office-ui-fabric-react/src/components/ComponentExamples.test.tsx b/packages/office-ui-fabric-react/src/components/ComponentExamples.test.tsx index a7c08fafb6c07e..497605773ecb43 100644 --- a/packages/office-ui-fabric-react/src/components/ComponentExamples.test.tsx +++ b/packages/office-ui-fabric-react/src/components/ComponentExamples.test.tsx @@ -77,7 +77,7 @@ const excludedExampleFiles: string[] = [ declare const global: any; /** - * Automatically connsume and test any component examples that are added to the codebase. + * Automatically consume and test any component examples that are added to the codebase. * * If you are here and are getting a failure due to a component you recently added, * here are some options: diff --git a/packages/office-ui-fabric-react/src/components/DetailsList/DetailsColumn.tsx b/packages/office-ui-fabric-react/src/components/DetailsList/DetailsColumn.tsx index 892c5ce28e0bc5..ca43b11df46c5d 100644 --- a/packages/office-ui-fabric-react/src/components/DetailsList/DetailsColumn.tsx +++ b/packages/office-ui-fabric-react/src/components/DetailsList/DetailsColumn.tsx @@ -1,12 +1,11 @@ import * as React from 'react'; -import * as stylesImport from './DetailsHeader.scss'; -const styles: any = stylesImport; import { Icon } from '../../Icon'; -import { BaseComponent, css, IRenderFunction, createRef, IDisposable } from '../../Utilities'; +import { BaseComponent, css, IRenderFunction, createRef, IDisposable, IClassNames } from '../../Utilities'; import { IColumn, ColumnActionsMode } from './DetailsList.types'; import { ITooltipHostProps } from '../../Tooltip'; import { IDragDropHelper, IDragDropOptions } from './../../utilities/dragdrop/interfaces'; +import { IDetailsHeaderStyles } from './DetailsHeader.types'; const INNER_PADDING = 16; // Account for padding around the cell. const ISPADDED_WIDTH = 24; @@ -24,6 +23,7 @@ export interface IDetailsColumnProps extends React.Props { isDraggable?: boolean; setDraggedItemIndex?: (itemIndex: number) => void; isDropped?: boolean; + headerClassNames: IClassNames; } export class DetailsColumn extends BaseComponent { @@ -40,7 +40,7 @@ export class DetailsColumn extends BaseComponent { } public render() { - const { column, columnIndex, parentId, isDraggable } = this.props; + const { column, columnIndex, parentId, isDraggable, headerClassNames } = this.props; const { onRenderColumnHeaderTooltip = this._onRenderColumnHeaderTooltip } = this.props; return [ @@ -51,13 +51,13 @@ export class DetailsColumn extends BaseComponent { aria-sort={column.isSorted ? (column.isSortedDescending ? 'descending' : 'ascending') : 'none'} aria-colindex={columnIndex} className={css( - 'ms-DetailsHeader-cell', - styles.cell, + headerClassNames.cell, column.headerClassName, - column.columnActionsMode !== ColumnActionsMode.disabled && 'is-actionable ' + styles.cellIsActionable, - !column.name && 'is-empty ' + styles.cellIsEmpty, + column.columnActionsMode !== ColumnActionsMode.disabled && + 'is-actionable ' + headerClassNames.cellIsActionable, + !column.name && 'is-empty ' + headerClassNames.cellIsEmpty, (column.isSorted || column.isGrouped || column.isFiltered) && 'is-icon-visible', - column.isPadded && styles.cellWrapperPadded + column.isPadded && headerClassNames.cellWrapperPadded )} data-is-draggable={isDraggable} draggable={isDraggable} @@ -65,10 +65,10 @@ export class DetailsColumn extends BaseComponent { data-automationid={'ColumnsHeaderColumn'} data-item-key={column.key} > - {isDraggable && } + {isDraggable && } {onRenderColumnHeaderTooltip( { - hostClassName: css(styles.cellTooltip), + hostClassName: headerClassNames.cellTooltip, id: `${parentId}-${column.key}-tooltip`, setAriaDescribedBy: false, content: column.columnActionsMode !== ColumnActionsMode.disabled ? column.ariaLabel : '', @@ -77,7 +77,7 @@ export class DetailsColumn extends BaseComponent { id={`${parentId}-${column.key}`} aria-label={column.isIconOnly ? column.name : undefined} aria-labelledby={column.isIconOnly ? undefined : `${parentId}-${column.key}-name `} - className={css('ms-DetailsHeader-cellTitle', styles.cellTitle)} + className={headerClassNames.cellTitle} data-is-focusable={column.columnActionsMode !== ColumnActionsMode.disabled} role={column.columnActionsMode !== ColumnActionsMode.disabled ? 'button' : undefined} aria-describedby={ @@ -89,35 +89,30 @@ export class DetailsColumn extends BaseComponent { > {(column.iconName || column.iconClassName) && ( - + )} {!column.isIconOnly ? column.name : undefined} - {column.isFiltered && } + {column.isFiltered && } {column.isSorted && ( )} - {column.isGrouped && } + {column.isGrouped && } {column.columnActionsMode === ColumnActionsMode.hasDropdown && - !column.isIconOnly && ( - - )} + !column.isIconOnly && } ) }, @@ -125,7 +120,11 @@ export class DetailsColumn extends BaseComponent { )} , column.ariaLabel && !this.props.onRenderColumnHeaderTooltip ? ( -