Skip to content
This repository was archived by the owner on Nov 16, 2023. It is now read-only.

Commit 6ca1e56

Browse files
authored
fix descriptions for customizable components (#518)
1 parent 6fdd3ed commit 6ca1e56

File tree

23 files changed

+90
-85
lines changed

23 files changed

+90
-85
lines changed

config/yo/generator-component/app/templates/Component.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@ import { join } from '../../util/classNames';
66
import { <%= name %>Props, <%= name %>Type } from './<%= name %>.types';
77
import { getClassNames } from './<%= name %>.styles';
88

9-
/**
10-
* Describe what `<%= name %>` does. This will also appear as part of this component's
11-
* documentation.
12-
*/
9+
1310
export class <%= name %> extends React.Component<<%= name %>Props & CustomizableComponentProps> {
1411
public render() {
1512
const { className, type = <%= name %>Type.BLACK, theme = defaultTheme } = this.props;
@@ -23,5 +20,9 @@ export class <%= name %> extends React.Component<<%= name %>Props & Customizable
2320
}
2421
}
2522

23+
/**
24+
* Describe what `<%= name %>` does. This will also appear as part of this component's
25+
* documentation.
26+
*/
2627
@customizable('<%= name %>', ['theme'])
2728
export default class Customizable<%= name %> extends <%= name %> {}

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"raw-loader": "0.5.1",
5858
"react": "16.3.2",
5959
"react-docgen": "2.21.0",
60-
"react-docgen-typescript": "1.6.1",
60+
"react-docgen-typescript": "1.7.0",
6161
"react-dom": "16.3.2",
6262
"react-styleguidist": "7.0.20",
6363
"react-styleguidist-visual": "0.8.0",

src/components/AsideSection/AsideSection.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ import { AsideSectionProps } from './AsideSection.types';
99
import Text, { TextSize } from '../Text';
1010
import { getClassNames } from './AsideSection.styles';
1111

12-
/**
13-
* A section component to be used primarily for sidebar modules
14-
*/
1512
export class AsideSection extends React.Component<AsideSectionProps & CustomizableComponentProps> {
1613
public render() {
1714
const { title, children, theme = defaultTheme } = this.props;
@@ -47,5 +44,8 @@ export class AsideSection extends React.Component<AsideSectionProps & Customizab
4744
}
4845
}
4946

47+
/**
48+
* A section component to be used primarily for sidebar modules
49+
*/
5050
@customizable('AsideSection', ['theme'])
5151
export default class CustomizableAsideSection extends AsideSection {}

src/components/Avatar/Avatar.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,8 @@ export class Avatar extends React.Component<AvatarProps & CustomizableComponentP
5151
}
5252
}
5353

54+
/**
55+
* An `Avatar` shows a thumbnail representation of both an individual or group.
56+
*/
5457
@customizable('Avatar', ['theme'])
5558
export default class CustomizableAvatar extends Avatar {}

src/components/Block/Block.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@ import { getClassNames } from './Block.styles';
66
import { BlockProps } from './Block.types';
77
import { CustomizableComponentProps, defaultTheme, customizable } from '../Customizer';
88

9-
/**
10-
* A `Block` is a layout component to build consistent padding and vertical spacing between
11-
* components. It allows you to `push` a chunk of UI up or down by individual pixels to keep text in
12-
* the `4px` vertical rhythm. It's also the primary place you should set `textSize` in your UIs,
13-
* providing enumerated options for the supported `font-size`/`line-height` combinations.
14-
*/
159
export class Block extends React.Component<BlockProps & CustomizableComponentProps> {
1610
public render() {
1711
const { children, textSize, className, theme = defaultTheme, ...remainingProps } = this.props;
@@ -26,5 +20,11 @@ export class Block extends React.Component<BlockProps & CustomizableComponentPro
2620
}
2721
}
2822

23+
/**
24+
* A `Block` is a layout component to build consistent padding and vertical spacing between
25+
* components. It allows you to `push` a chunk of UI up or down by individual pixels to keep text in
26+
* the `4px` vertical rhythm. It's also the primary place you should set `textSize` in your UIs,
27+
* providing enumerated options for the supported `font-size`/`line-height` combinations.
28+
*/
2929
@customizable('Block', ['theme'])
3030
export default class CustomizableBlock extends Block {}

src/components/Box/Box.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@ import { join } from '../../util/classNames';
77
import { getClassNames } from './Box.styles';
88
import { BoxProps } from './Box.types';
99

