Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Part 3 of 3: DetailsList CSS-in-JS conversion #5514

Merged
merged 12 commits into from
Jul 12, 2018

Conversation

kenotron
Copy link
Member

@kenotron kenotron commented Jul 11, 2018

Pull request checklist

  • Addresses an existing issue: Fixes #0000
  • Include a change request file using $ npm run change

Description of changes

This is a relatively small final checkin to convert the last bits of detailslist to use mergestyles.

Focus areas to test

(optional)

Microsoft Reviewers: Open in CodeFlow

@kenotron
Copy link
Member Author

@JasonGore The last one! This one is significantly smaller than the rest of the DL conversion PRs

@JasonGore JasonGore removed their assignment Jul 11, 2018
@kenotron kenotron requested a review from dzearing July 11, 2018 20:18
"changes": [
{
"packageName": "office-ui-fabric-react",
"comment": "Remaining CSS-in-JS conversion of DetailsList",
Copy link
Contributor

Choose a reason for hiding this comment

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

DetailsList: Complete CSS-in-JS conversion.

Copy link
Member Author

Choose a reason for hiding this comment

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

done

@@ -7,5 +7,7 @@ export { IDetailsHeaderProps };

export const DetailsHeader = styled<IDetailsHeaderProps, IDetailsHeaderStyleProps, IDetailsHeaderStyles>(
DetailsHeaderBase,
getStyles
getStyles,
Copy link
Contributor

Choose a reason for hiding this comment

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

Rename to DetailsHeader.ts (same thing for the other files like this)

Copy link
Member Author

Choose a reason for hiding this comment

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

Done renaming

@@ -1,968 +1,15 @@
import * as React from 'react';
import * as stylesImport from './DetailsList.scss';
import { styled } from '../../Utilities';
Copy link
Contributor

Choose a reason for hiding this comment

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

If you did a rename of DetalisList.tsx -> DetailsList.base.tsx in a commit,, then create a brand new DetailsList.ts (not tsx) with the styled export, the line history gets preserved and you don't show up on gitblame for the entire file :p

export interface IDetailsListProps extends React.Props<DetailsListBase>, IWithViewportProps {
theme?: ITheme;

styles?: IStyleFunctionOrObject<IDetailsListStyleProps, IDetailsListStyles>;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we please document both styles and themes? (I'm sure you can find examples of components which do not, but most do - and we really ought to be documenting)


export type IDetailsListStyleProps = Required<Pick<IDetailsListProps, 'theme'>> &
Pick<IDetailsListProps, 'className'> & {
isHorizontalConstrained?: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

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

We really should be documenting these as well, if you think about the purpose these props serve and from the POV of someone writing a style function for DetailsList

Copy link
Member Author

Choose a reason for hiding this comment

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

added more docs to these


export interface IDetailsListStyles {
root: IStyle;
focusZone: IStyle;
Copy link
Contributor

Choose a reason for hiding this comment

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

And arguably these too (again there are various examples of components which do complete documentation). But minimally the styleprops.

(Look at OverflowSet.types.ts for example...)

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm documenting the styleprops for now - DL subcomponents are not expected to be used directly by others. They're actually kind of a distraction. There are only two styles here and they seem to be pretty self-explanatory.

<ShimmeredDetailsList
items={mockItems(5)}
// tslint:disable-next-line:jsx-no-lambda
onRenderRow={() => null}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not just use jest.fn() in places like this?

Copy link
Member Author

Choose a reason for hiding this comment

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

I just cloned this from DL's test... didn't seem to be a big deal to do a jest.fn() or have props be passed in, in this case

Copy link
Contributor

Choose a reason for hiding this comment

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

Agree it's not a big deal - but you can avoid the tslint disable this way :) Again, no big deal.

Copy link
Contributor

@cliffkoh cliffkoh left a comment

Choose a reason for hiding this comment

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

LGTM. :shipit:

@kenotron kenotron merged commit 266eec7 into microsoft:master Jul 12, 2018
@microsoft microsoft locked as resolved and limited conversation to collaborators Aug 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants