-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Demo Page Refactor Part 1 #5055
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
Changes from 2 commits
5d9b0ef
9af2afd
f08f3fc
88148c3
b6d500d
b4bc564
a80e9f3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,74 +1,43 @@ | ||
| import * as React from 'react'; | ||
| import { | ||
| ExampleCard, | ||
| ComponentPage, | ||
| IComponentDemoPageProps, | ||
| PropertiesTableSet, | ||
| PageMarkdown | ||
| } from '@uifabric/example-app-base'; | ||
| import { ComponentStatus } from '../../demo/ComponentStatus/ComponentStatus'; | ||
| import { ActivityItemStatus } from './ActivityItem.checklist'; | ||
| import { ActivityItemBasicExample } from './examples/ActivityItem.Basic.Example'; | ||
| 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'; | ||
|
|
||
| const ActivityItemBasicExampleCode = require('!raw-loader!office-ui-fabric-react/src/components/ActivityItem/examples/ActivityItem.Basic.Example.tsx') as string; | ||
| const ActivityItemPersonaExampleCode = require('!raw-loader!office-ui-fabric-react/src/components/ActivityItem/examples/ActivityItem.Persona.Example.tsx') as string; | ||
| const ActivityItemCompactExampleCode = require('!raw-loader!office-ui-fabric-react/src/components/ActivityItem/examples/ActivityItem.Compact.Example.tsx') as string; | ||
|
|
||
| export class ActivityItemPage extends React.Component<IComponentDemoPageProps, {}> { | ||
| public render(): JSX.Element { | ||
| return ( | ||
| <ComponentPage | ||
| title='ActivityItem' | ||
| componentName='ActivityItem' | ||
| componentUrl='https://github.com/OfficeDev/office-ui-fabric-react/tree/master/packages/office-ui-fabric-react/src/components/ActivityItem' | ||
| exampleCards={ | ||
| <div> | ||
| <ExampleCard title='Activity Items with Icons' code={ ActivityItemBasicExampleCode }> | ||
| <ActivityItemBasicExample /> | ||
| </ExampleCard> | ||
| <ExampleCard title='Activity Items with Personas' code={ ActivityItemPersonaExampleCode }> | ||
| <ActivityItemPersonaExample /> | ||
| </ExampleCard> | ||
| <ExampleCard title='Compact Activity Items' code={ ActivityItemCompactExampleCode }> | ||
| <ActivityItemCompactExample /> | ||
| </ExampleCard> | ||
| </div> | ||
| } | ||
| propertiesTables={ | ||
| <PropertiesTableSet | ||
| sources={ [ | ||
| require<string>('!raw-loader!office-ui-fabric-react/src/components/ActivityItem/ActivityItem.types.ts') | ||
| ] } | ||
| /> | ||
| } | ||
| overview={ | ||
| <PageMarkdown> | ||
| { require<string>('!raw-loader!office-ui-fabric-react/src/components/ActivityItem/docs/ActivityItemOverview.md') } | ||
| </PageMarkdown> | ||
| } | ||
| bestPractices={ | ||
| <div /> | ||
| } | ||
| dos={ | ||
| <PageMarkdown> | ||
| { require<string>('!raw-loader!office-ui-fabric-react/src/components/ActivityItem/docs/ActivityItemDos.md') } | ||
| </PageMarkdown> | ||
| } | ||
| donts={ | ||
| <PageMarkdown> | ||
| { require<string>('!raw-loader!office-ui-fabric-react/src/components/ActivityItem/docs/ActivityItemDonts.md') } | ||
| </PageMarkdown> | ||
| } | ||
| isHeaderVisible={ this.props.isHeaderVisible } | ||
| componentStatus={ | ||
| <ComponentStatus | ||
| { ...ActivityItemStatus } | ||
| /> | ||
| } | ||
| /> | ||
| ); | ||
| } | ||
| export const ActivityItemPageProps: IDemoPageProps = { | ||
| title: 'ActivityItem', | ||
| componentName: 'ActivityItem', | ||
| componentUrl: 'https://github.com/OfficeDev/office-ui-fabric-react/tree/master/packages/office-ui-fabric-react/src/components/ActivityItem', | ||
| componentStatus: ActivityItemStatus, | ||
| examples: [ | ||
| { | ||
| title: 'Activity Items with Icons', | ||
| code: ActivityItemBasicExampleCode, | ||
| view: <ActivityItemBasicExample /> | ||
| }, | ||
| { | ||
| title: 'Activity Items with Personas', | ||
| code: ActivityItemPersonaExampleCode, | ||
| view: <ActivityItemPersonaExample /> | ||
| }, | ||
| { | ||
| title: 'Compact Activity Items', | ||
| code: ActivityItemCompactExampleCode, | ||
| view: <ActivityItemCompactExample /> | ||
| } | ||
| ], | ||
| propertiesTablesSources: [require<string>('!raw-loader!office-ui-fabric-react/src/components/ActivityItem/ActivityItem.types.ts')], | ||
| overview: require<string>('!raw-loader!office-ui-fabric-react/src/components/ActivityItem/docs/ActivityItemOverview.md'), | ||
| bestPractices: '', | ||
| dos: require<string>('!raw-loader!office-ui-fabric-react/src/components/ActivityItem/docs/ActivityItemDos.md'), | ||
| donts: require<string>('!raw-loader!office-ui-fabric-react/src/components/ActivityItem/docs/ActivityItemDonts.md'), | ||
| isHeaderVisible: true, | ||
| }; | ||
|
|
||
| } | ||
| export const ActivityItemPage = (props: { isHeaderVisible: boolean }) => (<DemoPage { ...{ ...ActivityItemPageProps, ...props } } />); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| import { IDemoPageProps } from './IDemoPageProps'; | ||
| 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'; | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same thing
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. auto-import keeps giving me non relative stuff |
||
| export function DemoPage(componentPageProps: IDemoPageProps) { | ||
| return ( | ||
| <ComponentPage | ||
| title={ componentPageProps.title } | ||
| componentName={ componentPageProps.componentName } | ||
| componentUrl={ componentPageProps.componentUrl } | ||
| exampleCards={ | ||
| <div> | ||
| { componentPageProps.examples.map(example => ( | ||
| <ExampleCard title={ example.title } code={ example.code } key={ example.title }> | ||
| { example.view } | ||
| </ExampleCard> | ||
| )) } | ||
| </div> | ||
| } | ||
| propertiesTables={ | ||
| <PropertiesTableSet | ||
| sources={ componentPageProps.propertiesTablesSources } | ||
| /> | ||
| } | ||
| overview={ | ||
| <PageMarkdown> | ||
| { componentPageProps.overview } | ||
| </PageMarkdown> | ||
| } | ||
| bestPractices={ | ||
| <PageMarkdown> | ||
| { componentPageProps.bestPractices } | ||
| </PageMarkdown> | ||
| } | ||
| dos={ | ||
| <PageMarkdown> | ||
| { componentPageProps.dos } | ||
| </PageMarkdown> | ||
| } | ||
| donts={ | ||
| <PageMarkdown> | ||
| { componentPageProps.donts } | ||
| </PageMarkdown> | ||
| } | ||
| isHeaderVisible={ componentPageProps.isHeaderVisible } | ||
| componentStatus={ | ||
| <ComponentStatus | ||
| { ...componentPageProps.componentStatus } | ||
| /> | ||
| } | ||
| /> | ||
| ); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import { IComponentStatusProps } from 'office-ui-fabric-react/lib/demo/ComponentStatus/ComponentStatus.types'; | ||
|
|
||
| export interface IDemoPageProps { | ||
| title: string; | ||
| componentName: string; | ||
| componentUrl: string; | ||
| componentStatus: IComponentStatusProps; | ||
| examples: { | ||
| title: string; | ||
| code: string; | ||
| view: JSX.Element; | ||
| }[]; | ||
| propertiesTablesSources: string[]; | ||
| overview: string; | ||
| dos: string; | ||
| donts: string; | ||
| bestPractices: string; | ||
| isHeaderVisible: boolean; | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 2 things:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you mean to do a relative path import from here?
There was a problem hiding this comment.
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.