1
0
mirror of https://github.com/flarum/core.git synced 2025-08-05 07:57:46 +02:00

props -> attrs in comments

This commit is contained in:
Franz Liedke
2020-09-18 15:52:31 +02:00
parent 14b12f8ae8
commit cbcb0429d0
18 changed files with 29 additions and 26 deletions

View File

@@ -7,7 +7,7 @@ import extract from '../utils/extract';
* The `Alert` component represents an alert box, which contains a message, * The `Alert` component represents an alert box, which contains a message,
* some controls, and may be dismissible. * some controls, and may be dismissible.
* *
* The alert may have the following special props: * ### Attrs
* *
* - `type` The type of alert this is. Will be used to give the alert a class * - `type` The type of alert this is. Will be used to give the alert a class
* name of `Alert--{type}`. * name of `Alert--{type}`.
@@ -15,7 +15,7 @@ import extract from '../utils/extract';
* - `dismissible` Whether or not the alert can be dismissed. * - `dismissible` Whether or not the alert can be dismissed.
* - `ondismiss` A callback to run when the alert is dismissed. * - `ondismiss` A callback to run when the alert is dismissed.
* *
* All other props will be assigned as attributes on the alert element. * All other attrs will be assigned as attributes on the DOM element.
*/ */
export default class Alert extends Component { export default class Alert extends Component {
view(vnode) { view(vnode) {

View File

@@ -7,7 +7,9 @@ import LoadingIndicator from './LoadingIndicator';
/** /**
* The `Button` component defines an element which, when clicked, performs an * The `Button` component defines an element which, when clicked, performs an
* action. The button may have the following special props: * action.
*
* ### Attrs
* *
* - `icon` The name of the icon class. If specified, the button will be given a * - `icon` The name of the icon class. If specified, the button will be given a
* 'has-icon' class name. * 'has-icon' class name.
@@ -16,7 +18,7 @@ import LoadingIndicator from './LoadingIndicator';
* removed. * removed.
* - `loading` Whether or not the button should be in a disabled loading state. * - `loading` Whether or not the button should be in a disabled loading state.
* *
* All other props will be assigned as attributes on the button element. * All other attrs will be assigned as attributes on the button element.
* *
* Note that a Button has no default class names. This is because a Button can * Note that a Button has no default class names. This is because a Button can
* be used to represent any generic clickable control, like a menu item. * be used to represent any generic clickable control, like a menu item.

View File

@@ -7,7 +7,7 @@ import withAttr from '../utils/withAttr';
/** /**
* The `Checkbox` component defines a checkbox input. * The `Checkbox` component defines a checkbox input.
* *
* ### Props * ### Attrs
* *
* - `state` Whether or not the checkbox is checked. * - `state` Whether or not the checkbox is checked.
* - `className` The class name for the root element. * - `className` The class name for the root element.

View File

@@ -5,7 +5,7 @@ import Component from '../Component';
* event handler that prevents closing the browser window/tab based on the * event handler that prevents closing the browser window/tab based on the
* return value of a given callback prop. * return value of a given callback prop.
* *
* ### Props * ### Attrs
* *
* - `when` - a callback returning true when the browser should prompt for * - `when` - a callback returning true when the browser should prompt for
* confirmation before closing the window/tab * confirmation before closing the window/tab

View File

@@ -3,9 +3,9 @@ import Button from './Button';
/** /**
* The `LinkButton` component defines a `Button` which links to a route. * The `LinkButton` component defines a `Button` which links to a route.
* *
* ### Props * ### Attrs
* *
* All of the props accepted by `Button`, plus: * All of the attrs accepted by `Button`, plus:
* *
* - `active` Whether or not the page that this button links to is currently * - `active` Whether or not the page that this button links to is currently
* active. * active.
@@ -29,9 +29,9 @@ export default class LinkButton extends Button {
} }
/** /**
* Determine whether a component with the given props is 'active'. * Determine whether a component with the given attrs is 'active'.
* *
* @param {Object} props * @param {Object} attrs
* @return {Boolean} * @return {Boolean}
*/ */
static isActive(attrs) { static isActive(attrs) {

View File

@@ -2,12 +2,13 @@ import Component from '../Component';
import { Spinner } from 'spin.js'; import { Spinner } from 'spin.js';
/** /**
* The `LoadingIndicator` component displays a loading spinner with spin.js. It * The `LoadingIndicator` component displays a loading spinner with spin.js.
* may have the following special props: *
* ### Attrs
* *
* - `size` The spin.js size preset to use. Defaults to 'small'. * - `size` The spin.js size preset to use. Defaults to 'small'.
* *
* All other props will be assigned as attributes on the element. * All other attrs will be assigned as attributes on the DOM element.
*/ */
export default class LoadingIndicator extends Component { export default class LoadingIndicator extends Component {
view() { view() {

View File

@@ -4,7 +4,7 @@ import Component from '../Component';
* The `Placeholder` component displays a muted text with some call to action, * The `Placeholder` component displays a muted text with some call to action,
* usually used as an empty state. * usually used as an empty state.
* *
* ### Props * ### Attrs
* *
* - `text` * - `text`
*/ */

View File

@@ -156,8 +156,8 @@ export default class ForumApplication extends Application {
* will be reloaded. Otherwise, a SignUpModal will be opened, prefilled * will be reloaded. Otherwise, a SignUpModal will be opened, prefilled
* with the provided details. * with the provided details.
* *
* @param {Object} payload A dictionary of props to pass into the sign up * @param {Object} payload A dictionary of attrs to pass into the sign up
* modal. A truthy `loggedIn` prop indicates that the user has logged * modal. A truthy `loggedIn` attr indicates that the user has logged
* in, and thus the page is reloaded. * in, and thus the page is reloaded.
* @public * @public
*/ */

View File

@@ -11,7 +11,7 @@ import LoadingIndicator from '../../common/components/LoadingIndicator';
* The `AvatarEditor` component displays a user's avatar along with a dropdown * The `AvatarEditor` component displays a user's avatar along with a dropdown
* menu which allows the user to upload/remove the avatar. * menu which allows the user to upload/remove the avatar.
* *
* ### Props * ### Attrs
* *
* - `className` * - `className`
* - `user` * - `user`

View File

@@ -11,7 +11,7 @@ import ItemList from '../../common/utils/ItemList';
* composer. Subclasses should implement the `onsubmit` method and override * composer. Subclasses should implement the `onsubmit` method and override
* `headerTimes`. * `headerTimes`.
* *
* ### Props * ### Attrs
* *
* - `composer` * - `composer`
* - `originalContent` * - `originalContent`

View File

@@ -7,7 +7,7 @@ import Placeholder from '../../common/components/Placeholder';
/** /**
* The `DiscussionList` component displays a list of discussions. * The `DiscussionList` component displays a list of discussions.
* *
* ### Props * ### Attrs
* *
* - `state` A DiscussionListState object that represents the discussion lists's state. * - `state` A DiscussionListState object that represents the discussion lists's state.
*/ */

View File

@@ -19,7 +19,7 @@ import { escapeRegExp } from 'lodash-es';
* The `DiscussionListItem` component shows a single discussion in the * The `DiscussionListItem` component shows a single discussion in the
* discussion list. * discussion list.
* *
* ### Props * ### Attrs
* *
* - `discussion` * - `discussion`
* - `params` * - `params`

View File

@@ -10,7 +10,7 @@ const hotEdge = (e) => {
* discussions in a panel that can be displayed by moving the mouse to the left * discussions in a panel that can be displayed by moving the mouse to the left
* edge of the screen, where it can also be pinned in place. * edge of the screen, where it can also be pinned in place.
* *
* ### Props * ### Attrs
* *
* - `state` A DiscussionListState object that represents the discussion lists's state. * - `state` A DiscussionListState object that represents the discussion lists's state.
*/ */

View File

@@ -6,7 +6,7 @@ import extractText from '../../common/utils/extractText';
* The `ForgotPasswordModal` component displays a modal which allows the user to * The `ForgotPasswordModal` component displays a modal which allows the user to
* enter their email address and request a link to reset their password. * enter their email address and request a link to reset their password.
* *
* ### Props * ### Attrs
* *
* - `email` * - `email`
*/ */

View File

@@ -7,7 +7,7 @@ import ItemList from '../../common/utils/ItemList';
* The `NotificationGrid` component displays a table of notification types and * The `NotificationGrid` component displays a table of notification types and
* methods, allowing the user to toggle each combination. * methods, allowing the user to toggle each combination.
* *
* ### Props * ### Attrs
* *
* - `user` * - `user`
*/ */

View File

@@ -5,7 +5,7 @@ import icon from '../../common/helpers/icon';
/** /**
* Displays information about a the first or last post in a discussion. * Displays information about a the first or last post in a discussion.
* *
* ### Props * ### Attrs
* *
* - `discussion` * - `discussion`
* - `lastPost` * - `lastPost`

View File

@@ -8,7 +8,7 @@ import Button from '../../common/components/Button';
* The `TextEditor` component displays a textarea with controls, including a * The `TextEditor` component displays a textarea with controls, including a
* submit button. * submit button.
* *
* ### Props * ### Attrs
* *
* - `composer` * - `composer`
* - `submitLabel` * - `submitLabel`

View File

@@ -14,7 +14,7 @@ import listItems from '../../common/helpers/listItems';
* the `UserPage` (in the hero) and in discussions, shown when hovering over a * the `UserPage` (in the hero) and in discussions, shown when hovering over a
* post author. * post author.
* *
* ### Props * ### Attrs
* *
* - `user` * - `user`
* - `className` * - `className`