Skip to content

Demo Page Refactor Part 1#5055

Merged
kenotron merged 7 commits intomicrosoft:masterfrom
kenotron:demo
Jun 2, 2018
Merged

Demo Page Refactor Part 1#5055
kenotron merged 7 commits intomicrosoft:masterfrom
kenotron:demo

Conversation

@kenotron
Copy link
Copy Markdown
Contributor

@kenotron kenotron commented Jun 1, 2018

Pull request checklist

  • Addresses an existing issue: Fixes #0000
  • Include a change request file using $ npm run change
  • Microsoft Alias (if you have one): kchau

Description of changes

This is Part 1 / 3 of a demo page refactor to get rid of circular deps in our fabric / demo / example-app-base. In this part, I'm simply trying to establish the pattern with ONE converted page to keep this checkin tiny and easy to review.

Part 2 will convert all other pages to use this format under fabric
Part 3 will actually remove the fabric -> example-app-base dependency

Focus areas to test

(optional)

Microsoft Reviewers: Open in CodeFlow

@kenotron kenotron requested a review from dzearing June 1, 2018 03:27
import { ActivityItemPersonaExample } from './examples/ActivityItem.Persona.Example';
import { ActivityItemCompactExample } from './examples/ActivityItem.Compact.Example';
import { IDemoPageProps } from '../../demo/components/IDemoPageProps';
import { DemoPage } from 'office-ui-fabric-react/lib/demo/components/DemoPage';
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.

office-ui-fabric-react/lib/demo [](start = 26, length = 31)

Did you mean to do a relative path import from here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, I did actually mean to do relative.

import { ComponentPage, ExampleCard, PropertiesTableSet, PageMarkdown } from '@uifabric/example-app-base';
import * as React from 'react';
import { ComponentStatus } from 'office-ui-fabric-react/lib/demo/ComponentStatus/ComponentStatus';

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.

same thing

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

auto-import keeps giving me non relative stuff

donts: string;
bestPractices: string;
isHeaderVisible: boolean;
} No newline at end of file
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.

2 things:

  1. we no longer call props pages ComponentProps.ts in Fabric. Instead, it is presently .types.ts
  2. need js doc here :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

does it matter that this isn't going to be something we document with api documenter tool?

@cliffkoh
Copy link
Copy Markdown
Contributor

cliffkoh commented Jun 1, 2018

It would be helpful for code reviewers if you illustrated in your PR description the before/after so it is clearer how the circular dependency was before, so that reviewers can verify that the circular dependency is broken up now...

@kenotron
Copy link
Copy Markdown
Contributor Author

kenotron commented Jun 1, 2018

I won't be able to break up the circular dependency until I'm done with part 3, so I can speak to just one file and its implications, @cliffkoh .

Currently, we have a circular dependency of OUFR + Demo -> example-app-base -> OUFR

What I seek to do is to move Demo pages out of OUFR (retaining the important examples, overview, etc in an exported JSON like I have here inside ActivityItemPage.tsx). So it'll look like this:

Demo (consumes .md & page props inside OUFR via relative or webpack aliasing) -> example-app-base -> OUFR

@@ -0,0 +1,45 @@
import { IComponentStatusProps } from 'office-ui-fabric-react/lib/demo/ComponentStatus/ComponentStatus.types';
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.

Should be a relative path import

import * as React from 'react';
import { ComponentStatus } from '../ComponentStatus/ComponentStatus';

export const DemoPage = (componentPageProps: IDemoPageProps) => {
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.

Please kindly type as React.StatelessComponent :) The current declaration isn't equivalent from a typing POV.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yes

/** title that goes into the header */
title: string;

/** name of the component being documented */
Copy link
Copy Markdown
Contributor

@cliffkoh cliffkoh Jun 1, 2018

Choose a reason for hiding this comment

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

I know all these are not making it today, to the documentation page, but ultimately contributors to the OUFR library will be interacting with it when they fill out the IDemoPageProps object in each of the example page they craft.

So we really should have the same quality bar in our comments as we expect the directly public-facing documentation that makes it to the website.

You know.. broken window theory aside, I believe the core team needs to set a good example.

So Name of the component being documented. instead of name of the component being documented.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think we might want to write down the bar for documentation. I hadn't found a wiki page / readme on it so far. Perhaps I'll add it once I get this checked in.

Copy link
Copy Markdown
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.

Thanks for the comment describing your overall approach. 👍

@kenotron kenotron merged commit 1506d4c into microsoft:master Jun 2, 2018
@kenotron kenotron deleted the demo branch June 2, 2018 13:15
Markionium added a commit to Markionium/office-ui-fabric-react that referenced this pull request Jun 2, 2018
* master: (274 commits)
  Demo Page Refactor Part 1 (microsoft#5055)
  SplitButton: Add aria-roledescription (microsoft#5062)
  Add addins sketch toolkit link (microsoft#5052)
  Dropdown title (microsoft#4983)
  Allow for more control over event handling for keytips (microsoft#5064)
  Build time speed improvements (microsoft#4965)
  Coachmark: Positioning fixes (microsoft#4995)
  Applying package updates.
  Experiments/Nav component: display "show more" link only if there is atleast one hidden link (microsoft#5057)
  Add pointerup listener to exit keytip mode (microsoft#5051)
  Update PULL_REQUEST_TEMPLATE.md
  Update ISSUE_TEMPLATE.md
  Shimmer: resolve conflicts (microsoft#5034)
  Invalid ARIA attributes: Fix empty values (microsoft#5040)
  ComboBox: Correct invalid ARIA attributes. (microsoft#4873) (microsoft#5001)
  ComboBox: Fix submit pending value (microsoft#5048)
  FocusTrapZone - restore last focused descendant element (microsoft#4897)
  Applying package updates.
  Take 2 of the require.resolve change. This time using the "resolve" pkg (microsoft#5031)
  fixing webpack config to allow rush build to complete on a small VM (microsoft#5037)
  ...
Markionium added a commit to Markionium/office-ui-fabric-react that referenced this pull request Jun 3, 2018
* master: (111 commits)
  Moving a variable to be defined sooner so that it is there when failures occur.
  Fix icon imports (microsoft#5069)
  MessageBar: More visible HC color for dismiss and expand buttons (microsoft#5061)
  Fix DetailsList accessibility and add more ARIA hooks (microsoft#5066)
  Update jest (microsoft#5068)
  Demo Page Refactor Part 1 (microsoft#5055)
  SplitButton: Add aria-roledescription (microsoft#5062)
  Add addins sketch toolkit link (microsoft#5052)
  Dropdown title (microsoft#4983)
  Allow for more control over event handling for keytips (microsoft#5064)
  Build time speed improvements (microsoft#4965)
  Coachmark: Positioning fixes (microsoft#4995)
  Applying package updates.
  Experiments/Nav component: display "show more" link only if there is atleast one hidden link (microsoft#5057)
  Add pointerup listener to exit keytip mode (microsoft#5051)
  Update PULL_REQUEST_TEMPLATE.md
  Update ISSUE_TEMPLATE.md
  Shimmer: resolve conflicts (microsoft#5034)
  Invalid ARIA attributes: Fix empty values (microsoft#5040)
  ComboBox: Correct invalid ARIA attributes. (microsoft#4873) (microsoft#5001)
  ...
@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.

2 participants