10-
/**
11-
* A Box is a div with a border and fixed padding. It also has `display: relative` so you can
12-
* absolutely-position elements like a close button. Boxes will primarily be used for card views.
13-
*/
1410
export class Box extends React.Component<BoxProps & CustomizableComponentProps> {
1511
public render() {
1612
const { children, onClick, className, backgroundColor, borderColor, theme = defaultTheme } = this.props;
@@ -27,5 +23,9 @@ export class Box extends React.Component<BoxProps & CustomizableComponentProps>
2723
}
2824
}
2925

26+
/**
27+
* A Box is a div with a border and fixed padding. It also has `display: relative` so you can
28+
* absolutely-position elements like a close button. Boxes will primarily be used for card views.
29+
*/
3030
@customizable('Box', ['theme'])
3131
export default class CustomizableBox extends Box {}

src/components/Button/Button.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ import {
1919

2020
const hrefBlacklist = ['', '#', 'javascript://'];
2121

22-
/**
23-
* A `Button` allows a user to take an action.
24-
*/
2522
export class Button extends React.Component<ButtonProps & CustomizableComponentProps> {
2623
public static propTypes = {
2724
// TypeScript does not support negated types, so we need to do a runtime validation instead.
@@ -116,5 +113,8 @@ export class Button extends React.Component<ButtonProps & CustomizableComponentP
116113
}
117114
}
118115

116+
/**
117+
* A `Button` allows a user to take an action.
118+
*/
119119
@customizable('Button', ['theme'])
120120
export default class CustomizableButton extends Button {}

src/components/Clickable/Clickable.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@ import { join } from '../../util/classNames';
77
import { getClassNames } from './Clickable.styles';
88
import { ClickableProps } from './Clickable.types';
99

10-
/**
11-
* A `Clickable` is an accessible, clickable area that accepts arbitrary children. It is styled
12-
* like a link by default, but can also be unstyled. Under the hood `Clickable` simply wraps
13-
* content in a `button` element.
14-
*/
1510
export class Clickable extends React.Component<ClickableProps & CustomizableComponentProps> {
1611
private buttonRef = React.createRef<HTMLButtonElement>();
1712

@@ -48,5 +43,10 @@ export class Clickable extends React.Component<ClickableProps & CustomizableComp
4843
}
4944
}
5045

46+
/**
47+
* A `Clickable` is an accessible, clickable area that accepts arbitrary children. It is styled
48+
* like a link by default, but can also be unstyled. Under the hood `Clickable` simply wraps
49+
* content in a `button` element.
50+
*/
5151
@customizable('Clickable', ['theme'])
5252
export default class CustomizableClickable extends Clickable {}

src/components/EditableText/EditableText.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ import { KeyCodes } from '../../util/keyCodes';
1111
import { getClassNames } from './EditableText.styles';
1212
import { EditableTextProps, EditableTextState } from './EditableText.types';
1313

14-
/**
15-
* Displays text which can be edited on click.
16-
*/
1714
export class EditableText extends React.Component<EditableTextProps & CustomizableComponentProps, EditableTextState> {
1815
private textFieldFocusable: Focusable | null;
1916
private clickableFocusable: Focusable | null;
@@ -140,5 +137,8 @@ export class EditableText extends React.Component<EditableTextProps & Customizab
140137
};
141138
}
142139

140+
/**
141+
* Displays text which can be edited on click.
142+
*/
143143
@customizable('EditableText', ['theme'])
144144
export default class CustomizableEditableText extends EditableText {}

src/components/FakeLink/FakeLink.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,6 @@ import { FakeLinkProps } from './FakeLink.types';
66
import { getClassNames } from '../FakeLink/FakeLink.styles';
77
import { CustomizableComponentProps, defaultTheme, customizable } from '../Customizer';
88

9-
/**
10-
* A `FakeLink` is simply a span which imitates the styling of an `<a>` tag (or `NavigationLink`
11-
* component). It is meant to be nested within unstyled `NavigationLink` or `Clickable`
12-
* components, allowing an entire block of content to be an accessible tabbable element while
13-
* still showing individual nested "links" for sighted users.
14-
*
15-
* NOTE: If you are looking for click interaction please see [Clickable](#clickable).
16-
*/
179
export class FakeLink extends React.Component<FakeLinkProps & CustomizableComponentProps> {
1810
public render() {
1911
const { className, children, theme = defaultTheme } = this.props;
@@ -23,5 +15,13 @@ export class FakeLink extends React.Component<FakeLinkProps & CustomizableCompon
2315
}
2416
}
2517

18+
/**
19+
* A `FakeLink` is simply a span which imitates the styling of an `<a>` tag (or `NavigationLink`
20+
* component). It is meant to be nested within unstyled `NavigationLink` or `Clickable`
21+
* components, allowing an entire block of content to be an accessible tabbable element while
22+
* still showing individual nested "links" for sighted users.
23+
*
24+
* NOTE: If you are looking for click interaction please see [Clickable](#clickable).
25+
*/
2626
@customizable('FakeLink', ['theme'])
2727
export default class CustomizableFakeLink extends FakeLink {}

src/components/Hovercard/Hovercard.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@ import { HovercardProps, HovercardState, TriggerType } from './Hovercard.types';
1212
const hideDelay = 500;
1313
const showDelay = 750;
1414

15-
/**
16-
* A `Hovercard` is a small popover overlay. It opens on click or
17-
* mouse enter, and closes on mouse out and `ESC`. It should be used with `HovercardHeader` and
18-
* `HovercardBody` components for consistent internal padding.
19-
*/
2015
export class Hovercard extends React.Component<HovercardProps & CustomizableComponentProps, HovercardState> {
2116
public static defaultProps: Partial<HovercardProps> = {
2217
directionalHint: DirectionalHint.bottomCenter,
@@ -203,5 +198,10 @@ export class Hovercard extends React.Component<HovercardProps & CustomizableComp
203198
};
204199
}
205200

201+
/**
202+
* A `Hovercard` is a small popover overlay. It opens on click or
203+
* mouse enter, and closes on mouse out and `ESC`. It should be used with `HovercardHeader` and
204+
* `HovercardBody` components for consistent internal padding.
205+
*/
206206
@customizable('Hovercard', ['theme'])
207207
export default class CustomizableHovercard extends Hovercard {}

src/components/Hovercard/HovercardHeader.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ import Block, { GutterSize } from '../Block';
77
import { getClassNames } from './Hovercard.styles';
88
import { HovercardHeaderProps } from './Hovercard.types';
99

10-
/**
11-
* Header of a `Hovercard` component. Used to maintain a consistent layout.
12-
*/
1310
export class HovercardHeader extends React.Component<HovercardHeaderProps & CustomizableComponentProps> {
1411
public render() {
1512
const { className, children, theme = defaultTheme } = this.props;
@@ -23,5 +20,8 @@ export class HovercardHeader extends React.Component<HovercardHeaderProps & Cust
2320
}
2421
}
2522

23+
/**
24+
* Header of a `Hovercard` component. Used to maintain a consistent layout.
25+
*/
2626
@customizable('HovercardHeader', ['theme'])
2727
export default class CustomizableHovercardHeader extends HovercardHeader {}

src/components/MessageBar/MessageBar.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@ import { FixedGridRow, FixedGridColumn, GutterSize } from '../FixedGrid';
88
import { getClassNames } from './MessageBar.styles';
99
import { MessageBarType, MessageBarProps } from './MessageBar.types';
1010

11-
/**
12-
* A `MessageBar` displays relevant status information. You can use a `MessageBar` to tell the user
13-
* about a situation, and optionally provide actions for them to take.
14-
*/
1511
export class MessageBar extends React.Component<MessageBarProps & CustomizableComponentProps> {
1612
public render() {
1713
const { actions, children, className, type = MessageBarType.INFO, theme = defaultTheme } = this.props;
@@ -32,5 +28,9 @@ export class MessageBar extends React.Component<MessageBarProps & CustomizableCo
3228
}
3329
}
3430

31+
/**
32+
* A `MessageBar` displays relevant status information. You can use a `MessageBar` to tell the user
33+
* about a situation, and optionally provide actions for them to take.
34+
*/
3535
@customizable('MessageBar', ['theme'])
3636
export default class CustomizableMessageBar extends MessageBar {}

src/components/ModalDialog/ModalDialog.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ import { join } from '../../util/classNames';
1313
import { getClassNames } from './ModalDialog.styles';
1414
import { ModalDialogProps } from './ModalDialog.types';
1515

16-
/**
17-
* A `ModalDialog` is a temporary, modal UI overlay that generally provides contextual app
18-
* information or requires user confirmation/input.
19-
*/
2016
export class ModalDialog extends React.Component<ModalDialogProps & CustomizableComponentProps> {
2117
public render() {
2218
const { children, className, isOpen, onDismiss, size, theme = defaultTheme } = this.props;
@@ -69,5 +65,9 @@ export class ModalDialog extends React.Component<ModalDialogProps & Customizable
6965
};
7066
}
7167

68+
/**
69+
* A `ModalDialog` is a temporary, modal UI overlay that generally provides contextual app
70+
* information or requires user confirmation/input.
71+
*/
7272
@customizable('ModalDialog', ['theme'])
7373
export default class CustomizableModalDialog extends ModalDialog {}

src/components/NavigationLink/NavigationLink.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ import { join } from '../../util/classNames';
66
import { getClassNames } from './NavigationLink.styles';
77
import { NavigationLinkProps } from './NavigationLink.types';
88

9-
/**
10-
* A `NavigationLink` renders an `a` tag for navigation between web pages.
11-
*/
129
export class NavigationLink extends React.Component<NavigationLinkProps & CustomizableComponentProps> {
1310
public render() {
1411
const {
@@ -41,5 +38,8 @@ export class NavigationLink extends React.Component<NavigationLinkProps & Custom
4138
}
4239
}
4340

41+
/**
42+
* A `NavigationLink` renders an `a` tag for navigation between web pages.
43+
*/
4444
@customizable('NavigationLink', ['theme'])
4545
export default class CustomizableNavigationLink extends NavigationLink {}

src/components/Picker/Picker.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ import './Picker.css'; // Required for the Callout content as there aren't JS st
1414

1515
class SuggestionListBasePicker extends BasePicker<SuggestionItem, IBasePickerProps<SuggestionItem>> {}
1616

17-
/**
18-
* Pickers are used to pick one or more entities (e.g. people, groups, topics) from a list with typeahead capabilities.
19-
*/
2017
export class Picker extends React.Component<PickerProps & CustomizableComponentProps> {
2118
public render() {
2219
const {
@@ -101,5 +98,9 @@ export class Picker extends React.Component<PickerProps & CustomizableComponentP
10198
);
10299
};
103100
}
101+
102+
/**
103+
* Pickers are used to pick one or more entities (e.g. people, groups, topics) from a list with typeahead capabilities.
104+
*/
104105
@customizable('Picker', ['theme'])
105106
export default class CustomizablePicker extends Picker {}

src/components/PreviewCard/PreviewCard.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@ import Spinner, { SpinnerColor, SpinnerSize } from '../Spinner';
1616
import { getClassNames } from './PreviewCard.styles';
1717
import { PreviewCardProps, PreviewCardState } from './PreviewCard.types';
1818

19-
/**
20-
* PreviewCard is a compact representation of an uploaded file or other attachment. It supports an
21-
* editable description, and a loading experience (Spinner or percentage ProgressIndicator).
22-
*/
2319
export class PreviewCard extends React.Component<PreviewCardProps & CustomizableComponentProps, PreviewCardState> {
2420
constructor(props: PreviewCardProps) {
2521
super(props);
@@ -156,5 +152,9 @@ export class PreviewCard extends React.Component<PreviewCardProps & Customizable
156152
}
157153
}
158154

155+
/**
156+
* PreviewCard is a compact representation of an uploaded file or other attachment. It supports an
157+
* editable description, and a loading experience (Spinner or percentage ProgressIndicator).
158+
*/
159159
@customizable('PreviewCard', ['theme'])
160160
export default class CustomizablePreviewCard extends PreviewCard {}

src/components/ProgressIndicator/ProgressIndicator.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ import { ProgressIndicator as OfficeFabricProgressIndicator } from 'office-ui-fa
66
import { getProgressIndicatorStyles } from './ProgressIndicator.styles';
77
import { ProgressIndicatorProps } from './ProgressIndicator.types';
88

9-
/**
10-
* A `ProgressIndicator` is used to show the progress of an ongoing operation
11-
* e.g. a file upload.
12-
*/
139
export class ProgressIndicator extends React.Component<ProgressIndicatorProps & CustomizableComponentProps> {
1410
public render() {
1511
const { ariaValueText, percentComplete, className, theme = defaultTheme } = this.props;
@@ -25,5 +21,9 @@ export class ProgressIndicator extends React.Component<ProgressIndicatorProps &
2521
}
2622
}
2723

24+
/**
25+
* A `ProgressIndicator` is used to show the progress of an ongoing operation
26+
* e.g. a file upload.
27+
*/
2828
@customizable('ProgressIndicator', ['theme'])
2929
export default class CustomizableProgressIndicator extends ProgressIndicator {}

src/components/Spinner/Spinner.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,6 @@ const fabricSpinnerSizes = {
3333
[SpinnerSize.XSMALL]: FabricSpinnerSize.xSmall,
3434
};
3535

36-
/**
37-
* A `Spinner` is an outline of a circle which animates around itself indicating to the user that
38-
* things are processing. It is shown when we're unsure how long a task will take.
39-
*/
4036
export class Spinner extends React.Component<SpinnerProps & CustomizableComponentProps> {
4137
public render() {
4238
const {
@@ -77,5 +73,9 @@ export class Spinner extends React.Component<SpinnerProps & CustomizableComponen
7773
}
7874
}
7975

76+
/**
77+
* A `Spinner` is an outline of a circle which animates around itself indicating to the user that
78+
* things are processing. It is shown when we're unsure how long a task will take.
79+
*/
8080
@customizable('Spinner', ['theme'])
8181
export default class CustomizableSpinner extends Spinner {}

0 commit comments

Comments
 (0)